Sha256: cdd4b025092817b8158a477d920969246b1f97f99a0876619f1ad887d845514a
Contents?: true
Size: 1.18 KB
Versions: 9
Compression:
Stored size: 1.18 KB
Contents
module PuppetRepl module Support module Scope def set_scope(value) @scope = value end # @return [Scope] puppet scope object def scope unless @scope @scope ||= create_scope end @scope end def create_scope do_initialize begin @compiler = create_compiler(node) # creates a new compiler for each scope scope = Puppet::Parser::Scope.new(@compiler) # creates a node class scope.source = Puppet::Resource::Type.new(:node, node.name) scope.parent = @compiler.topscope load_lib_dirs # compiling will load all the facts into the scope # without this step facts will not get resolved scope.compiler.compile # this will load everything into the scope rescue StandardError => e err = parse_error(e) raise err end scope end # returns a hash of varaibles that are currently in scope def scope_vars vars = scope.to_hash.delete_if {| key, value | node.facts.values.key?(key.to_sym) } vars['facts'] = 'removed by the puppet-repl' end end end end
Version data entries
9 entries across 9 versions & 1 rubygems