Sha256: f6404e00c3a8f3f1ac0d1c23d6f8a375d2cd0ae7e036a167c85814aeb57eedae
Contents?: true
Size: 1.2 KB
Versions: 3
Compression:
Stored size: 1.2 KB
Contents
# frozen_string_literal: true module PuppetDebugger module Support module Scope def set_scope(value) @scope = value end # @return [Scope] puppet scope object def scope @scope ||= create_scope unless @scope @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-debugger' end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
puppet-debugger-0.4.4 | lib/puppet-debugger/support/scope.rb |
puppet-debugger-0.4.3 | lib/puppet-debugger/support/scope.rb |
puppet-debugger-0.4.2 | lib/puppet-debugger/support/scope.rb |