Sha256: 1334cde2de94a5a4861b72b7f8c1ccda2d6da671ea70269dcdcdd443234564c4

Contents?: true

Size: 764 Bytes

Versions: 20

Compression:

Stored size: 764 Bytes

Contents

module Puppet::Parser::Functions

  newfunction(:getvar, :type => :rvalue, :doc => <<-'ENDHEREDOC') do |args|
    Lookup a variable in a remote namespace.

    For example:

        $foo = getvar('site::data::foo')
        # Equivalent to $foo = $site::data::foo

    This is useful if the namespace itself is stored in a string:

        $datalocation = 'site::data'
        $bar = getvar("${datalocation}::bar")
        # Equivalent to $bar = $site::data::bar
    ENDHEREDOC

    unless args.length == 1
      raise Puppet::ParseError, ("getvar(): wrong number of arguments (#{args.length}; must be 1)")
    end

    begin
      self.lookupvar("#{args[0]}")
    rescue Puppet::ParseError # Eat the exception if strict_variables = true is set
    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-retrospec-1.8.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.7.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.6.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.6.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.5.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.4.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.4.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.3.2 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.3.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.3.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.2.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.2.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.1.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-1.0.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.12.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.12.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.11.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.10.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.9.1 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb
puppet-retrospec-0.9.0 spec/fixtures/modules/stdlib/lib/puppet/parser/functions/getvar.rb