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
data/.vscode/launch.json
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"type": "chrome",
|
9
|
+
"request": "launch",
|
10
|
+
"name": "Launch Chrome against localhost",
|
11
|
+
"url": "http://localhost:8080",
|
12
|
+
"webRoot": "${workspaceFolder}"
|
13
|
+
}
|
14
|
+
]
|
15
|
+
}
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,33 @@
|
|
1
|
+
# Puppet Debugger Changelog
|
2
|
+
|
1
3
|
## Unreleased
|
4
|
+
## 1.2
|
5
|
+
- Fix puppetdb_query errors when bolt_pdb_client was not loaded
|
6
|
+
## 1.1
|
7
|
+
- Catch signals and allow control-d for quitting.
|
8
|
+
## 1.0
|
9
|
+
Released: 8/3/2020
|
10
|
+
|
11
|
+
This is a major revision with breaking changes, notably the requirement of ruby 2.4 and puppet 5.5.
|
12
|
+
|
13
|
+
- Bump required ruby version to 2.4
|
14
|
+
- Bump required puppet version to puppet 5.5
|
15
|
+
- Add stacktrace plugin
|
16
|
+
- Add a pager for long output
|
17
|
+
- Remove puppet4 and older work arounds
|
18
|
+
- Use rubocop for better code quality
|
19
|
+
- Fix issue when the debugger was not loading the manifest properly
|
20
|
+
|
21
|
+
## 0.19.0
|
22
|
+
- Search datatypes with filter
|
23
|
+
- Fix #8 - trusted_server_facts' as a setting is deprecated
|
24
|
+
|
25
|
+
## 0.18.0
|
26
|
+
- Add bundler as a dependency
|
27
|
+
- Add ability to filter out classes
|
28
|
+
- Add ability to filter out resources
|
29
|
+
- Add ability to supply a catalog
|
30
|
+
- Add vendormoduledir to module paths
|
2
31
|
|
3
32
|
## 0.17.0
|
4
33
|
- Fix bolt issue when the catalog is referenced
|
data/Gemfile
CHANGED
@@ -1,23 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
source 'http://rubygems.org'
|
3
4
|
gem 'awesome_print', '~> 1.7'
|
4
5
|
gem 'facterdb', '>= 0.5.0'
|
5
|
-
gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '~> 4.10.1'
|
6
6
|
gem 'pluginator', '~> 1.5.0'
|
7
|
+
gem 'puppet', ENV['PUPPET_GEM_VERSION'] || '~> 5.5'
|
7
8
|
gem 'rb-readline'
|
8
9
|
gem 'table_print'
|
10
|
+
gem 'tty-pager'
|
11
|
+
#gem 'bolt' if Gem::Version(ENV['PUPPET_GEM_VERSION'])
|
12
|
+
|
9
13
|
group :test, :development do
|
10
14
|
# ruby versions prior to 2.0 cannot install json_pure 2.0.2+
|
11
15
|
gem 'bundler'
|
12
|
-
gem 'CFPropertyList'
|
13
16
|
gem 'pry'
|
14
17
|
gem 'puppet-debugger', path: './'
|
15
|
-
gem 'rake', '
|
18
|
+
gem 'rake', '~> 13.0'
|
16
19
|
gem 'rdoc', '~> 3.12'
|
17
20
|
gem 'release_me'
|
18
21
|
gem 'rspec', '~> 3.6'
|
22
|
+
gem 'rubocop'
|
23
|
+
gem 'rubocop-performance'
|
24
|
+
gem 'rubocop-rspec'
|
19
25
|
gem 'simplecov', '>= 0'
|
20
|
-
gem 'rubocop', '= 0.48.0'
|
21
|
-
|
22
26
|
end
|
23
|
-
|
data/README.md
CHANGED
@@ -35,7 +35,7 @@ A interactive command line tool for evaluating and debugging the puppet language
|
|
35
35
|
Please visit https://docs.puppet-debugger.com for more info.
|
36
36
|
|
37
37
|
## Compatibility
|
38
|
-
Requires Puppet
|
38
|
+
Requires Puppet 5.5+, ruby 2.4+
|
39
39
|
|
40
40
|
## Production usage
|
41
41
|
The puppet debugger is a developer tool that should only be used when writing puppet code. Although it might seem useful
|
@@ -63,22 +63,35 @@ and see what it would actual do when compiling a resource.
|
|
63
63
|
|
64
64
|
Example Usage
|
65
65
|
```
|
66
|
-
|
67
|
-
|
68
|
-
Puppet Version:
|
69
|
-
Puppet Debugger Version: 0.4.3
|
66
|
+
Ruby Version: 2.6.5
|
67
|
+
Puppet Version: 6.17.0
|
68
|
+
Puppet Debugger Version: 1.0.0
|
70
69
|
Created by: NWOps <corey@nwops.io>
|
71
|
-
Type "
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
Type "commands" for a list of debugger commands
|
71
|
+
or "help" to show the help screen.
|
72
|
+
|
73
|
+
|
74
|
+
1:>> $os
|
75
|
+
=> {
|
76
|
+
"architecture" => "x86_64",
|
77
|
+
"family" => "RedHat",
|
78
|
+
"hardware" => "x86_64",
|
79
|
+
"name" => "Fedora",
|
80
|
+
"release" => {
|
81
|
+
"full" => "23",
|
82
|
+
"major" => "23"
|
83
|
+
},
|
84
|
+
"selinux" => {
|
85
|
+
"config_mode" => "permissive",
|
86
|
+
"config_policy" => "targeted",
|
87
|
+
"current_mode" => "permissive",
|
88
|
+
"enabled" => true,
|
89
|
+
"enforced" => false,
|
90
|
+
"policy_version" => "29"
|
91
|
+
}
|
92
|
+
}
|
79
93
|
2:>>
|
80
94
|
|
81
|
-
|
82
95
|
```
|
83
96
|
|
84
97
|
## Copyright
|
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'rubygems'
|
@@ -9,8 +8,8 @@ require 'rake/testtask'
|
|
9
8
|
begin
|
10
9
|
Bundler.setup(:default, :development, :test)
|
11
10
|
rescue Bundler::BundlerError => e
|
12
|
-
|
13
|
-
|
11
|
+
warn e.message
|
12
|
+
warn 'Run `bundle install` to install missing gems'
|
14
13
|
exit e.status_code
|
15
14
|
end
|
16
15
|
require 'rake'
|
@@ -34,13 +33,14 @@ end
|
|
34
33
|
|
35
34
|
desc 'Creates generic input_responder spec files'
|
36
35
|
task :make_input_responder_tests do
|
37
|
-
files =
|
38
|
-
|
39
|
-
orig_file = File.basename(pathname,
|
36
|
+
files = Dir.glob('lib/plugins/**/*.rb')
|
37
|
+
files.collect do |pathname|
|
38
|
+
orig_file = File.basename(pathname, '.*')
|
40
39
|
test_file = File.join('spec', 'input_responders', "#{orig_file}_spec.rb")
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
next if File.exist?(test_file)
|
41
|
+
|
42
|
+
# new_file = File.new(test_file, "w")
|
43
|
+
contents = <<-OUT
|
44
44
|
require 'spec_helper'
|
45
45
|
require 'puppet-debugger'
|
46
46
|
require 'puppet-debugger/plugin_test_helper'
|
@@ -50,8 +50,7 @@ task :make_input_responder_tests do
|
|
50
50
|
let(:args) { [] }
|
51
51
|
|
52
52
|
end
|
53
|
-
|
54
|
-
|
55
|
-
end
|
53
|
+
OUT
|
54
|
+
File.write(test_file, contents)
|
56
55
|
end
|
57
56
|
end
|
data/bin/pdb
CHANGED
@@ -3,5 +3,5 @@
|
|
3
3
|
|
4
4
|
require 'puppet-debugger'
|
5
5
|
|
6
|
-
puts
|
6
|
+
puts 'The debugger pdb command will be removed in a future release please use puppet-debugger or puppet debugger instead'.warning
|
7
7
|
PuppetDebugger::Cli.start
|
@@ -52,6 +52,7 @@ module AwesomePrint
|
|
52
52
|
|
53
53
|
def awesome_puppet_resource(object)
|
54
54
|
return '' if object.nil?
|
55
|
+
|
55
56
|
resource_object = object.to_ral
|
56
57
|
awesome_puppet_type(resource_object)
|
57
58
|
end
|
@@ -59,16 +60,17 @@ module AwesomePrint
|
|
59
60
|
def awesome_puppet_type(object)
|
60
61
|
return '' if object.nil?
|
61
62
|
return object.to_s unless object.respond_to?(:name) && object.respond_to?(:title) && object.respond_to?(:to_hash)
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
63
|
+
|
64
|
+
h = if [].respond_to?(:to_h)
|
65
|
+
# to_h is only supported in ruby 2.1+
|
66
|
+
object.to_hash.merge(name: object.name, title: object.title).sort.to_h
|
67
|
+
else
|
68
|
+
object.to_hash.merge(name: object.name, title: object.title)
|
69
|
+
end
|
70
|
+
res_str = awesome_hash(JSON.parse(h.to_json)) # converting to json removes symbols
|
69
71
|
"#{object.class} #{res_str}"
|
70
72
|
end
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
74
|
-
AwesomePrint::Formatter.
|
76
|
+
AwesomePrint::Formatter.include AwesomePrint::Puppet
|
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'benchmark'
|
2
4
|
require 'puppet-debugger/input_responder_plugin'
|
3
5
|
module PuppetDebugger
|
4
6
|
module InputResponders
|
5
7
|
class Benchmark < InputResponderPlugin
|
6
|
-
COMMAND_WORDS = %w
|
8
|
+
COMMAND_WORDS = %w[benchmark bm].freeze
|
7
9
|
SUMMARY = 'Benchmark your Puppet code.'
|
8
10
|
COMMAND_GROUP = :tools
|
9
11
|
|
10
12
|
def run(args = [])
|
11
|
-
if args.count
|
13
|
+
if args.count.positive?
|
12
14
|
enable(false)
|
13
15
|
out = debugger.handle_input(args.first)
|
14
16
|
disable
|
@@ -34,7 +36,6 @@ module PuppetDebugger
|
|
34
36
|
'On'
|
35
37
|
end
|
36
38
|
end
|
37
|
-
|
38
39
|
end
|
39
40
|
end
|
40
|
-
end
|
41
|
+
end
|
@@ -1,15 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/input_responder_plugin'
|
2
4
|
module PuppetDebugger
|
3
5
|
module InputResponders
|
4
6
|
class Classes < InputResponderPlugin
|
5
|
-
COMMAND_WORDS = %w
|
7
|
+
COMMAND_WORDS = %w[classes].freeze
|
6
8
|
SUMMARY = 'List all the classes current in the catalog.'
|
7
9
|
COMMAND_GROUP = :scope
|
8
10
|
|
9
11
|
def run(args = [])
|
10
|
-
|
12
|
+
filter = args
|
13
|
+
classes = find_classes(debugger.catalog.classes, filter)
|
14
|
+
classes.ai
|
11
15
|
end
|
12
16
|
|
17
|
+
def find_classes(classes, filter = [])
|
18
|
+
return classes if filter.nil? || filter.empty?
|
19
|
+
|
20
|
+
filter_string = filter.join(' ').downcase
|
21
|
+
classes.find_all do |klass|
|
22
|
+
klass.downcase.include?(filter_string)
|
23
|
+
end
|
24
|
+
end
|
13
25
|
end
|
14
26
|
end
|
15
27
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/input_responder_plugin'
|
2
4
|
module PuppetDebugger
|
3
5
|
module InputResponders
|
4
6
|
class Classification < InputResponderPlugin
|
5
|
-
COMMAND_WORDS = %w
|
7
|
+
COMMAND_WORDS = %w[classification].freeze
|
6
8
|
SUMMARY = 'Show the classification details of the node.'
|
7
9
|
COMMAND_GROUP = :node
|
8
10
|
|
9
|
-
def run(
|
11
|
+
def run(_args = [])
|
10
12
|
debugger.node.classes.ai
|
11
13
|
end
|
12
14
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/input_responder_plugin'
|
2
4
|
module PuppetDebugger
|
3
5
|
module InputResponders
|
4
6
|
class Commands < InputResponderPlugin
|
5
|
-
COMMAND_WORDS = %w
|
7
|
+
COMMAND_WORDS = %w[commands].freeze
|
6
8
|
SUMMARY = 'List all available commands, aka. this screen'
|
7
9
|
COMMAND_GROUP = :help
|
8
10
|
|
9
|
-
def run(
|
11
|
+
def run(_args = [])
|
10
12
|
commands_list
|
11
13
|
end
|
12
14
|
|
@@ -31,9 +33,9 @@ module PuppetDebugger
|
|
31
33
|
def command_groups
|
32
34
|
unless @command_groups
|
33
35
|
@command_groups = {}
|
34
|
-
self.class.command_output.each do |
|
36
|
+
self.class.command_output.each do |item|
|
35
37
|
if @command_groups[item[:group]]
|
36
|
-
@command_groups[item[:group]].merge!(
|
38
|
+
@command_groups[item[:group]].merge!(item[:words].first => item[:summary])
|
37
39
|
else
|
38
40
|
@command_groups[item[:group]] = { item[:words].first => item[:summary] }
|
39
41
|
end
|
@@ -43,12 +45,12 @@ module PuppetDebugger
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def self.command_list_regex
|
46
|
-
out = command_list.map {|n| "^#{n}"}.join('|')
|
47
|
-
|
48
|
+
out = command_list.map { |n| "^#{n}" }.join('|')
|
49
|
+
/#{out}/
|
48
50
|
end
|
49
51
|
|
50
52
|
def self.command_list
|
51
|
-
command_output.map{|f| f[:words] }.flatten
|
53
|
+
command_output.map { |f| f[:words] }.flatten
|
52
54
|
end
|
53
55
|
|
54
56
|
def self.command_output
|
@@ -56,22 +58,20 @@ module PuppetDebugger
|
|
56
58
|
end
|
57
59
|
|
58
60
|
def self.plugins
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
raise PuppetDebugger::Exception::InvalidCommand.new(message: "Unsupported gem version. Please update with: gem update --system")
|
64
|
-
end
|
61
|
+
debug_plugins = Pluginator.find('puppet-debugger')
|
62
|
+
debug_plugins['input_responders']
|
63
|
+
rescue NoMethodError
|
64
|
+
raise PuppetDebugger::Exception::InvalidCommand.new(message: 'Unsupported gem version. Please update with: gem update --system')
|
65
65
|
end
|
66
66
|
|
67
67
|
# @param name [String] - the name of the command that is associated with a plugin
|
68
68
|
# @return [PuppetDebugger::InputResponders::InputResponderPlugin]
|
69
69
|
def self.plugin_from_command(name)
|
70
|
-
|
71
|
-
raise PuppetDebugger::Exception::InvalidCommand.new(message: "invalid command #{name}") unless
|
72
|
-
p
|
73
|
-
end
|
70
|
+
plug = plugins.find { |p| p::COMMAND_WORDS.include?(name) }
|
71
|
+
raise PuppetDebugger::Exception::InvalidCommand.new(message: "invalid command #{name}") unless plug
|
74
72
|
|
73
|
+
plug
|
74
|
+
end
|
75
75
|
end
|
76
76
|
end
|
77
|
-
end
|
77
|
+
end
|
@@ -1,13 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/input_responder_plugin'
|
2
4
|
module PuppetDebugger
|
3
5
|
module InputResponders
|
4
6
|
class Datatypes < InputResponderPlugin
|
5
|
-
COMMAND_WORDS = %w
|
7
|
+
COMMAND_WORDS = %w[datatypes].freeze
|
6
8
|
SUMMARY = 'List all the datatypes available in the environment.'
|
7
9
|
COMMAND_GROUP = :environment
|
8
10
|
|
9
11
|
def run(args = [])
|
10
|
-
|
12
|
+
filter = args
|
13
|
+
datatypes = find_datatypes(all_data_types.sort, filter)
|
14
|
+
datatypes.ai
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_datatypes(datatypes, filter = [])
|
18
|
+
return datatypes if filter.nil? || filter.empty?
|
19
|
+
|
20
|
+
filter_string = filter.join(' ').downcase
|
21
|
+
datatypes.find_all do |datatype|
|
22
|
+
datatype.downcase.include?(filter_string)
|
23
|
+
end
|
11
24
|
end
|
12
25
|
|
13
26
|
# @return [Array[String]] - returns a list of all the custom data types found in all the modules in the environment
|
@@ -17,15 +30,19 @@ module PuppetDebugger
|
|
17
30
|
files.map do |f|
|
18
31
|
m = File.read(f).match(/type\s([a-z\d\:_]+)/i)
|
19
32
|
next if m =~ /type|alias/ # can't figure out the best way to filter type and alias out
|
33
|
+
|
20
34
|
m[1] if m && m[1] =~ /::/
|
21
35
|
end.uniq.compact
|
22
36
|
end
|
23
37
|
|
38
|
+
# loaders.instance_variable_get(:@loaders_by_name)['boltlib']
|
39
|
+
# [:func_4x, :func_4xpp, :func_3x, :datatype, :type_pp,
|
40
|
+
# :resource_type_pp, :plan, :task]
|
24
41
|
# @return [Array[String]] - a list of core data types
|
25
42
|
def core_datatypes
|
26
|
-
loaders.implementation_registry
|
27
|
-
|
28
|
-
|
43
|
+
loaders.implementation_registry.instance_variable_get(:@parent)
|
44
|
+
.instance_variable_get(:@implementations_per_type_name)
|
45
|
+
.keys.find_all { |t| t !~ /::/ }
|
29
46
|
end
|
30
47
|
|
31
48
|
# @return [Array[String]] - combined list of core data types and environment data types
|
@@ -36,7 +53,6 @@ module PuppetDebugger
|
|
36
53
|
end
|
37
54
|
core_datatypes + environment_data_types
|
38
55
|
end
|
39
|
-
|
40
56
|
end
|
41
57
|
end
|
42
58
|
end
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'puppet-debugger/input_responder_plugin'
|
2
4
|
module PuppetDebugger
|
3
5
|
module InputResponders
|
4
6
|
class Environment < InputResponderPlugin
|
5
|
-
COMMAND_WORDS = %w
|
7
|
+
COMMAND_WORDS = %w[environment].freeze
|
6
8
|
SUMMARY = 'Show the current environment name'
|
7
9
|
COMMAND_GROUP = :context
|
8
10
|
|
9
|
-
def run(
|
11
|
+
def run(_args = [])
|
10
12
|
"Puppet Environment: #{debugger.puppet_env_name}"
|
11
13
|
end
|
12
14
|
end
|