puppet-debugger 0.17.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitlab-ci.yml +12 -26
- data/.rubocop.yml +64 -232
- data/.rubocop_todo.yml +89 -147
- data/.vscode/launch.json +15 -0
- data/CHANGELOG.md +29 -0
- data/Gemfile +9 -6
- data/README.md +27 -14
- data/Rakefile +11 -12
- data/bin/pdb +1 -1
- data/lib/awesome_print/ext/awesome_puppet.rb +10 -8
- data/lib/plugins/puppet-debugger/input_responders/benchmark.rb +5 -4
- data/lib/plugins/puppet-debugger/input_responders/classes.rb +14 -2
- data/lib/plugins/puppet-debugger/input_responders/classification.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/commands.rb +18 -18
- data/lib/plugins/puppet-debugger/input_responders/datatypes.rb +22 -6
- data/lib/plugins/puppet-debugger/input_responders/environment.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/exit.rb +5 -3
- data/lib/plugins/puppet-debugger/input_responders/facterdb_filter.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/facts.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/functions.rb +34 -32
- data/lib/plugins/puppet-debugger/input_responders/help.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/krt.rb +4 -2
- data/lib/plugins/puppet-debugger/input_responders/play.rb +22 -24
- data/lib/plugins/puppet-debugger/input_responders/reset.rb +5 -3
- data/lib/plugins/puppet-debugger/input_responders/resources.rb +16 -7
- data/lib/plugins/puppet-debugger/input_responders/set.rb +34 -32
- data/lib/plugins/puppet-debugger/input_responders/stacktrace.rb +31 -0
- data/lib/plugins/puppet-debugger/input_responders/types.rb +6 -2
- data/lib/plugins/puppet-debugger/input_responders/vars.rb +8 -7
- data/lib/plugins/puppet-debugger/input_responders/whereami.rb +5 -3
- data/lib/puppet-debugger/cli.rb +129 -91
- data/lib/puppet-debugger/code/code_file.rb +13 -14
- data/lib/puppet-debugger/code/code_range.rb +5 -3
- data/lib/puppet-debugger/code/loc.rb +1 -1
- data/lib/puppet-debugger/debugger_code.rb +2 -0
- data/lib/puppet-debugger/hooks.rb +15 -16
- data/lib/puppet-debugger/input_responder_plugin.rb +54 -52
- data/lib/puppet-debugger/monkey_patches.rb +4 -1
- data/lib/puppet-debugger/plugin_test_helper.rb +9 -8
- data/lib/puppet-debugger/support.rb +44 -18
- data/lib/puppet-debugger/support/environment.rb +6 -5
- data/lib/puppet-debugger/support/errors.rb +25 -27
- data/lib/puppet-debugger/support/facts.rb +5 -5
- data/lib/puppet-debugger/support/node.rb +4 -7
- data/lib/puppet-debugger/support/scope.rb +29 -0
- data/lib/puppet-debugger/trollop.rb +38 -31
- data/lib/puppet-debugger/version.rb +1 -1
- data/lib/puppet/application/debugger.rb +151 -126
- data/output.json +1 -0
- data/puppet-debugger.gemspec +18 -15
- data/spec/awesome_print/ext/awesome_puppet_spec.rb +30 -30
- data/spec/fixtures/pe-xl-core-0.puppet.vm.json +1 -0
- data/spec/fixtures/sample_start_debugger.pp +3 -2
- data/spec/hooks_spec.rb +33 -35
- data/spec/input_responder_plugin_spec.rb +7 -6
- data/spec/input_responders/benchmark_spec.rb +3 -1
- data/spec/input_responders/classes_spec.rb +12 -13
- data/spec/input_responders/classification_spec.rb +4 -2
- data/spec/input_responders/commands_spec.rb +2 -0
- data/spec/input_responders/datatypes_spec.rb +8 -2
- data/spec/input_responders/environment_spec.rb +2 -0
- data/spec/input_responders/exit_spec.rb +9 -11
- data/spec/input_responders/facterdb_filter_spec.rb +2 -0
- data/spec/input_responders/facts_spec.rb +2 -0
- data/spec/input_responders/functions_spec.rb +30 -28
- data/spec/input_responders/help_spec.rb +5 -3
- data/spec/input_responders/krt_spec.rb +3 -1
- data/spec/input_responders/play_spec.rb +10 -20
- data/spec/input_responders/reset_spec.rb +2 -0
- data/spec/input_responders/resources_spec.rb +7 -1
- data/spec/input_responders/set_spec.rb +3 -1
- data/spec/input_responders/stacktrace_spec.rb +15 -0
- data/spec/input_responders/types_spec.rb +2 -0
- data/spec/input_responders/vars_spec.rb +4 -4
- data/spec/input_responders/whereami_spec.rb +2 -0
- data/spec/pdb_spec.rb +0 -9
- data/spec/puppet/application/debugger_spec.rb +35 -17
- data/spec/puppet_debugger_spec.rb +81 -84
- data/spec/remote_node_spec.rb +1 -5
- data/spec/spec_helper.rb +22 -18
- data/spec/support_spec.rb +3 -5
- data/test_matrix.rb +1 -1
- metadata +54 -21
@@ -47,13 +47,15 @@ class DebuggerCode
|
|
47
47
|
|
48
48
|
# @return [Integer]
|
49
49
|
def find_start_index(lines)
|
50
|
-
return start_line if start_line
|
50
|
+
return start_line if start_line.negative?
|
51
|
+
|
51
52
|
lines.index { |loc| loc.lineno >= start_line } || lines.length
|
52
53
|
end
|
53
54
|
|
54
55
|
# @return [Integer]
|
55
56
|
def find_end_index(lines)
|
56
|
-
return end_line if end_line
|
57
|
+
return end_line if end_line.negative?
|
58
|
+
|
57
59
|
(lines.index { |loc| loc.lineno > end_line } || 0) - 1
|
58
60
|
end
|
59
61
|
|
@@ -66,4 +68,4 @@ class DebuggerCode
|
|
66
68
|
@start_line = start_line.first
|
67
69
|
end
|
68
70
|
end
|
69
|
-
|
71
|
+
end
|
@@ -164,6 +164,7 @@ class DebuggerCode
|
|
164
164
|
# @return [Code]
|
165
165
|
def grep(pattern)
|
166
166
|
return self unless pattern
|
167
|
+
|
167
168
|
pattern = Regexp.new(pattern)
|
168
169
|
|
169
170
|
select do |loc|
|
@@ -238,6 +239,7 @@ class DebuggerCode
|
|
238
239
|
|
239
240
|
def add_file_reference
|
240
241
|
return "From inline code: \n" unless filename
|
242
|
+
|
241
243
|
"From file: #{File.basename(filename)}\n"
|
242
244
|
end
|
243
245
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/support/errors'
|
2
4
|
|
3
5
|
module PuppetDebugger
|
@@ -18,7 +20,7 @@ module PuppetDebugger
|
|
18
20
|
end
|
19
21
|
|
20
22
|
# Ensure that duplicates have their @hooks object.
|
21
|
-
def initialize_copy(
|
23
|
+
def initialize_copy(_orig)
|
22
24
|
hooks_dup = @hooks.dup
|
23
25
|
@hooks.each do |k, v|
|
24
26
|
hooks_dup[k] = v.dup
|
@@ -37,8 +39,9 @@ module PuppetDebugger
|
|
37
39
|
# @return [PuppetDebugger::Hooks] The receiver.
|
38
40
|
# @see {#merge}
|
39
41
|
def merge!(other)
|
40
|
-
@hooks.merge!(other.dup.hooks) do |
|
41
|
-
temp_hash
|
42
|
+
@hooks.merge!(other.dup.hooks) do |_key, array, other_array|
|
43
|
+
temp_hash = {}
|
44
|
+
output = []
|
42
45
|
|
43
46
|
(array + other_array).reverse_each do |pair|
|
44
47
|
temp_hash[pair.first] ||= output.unshift(pair)
|
@@ -57,7 +60,7 @@ module PuppetDebugger
|
|
57
60
|
# @return [PuppetDebugger::Hooks] a new `PuppetDebugger::Hooks` instance containing a merge of the
|
58
61
|
# contents of two `PuppetDebugger::Hooks` instances.
|
59
62
|
def merge(other)
|
60
|
-
|
63
|
+
dup.tap do |v|
|
61
64
|
v.merge!(other)
|
62
65
|
end
|
63
66
|
end
|
@@ -68,7 +71,7 @@ module PuppetDebugger
|
|
68
71
|
# @param [#call] callable The callable.
|
69
72
|
# @yield The block to use as the callable (if no `callable` provided).
|
70
73
|
# @return [PuppetDebugger::Hooks] The receiver.
|
71
|
-
def add_hook(event_name, hook_name, callable=nil, &block)
|
74
|
+
def add_hook(event_name, hook_name, callable = nil, &block)
|
72
75
|
event_name = event_name.to_s
|
73
76
|
|
74
77
|
# do not allow duplicates, but allow multiple `nil` hooks
|
@@ -77,12 +80,10 @@ module PuppetDebugger
|
|
77
80
|
raise ArgumentError, "Hook with name '#{hook_name}' already defined!"
|
78
81
|
end
|
79
82
|
|
80
|
-
if !block && !callable
|
81
|
-
raise ArgumentError, "Must provide a block or callable."
|
82
|
-
end
|
83
|
+
raise ArgumentError, 'Must provide a block or callable.' if !block && !callable
|
83
84
|
|
84
85
|
# ensure we only have one anonymous hook
|
85
|
-
@hooks[event_name].delete_if { |h,
|
86
|
+
@hooks[event_name].delete_if { |h, _k| h.nil? } if hook_name.nil?
|
86
87
|
|
87
88
|
if block
|
88
89
|
@hooks[event_name] << [hook_name, block]
|
@@ -98,7 +99,7 @@ module PuppetDebugger
|
|
98
99
|
# @param [Array] args The arguments to pass to each hook function.
|
99
100
|
# @return [Object] The return value of the last executed hook.
|
100
101
|
def exec_hook(event_name, *args, &block)
|
101
|
-
@hooks[event_name.to_s].map do |
|
102
|
+
@hooks[event_name.to_s].map do |_hook_name, callable|
|
102
103
|
begin
|
103
104
|
callable.call(*args, &block)
|
104
105
|
rescue PuppetDebugger::Exception::Error, ::RuntimeError => e
|
@@ -118,10 +119,10 @@ module PuppetDebugger
|
|
118
119
|
# @param [Symbol] hook_name The name of the hook
|
119
120
|
# @return [#call] a specific hook for a given event.
|
120
121
|
def get_hook(event_name, hook_name)
|
121
|
-
hook = @hooks[event_name.to_s].find do |current_hook_name,
|
122
|
+
hook = @hooks[event_name.to_s].find do |current_hook_name, _callable|
|
122
123
|
current_hook_name == hook_name
|
123
124
|
end
|
124
|
-
hook
|
125
|
+
hook&.last
|
125
126
|
end
|
126
127
|
|
127
128
|
# @param [Symbol] event_name The name of the event.
|
@@ -167,8 +168,6 @@ module PuppetDebugger
|
|
167
168
|
|
168
169
|
protected
|
169
170
|
|
170
|
-
|
171
|
-
@hooks
|
172
|
-
end
|
171
|
+
attr_reader :hooks
|
173
172
|
end
|
174
|
-
end
|
173
|
+
end
|
@@ -1,68 +1,70 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'singleton'
|
2
4
|
require 'puppet-debugger/support/errors'
|
3
5
|
require 'forwardable'
|
4
6
|
|
5
7
|
module PuppetDebugger
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
class InputResponderPlugin
|
9
|
+
include Singleton
|
10
|
+
extend Forwardable
|
11
|
+
attr_accessor :debugger
|
12
|
+
def_delegators :debugger, :scope, :node, :environment, :loaders, :puppet_environment,
|
13
|
+
:add_hook, :handle_input, :delete_hook, :puppet_lib_dir
|
14
|
+
def_delegators :scope, :compiler, :catalog
|
15
|
+
def_delegators :node, :facts
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
# @return [Array[String]] an array of words the user can call the command with
|
18
|
+
def self.command_words
|
19
|
+
self::COMMAND_WORDS
|
20
|
+
end
|
19
21
|
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
def modules_paths
|
23
|
+
debugger.puppet_environment.full_modulepath
|
24
|
+
end
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
# @return [String] a summary of the plugin
|
27
|
+
def self.summary
|
28
|
+
self::SUMMARY
|
29
|
+
end
|
28
30
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
# @return [String] the name of the command group the plugin is in
|
32
|
+
def self.command_group
|
33
|
+
self::COMMAND_GROUP
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
# @return [Hash] a has of all the details of the plugin
|
37
|
+
def self.details
|
38
|
+
{ words: command_words, summary: summary, group: command_group }
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
41
|
+
# @param buffer_words [Array[String]] a array of words the user has typed in
|
42
|
+
# @return Array[String] - an array of words that will help the user with word completion
|
43
|
+
# By default this returns an empty array, your plugin can chose to override this method in order to
|
44
|
+
# provide the user with a list of key words based on the user's input
|
45
|
+
def self.command_completion(_buffer_words)
|
46
|
+
[]
|
47
|
+
end
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
# @param args [Array[String]] - an array of arguments to pass to the plugin command
|
50
|
+
# @param debugger PuppetDebugger::Cli - an instance of the PuppetDebugger::Cli object
|
51
|
+
# @return the output of the plugin command
|
52
|
+
def self.execute(args = [], debugger)
|
53
|
+
instance.debugger = debugger
|
54
|
+
instance.run(args)
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
# @param args [Array[String]] - an array of arguments to pass to the plugin command
|
58
|
+
# @return the output of the plugin command
|
59
|
+
def run(args = [])
|
60
|
+
raise NotImplementedError
|
61
|
+
end
|
60
62
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
end
|
63
|
+
# this is the lib directory of this gem
|
64
|
+
# in order to load any puppet functions from this gem we need to add the lib path
|
65
|
+
# of this gem
|
66
|
+
def puppet_debugger_lib_dir
|
67
|
+
File.expand_path(File.join(File.dirname(File.dirname(File.dirname(__FILE__))), 'lib'))
|
67
68
|
end
|
69
|
+
end
|
68
70
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# monkey patch in some color effects string methods
|
2
4
|
class String
|
3
5
|
def red
|
@@ -38,6 +40,7 @@ class String
|
|
38
40
|
|
39
41
|
def camel_case
|
40
42
|
return self if self !~ /_/ && self =~ /[A-Z]+.*/
|
43
|
+
|
41
44
|
split('_').map(&:capitalize).join
|
42
45
|
end
|
43
46
|
end
|
@@ -51,4 +54,4 @@ class Puppet::Parser::ScriptCompiler
|
|
51
54
|
def catalog
|
52
55
|
@catalog ||= Puppet::Resource::Catalog.new(@node_name, @environment, 'bolt')
|
53
56
|
end
|
54
|
-
end
|
57
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
# https://relishapp.com/rspec/rspec-core/v/3-6/docs/example-groups/shared-examples
|
2
|
-
RSpec.shared_examples
|
4
|
+
RSpec.shared_examples 'plugin_tests' do |_parameter|
|
3
5
|
let(:plugin) do
|
4
6
|
instance = PuppetDebugger::InputResponders::Commands.plugin_from_command(subject.to_s).instance
|
5
7
|
instance.debugger = debugger
|
@@ -18,20 +20,20 @@ RSpec.shared_examples "plugin_tests" do |parameter|
|
|
18
20
|
{}
|
19
21
|
end
|
20
22
|
|
21
|
-
it
|
23
|
+
it 'commands contant is an array' do
|
22
24
|
expect(plugin.class::COMMAND_WORDS).to be_a(Array)
|
23
25
|
end
|
24
26
|
|
25
|
-
it
|
26
|
-
expect(plugin.class::COMMAND_WORDS.count).to
|
27
|
+
it 'commands must contain at least one word' do
|
28
|
+
expect(plugin.class::COMMAND_WORDS.count).to be > 0
|
27
29
|
end
|
28
30
|
|
29
|
-
it
|
31
|
+
it 'summary must be a string' do
|
30
32
|
expect(plugin.class::SUMMARY).to be_a(String)
|
31
33
|
end
|
32
34
|
|
33
35
|
it 'implements run' do
|
34
|
-
expect{plugin.run([])}.not_to raise_error
|
36
|
+
expect { plugin.run([]) }.not_to raise_error
|
35
37
|
end
|
36
38
|
|
37
39
|
it 'be looked up via any command words' do
|
@@ -40,5 +42,4 @@ RSpec.shared_examples "plugin_tests" do |parameter|
|
|
40
42
|
expect(actual).to eq(plugin.class)
|
41
43
|
end
|
42
44
|
end
|
43
|
-
|
44
|
-
end
|
45
|
+
end
|
@@ -83,14 +83,14 @@ module PuppetDebugger
|
|
83
83
|
nodes: scope.environment.known_resource_types.nodes.keys
|
84
84
|
}
|
85
85
|
if sites = scope.environment.known_resource_types.instance_variable_get(:@sites)
|
86
|
-
res[:sites] =
|
86
|
+
res[:sites] = sites
|
87
87
|
end
|
88
|
-
if scope.environment.known_resource_types.respond_to?(:applications)
|
89
|
-
res[:applications] =
|
88
|
+
if apps = scope.environment.known_resource_types.respond_to?(:applications)
|
89
|
+
res[:applications] = apps
|
90
90
|
end
|
91
91
|
# some versions of puppet do not support capabilities
|
92
|
-
if scope.environment.known_resource_types.respond_to?(:capability_mappings)
|
93
|
-
res[:capability_mappings] =
|
92
|
+
if maps = scope.environment.known_resource_types.respond_to?(:capability_mappings)
|
93
|
+
res[:capability_mappings] = maps
|
94
94
|
end
|
95
95
|
res
|
96
96
|
end
|
@@ -100,8 +100,8 @@ module PuppetDebugger
|
|
100
100
|
Puppet.initialize_settings
|
101
101
|
Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8
|
102
102
|
Puppet[:trusted_node_data] = true
|
103
|
-
rescue ArgumentError
|
104
|
-
rescue Puppet::DevError
|
103
|
+
rescue ArgumentError
|
104
|
+
rescue Puppet::DevError
|
105
105
|
# do nothing otherwise calling init twice raises an error
|
106
106
|
end
|
107
107
|
|
@@ -131,31 +131,57 @@ module PuppetDebugger
|
|
131
131
|
::Puppet::Parser::AST::Hostclass.new('', code: ast_code)
|
132
132
|
end
|
133
133
|
|
134
|
+
# @return [String] the path to the manifest file
|
135
|
+
# @param input [String] the manfiest content
|
136
|
+
# @summary creates a manifest file unless one already exist
|
137
|
+
def manifest_file(input)
|
138
|
+
file = Tempfile.new(['puppet_debugger_input', '.pp'])
|
139
|
+
File.open(file, 'w') do |f|
|
140
|
+
f.write(input)
|
141
|
+
end
|
142
|
+
file
|
143
|
+
end
|
144
|
+
|
145
|
+
# @return [Bolt::PuppetDB::Client]
|
146
|
+
def bolt_pdb_client
|
147
|
+
@bolt_pdb_client ||=
|
148
|
+
begin
|
149
|
+
require 'bolt/logger'
|
150
|
+
require 'bolt/puppetdb'
|
151
|
+
require 'bolt/puppetdb/client'
|
152
|
+
require 'bolt/puppetdb/config'
|
153
|
+
config = Bolt::PuppetDB::Config.load_config({})
|
154
|
+
Bolt::PuppetDB::Client.new(config)
|
155
|
+
rescue LoadError
|
156
|
+
# not puppet 6+
|
157
|
+
nil
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
134
161
|
# @param String - any valid puppet language code
|
135
162
|
# @return Object - returns either a string of the result or object from puppet evaulation
|
136
|
-
def puppet_eval(input)
|
163
|
+
def puppet_eval(input, file: nil)
|
137
164
|
# in order to add functions to the scope the loaders must be created
|
138
165
|
# in order to call native functions we need to set the global_scope
|
139
|
-
ast = generate_ast(input)
|
140
166
|
# record the input for puppet to retrieve and reference later
|
141
|
-
|
142
|
-
File.
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
# because the
|
167
|
+
manifest_file = file || manifest_file(input)
|
168
|
+
manfifest_content = input || File.read(manifest_file)
|
169
|
+
ast = generate_ast(manfifest_content)
|
170
|
+
Puppet.override({ current_environment: puppet_environment, manifest: manifest_file,
|
171
|
+
global_scope: scope, bolt_pdb_client: bolt_pdb_client,
|
172
|
+
loaders: scope.compiler.loaders }, 'For puppet-debugger') do
|
173
|
+
# because the debugger is not a module we leave the modname blank
|
148
174
|
scope.environment.known_resource_types.import_ast(ast, '')
|
149
175
|
|
150
176
|
exec_hook :before_eval, '', self, self
|
151
177
|
if bench
|
152
178
|
result = nil
|
153
179
|
time = Benchmark.realtime do
|
154
|
-
result = parser.evaluate_string(scope,
|
180
|
+
result = parser.evaluate_string(scope, manfifest_content, File.expand_path(manifest_file))
|
155
181
|
end
|
156
182
|
out = [result, "Time elapsed #{(time * 1000).round(2)} ms"]
|
157
183
|
else
|
158
|
-
out = parser.evaluate_string(scope,
|
184
|
+
out = parser.evaluate_string(scope, manfifest_content, File.expand_path(manifest_file))
|
159
185
|
end
|
160
186
|
exec_hook :after_eval, out, self, self
|
161
187
|
out
|
@@ -8,7 +8,7 @@ module PuppetDebugger
|
|
8
8
|
def puppet_environment
|
9
9
|
@puppet_environment ||= create_environment
|
10
10
|
end
|
11
|
-
alias
|
11
|
+
alias environment puppet_environment
|
12
12
|
|
13
13
|
# returns an array of module directories, generally this is the only place
|
14
14
|
# to look for puppet code by default. This is read from the puppet configuration
|
@@ -17,13 +17,14 @@ module PuppetDebugger
|
|
17
17
|
# add the puppet-debugger directory so we can load any defined functions
|
18
18
|
dirs << File.join(Puppet[:environmentpath], default_puppet_env_name, 'modules') unless Puppet[:environmentpath].empty?
|
19
19
|
dirs << Puppet.settings[:basemodulepath].split(File::PATH_SEPARATOR)
|
20
|
+
dirs << Puppet.settings[:vendormoduledir].split(File::PATH_SEPARATOR) if Puppet.settings[:vendormoduledir]
|
20
21
|
dirs << bolt_modules
|
21
|
-
dirs.flatten.compact
|
22
|
+
dirs.flatten.compact.uniq
|
22
23
|
end
|
23
24
|
|
24
25
|
def bolt_modules
|
25
|
-
spec = Gem::Specification.latest_specs.find { |
|
26
|
-
|
26
|
+
spec = Gem::Specification.latest_specs.find { |s| s.name.eql?('bolt') }
|
27
|
+
File.join(spec.full_gem_path, 'bolt-modules') if spec
|
27
28
|
end
|
28
29
|
|
29
30
|
# returns all the modules paths defined in the environment
|
@@ -66,7 +67,7 @@ module PuppetDebugger
|
|
66
67
|
|
67
68
|
# currently this is not being used
|
68
69
|
def environment_loaders
|
69
|
-
|
70
|
+
compiler.loaders.public_environment_loader.loader_name
|
70
71
|
end
|
71
72
|
end
|
72
73
|
end
|