puppet-debugger 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.gitlab-ci.yml +30 -13
- data/.rubocop.yml +3 -1
- data/.rubocop_todo.yml +11 -2
- data/.ruby-version +1 -1
- data/CHANGELOG.md +9 -0
- data/DEVELOPMENT.md +6 -1
- data/Gemfile +14 -12
- data/Plugin_development.md +304 -0
- data/README.md +4 -7
- data/Rakefile +6 -5
- data/bin/pdb +1 -0
- data/lib/awesome_print/ext/awesome_puppet.rb +1 -0
- data/lib/plugins/puppet-debugger/input_responders/benchmark.rb +40 -0
- data/lib/plugins/puppet-debugger/input_responders/classes.rb +15 -0
- data/lib/plugins/puppet-debugger/input_responders/classification.rb +14 -0
- data/lib/plugins/puppet-debugger/input_responders/commands.rb +95 -0
- data/lib/plugins/puppet-debugger/input_responders/datatypes.rb +17 -0
- data/lib/plugins/puppet-debugger/input_responders/environment.rb +14 -0
- data/lib/plugins/puppet-debugger/input_responders/exit.rb +14 -0
- data/lib/plugins/puppet-debugger/input_responders/facterdb_filter.rb +16 -0
- data/lib/plugins/puppet-debugger/input_responders/facts.rb +15 -0
- data/lib/plugins/puppet-debugger/input_responders/functions.rb +15 -0
- data/lib/plugins/puppet-debugger/input_responders/help.rb +14 -0
- data/lib/plugins/puppet-debugger/input_responders/krt.rb +14 -0
- data/lib/{puppet-debugger/support → plugins/puppet-debugger/input_responders}/play.rb +37 -26
- data/lib/plugins/puppet-debugger/input_responders/reset.rb +21 -0
- data/lib/plugins/puppet-debugger/input_responders/resources.rb +22 -0
- data/lib/plugins/puppet-debugger/input_responders/set.rb +55 -0
- data/lib/plugins/puppet-debugger/input_responders/types.rb +35 -0
- data/lib/plugins/puppet-debugger/input_responders/vars.rb +18 -0
- data/lib/plugins/puppet-debugger/input_responders/whereami.rb +29 -0
- data/lib/puppet-debugger.rb +12 -1
- data/lib/puppet-debugger/cli.rb +38 -22
- data/lib/puppet-debugger/code/code_file.rb +16 -15
- data/lib/puppet-debugger/code/code_range.rb +1 -0
- data/lib/puppet-debugger/code/loc.rb +1 -0
- data/lib/puppet-debugger/debugger_code.rb +1 -0
- data/lib/puppet-debugger/hooks.rb +174 -0
- data/lib/puppet-debugger/input_responder_plugin.rb +45 -0
- data/lib/puppet-debugger/plugin_test_helper.rb +44 -0
- data/lib/puppet-debugger/support.rb +13 -9
- data/lib/puppet-debugger/support/compiler.rb +1 -0
- data/lib/puppet-debugger/support/environment.rb +2 -0
- data/lib/puppet-debugger/support/errors.rb +9 -0
- data/lib/puppet-debugger/support/facts.rb +2 -1
- data/lib/puppet-debugger/support/functions.rb +3 -1
- data/lib/puppet-debugger/support/loader.rb +2 -0
- data/lib/puppet-debugger/support/node.rb +1 -0
- data/lib/puppet-debugger/support/scope.rb +1 -0
- data/lib/puppet/application/debugger.rb +1 -0
- data/lib/version.rb +2 -1
- data/puppet-debugger.gemspec +20 -15
- data/run_container_test.sh +1 -1
- data/spec/environment_spec.rb +2 -1
- data/spec/facts_spec.rb +1 -0
- data/spec/hooks_spec.rb +341 -0
- data/spec/input_responder_plugin_spec.rb +45 -0
- data/spec/input_responders/help_spec.rb +17 -0
- data/spec/input_responders/krt_spec.rb +12 -0
- data/spec/input_responders/play_spec.rb +160 -0
- data/spec/pdb_spec.rb +1 -0
- data/spec/puppet/application/debugger_spec.rb +1 -2
- data/spec/puppet_debugger_spec.rb +49 -88
- data/spec/remote_node_spec.rb +3 -2
- data/spec/spec_helper.rb +7 -0
- data/spec/support_spec.rb +5 -116
- data/test_matrix.rb +2 -0
- metadata +65 -12
- data/Gemfile.lock +0 -95
- data/lib/puppet-debugger/support/input_responders.rb +0 -191
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'simplecov'
|
3
4
|
require_relative '../lib/puppet-debugger'
|
4
5
|
require 'yaml'
|
@@ -57,6 +58,12 @@ def supports_type_function?
|
|
57
58
|
Gem::Version.new(Puppet.version) >= Gem::Version.new('4.0')
|
58
59
|
end
|
59
60
|
|
61
|
+
def supports_datatypes?
|
62
|
+
Gem::Version.new(Puppet.version) >= Gem::Version.new('4.5')
|
63
|
+
end
|
64
|
+
|
65
|
+
|
60
66
|
RSpec.configure do |config|
|
61
67
|
config.filter_run_excluding native_functions: !supports_native_functions?
|
68
|
+
RSpec::Expectations.configuration.on_potential_false_positives = :nothing
|
62
69
|
end
|
data/spec/support_spec.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'spec_helper'
|
3
4
|
require 'tempfile'
|
4
5
|
|
5
6
|
describe 'support' do
|
6
7
|
let(:output) do
|
7
|
-
StringIO.new
|
8
|
+
StringIO.new
|
8
9
|
end
|
9
10
|
|
10
11
|
let(:debugger) do
|
@@ -15,31 +16,8 @@ describe 'support' do
|
|
15
16
|
debugger.scope
|
16
17
|
end
|
17
18
|
|
18
|
-
describe 'play' do
|
19
|
-
before(:each) do
|
20
|
-
allow(debugger).to receive(:fetch_url_data).with(file_url + '.txt').and_return(File.read(fixtures_file))
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:fixtures_file) do
|
24
|
-
File.join(fixtures_dir, 'sample_manifest.pp')
|
25
|
-
end
|
26
|
-
|
27
|
-
let(:file_url) do
|
28
|
-
'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0'
|
29
|
-
end
|
30
|
-
let(:input) do
|
31
|
-
"play #{file_url}"
|
32
|
-
end
|
33
|
-
|
34
|
-
it do
|
35
|
-
debugger.handle_input(input)
|
36
|
-
expect(output.string).to match(/test/)
|
37
|
-
expect(output.string).to match(/Puppet::Type::File/)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
19
|
let(:puppet_version) do
|
42
|
-
debugger.
|
20
|
+
debugger.puppet_lib_dir.scan(debugger.mod_finder).flatten.last
|
43
21
|
end
|
44
22
|
|
45
23
|
let(:manifest_file) do
|
@@ -71,7 +49,7 @@ describe 'support' do
|
|
71
49
|
end
|
72
50
|
|
73
51
|
it 'should return a puppet version' do
|
74
|
-
expect(puppet_version).to match(/puppet-\d\.\d
|
52
|
+
expect(puppet_version).to match(/puppet-\d\.\d+.\d/)
|
75
53
|
end
|
76
54
|
|
77
55
|
it 'should return lib dirs' do
|
@@ -92,94 +70,5 @@ describe 'support' do
|
|
92
70
|
expect(debugger.node.facts.values['fqdn']).to eq('foo.example.com')
|
93
71
|
end
|
94
72
|
|
95
|
-
|
96
|
-
describe 'unsupported' do
|
97
|
-
let(:url) { 'https://bitbuck.com/master/lib/log_helper.rb' }
|
98
|
-
let(:converted) { 'https://bitbuck.com/master/lib/log_helper.rb' }
|
99
|
-
it do
|
100
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
101
|
-
end
|
102
|
-
end
|
103
|
-
describe 'gitlab' do
|
104
|
-
describe 'blob' do
|
105
|
-
let(:url) { 'https://gitlab.com/nwops/pdebugger-web/blob/master/lib/log_helper.rb' }
|
106
|
-
let(:converted) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
|
107
|
-
it do
|
108
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'raw' do
|
113
|
-
let(:url) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
|
114
|
-
let(:converted) { 'https://gitlab.com/nwops/pdebugger-web/raw/master/lib/log_helper.rb' }
|
115
|
-
it do
|
116
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'snippet' do
|
121
|
-
describe 'not raw' do
|
122
|
-
let(:url) { 'https://gitlab.com/snippets/19471' }
|
123
|
-
let(:converted) { 'https://gitlab.com/snippets/19471/raw' }
|
124
|
-
it do
|
125
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe 'raw' do
|
130
|
-
let(:url) { 'https://gitlab.com/snippets/19471/raw' }
|
131
|
-
let(:converted) { 'https://gitlab.com/snippets/19471/raw' }
|
132
|
-
it do
|
133
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
describe 'github' do
|
139
|
-
describe 'raw' do
|
140
|
-
let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw' }
|
141
|
-
let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw' }
|
142
|
-
it do
|
143
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
describe 'raw' do
|
147
|
-
let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0' }
|
148
|
-
let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0.txt' }
|
149
|
-
it do
|
150
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
describe 'raw gist' do
|
154
|
-
let(:url) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp' }
|
155
|
-
let(:converted) { 'https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw/c8f6be52da5b2b0eeaabb9aa75832b75793d35d1/controls.pp' }
|
156
|
-
it do
|
157
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
158
|
-
end
|
159
|
-
end
|
160
|
-
describe 'raw non gist' do
|
161
|
-
let(:url) { 'https://raw.githubusercontent.com/nwops/puppet-debugger/master/lib/puppet-debugger.rb' }
|
162
|
-
let(:converted) { 'https://raw.githubusercontent.com/nwops/puppet-debugger/master/lib/puppet-debugger.rb' }
|
163
|
-
it do
|
164
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe 'blob' do
|
169
|
-
let(:url) { 'https://github.com/nwops/puppet-debugger/blob/master/lib/puppet-debugger.rb' }
|
170
|
-
let(:converted) { 'https://github.com/nwops/puppet-debugger/raw/master/lib/puppet-debugger.rb' }
|
171
|
-
it do
|
172
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
describe 'gist' do
|
177
|
-
let(:url) { 'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0' }
|
178
|
-
let(:converted) { 'https://gist.github.com/logicminds/f9b1ac65a3a440d562b0.txt' }
|
179
|
-
it do
|
180
|
-
expect(debugger.convert_to_text(url)).to eq(converted)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
73
|
+
|
185
74
|
end
|
data/test_matrix.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-debugger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Osman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pluginator
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.4.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.4.1
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: puppet
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -28,30 +42,30 @@ dependencies:
|
|
28
42
|
name: facterdb
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - "
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.3.
|
47
|
+
version: 0.3.1
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
|
-
- - "
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.3.
|
54
|
+
version: 0.3.1
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: awesome_print
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1.
|
61
|
+
version: '1.7'
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1.
|
68
|
+
version: '1.7'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rdoc
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +80,20 @@ dependencies:
|
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: '3.12'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.6'
|
69
97
|
description: A interactive command line tool for evaluating and debugging the puppet
|
70
98
|
language
|
71
99
|
email: corey@nwops.io
|
@@ -89,28 +117,48 @@ files:
|
|
89
117
|
- CHANGELOG.md
|
90
118
|
- DEVELOPMENT.md
|
91
119
|
- Gemfile
|
92
|
-
- Gemfile.lock
|
93
120
|
- LICENSE.txt
|
121
|
+
- Plugin_development.md
|
94
122
|
- README.md
|
95
123
|
- Rakefile
|
96
124
|
- bin/pdb
|
97
125
|
- lib/awesome_print/ext/awesome_puppet.rb
|
126
|
+
- lib/plugins/puppet-debugger/input_responders/benchmark.rb
|
127
|
+
- lib/plugins/puppet-debugger/input_responders/classes.rb
|
128
|
+
- lib/plugins/puppet-debugger/input_responders/classification.rb
|
129
|
+
- lib/plugins/puppet-debugger/input_responders/commands.rb
|
130
|
+
- lib/plugins/puppet-debugger/input_responders/datatypes.rb
|
131
|
+
- lib/plugins/puppet-debugger/input_responders/environment.rb
|
132
|
+
- lib/plugins/puppet-debugger/input_responders/exit.rb
|
133
|
+
- lib/plugins/puppet-debugger/input_responders/facterdb_filter.rb
|
134
|
+
- lib/plugins/puppet-debugger/input_responders/facts.rb
|
135
|
+
- lib/plugins/puppet-debugger/input_responders/functions.rb
|
136
|
+
- lib/plugins/puppet-debugger/input_responders/help.rb
|
137
|
+
- lib/plugins/puppet-debugger/input_responders/krt.rb
|
138
|
+
- lib/plugins/puppet-debugger/input_responders/play.rb
|
139
|
+
- lib/plugins/puppet-debugger/input_responders/reset.rb
|
140
|
+
- lib/plugins/puppet-debugger/input_responders/resources.rb
|
141
|
+
- lib/plugins/puppet-debugger/input_responders/set.rb
|
142
|
+
- lib/plugins/puppet-debugger/input_responders/types.rb
|
143
|
+
- lib/plugins/puppet-debugger/input_responders/vars.rb
|
144
|
+
- lib/plugins/puppet-debugger/input_responders/whereami.rb
|
98
145
|
- lib/puppet-debugger.rb
|
99
146
|
- lib/puppet-debugger/cli.rb
|
100
147
|
- lib/puppet-debugger/code/code_file.rb
|
101
148
|
- lib/puppet-debugger/code/code_range.rb
|
102
149
|
- lib/puppet-debugger/code/loc.rb
|
103
150
|
- lib/puppet-debugger/debugger_code.rb
|
151
|
+
- lib/puppet-debugger/hooks.rb
|
152
|
+
- lib/puppet-debugger/input_responder_plugin.rb
|
153
|
+
- lib/puppet-debugger/plugin_test_helper.rb
|
104
154
|
- lib/puppet-debugger/support.rb
|
105
155
|
- lib/puppet-debugger/support/compiler.rb
|
106
156
|
- lib/puppet-debugger/support/environment.rb
|
107
157
|
- lib/puppet-debugger/support/errors.rb
|
108
158
|
- lib/puppet-debugger/support/facts.rb
|
109
159
|
- lib/puppet-debugger/support/functions.rb
|
110
|
-
- lib/puppet-debugger/support/input_responders.rb
|
111
160
|
- lib/puppet-debugger/support/loader.rb
|
112
161
|
- lib/puppet-debugger/support/node.rb
|
113
|
-
- lib/puppet-debugger/support/play.rb
|
114
162
|
- lib/puppet-debugger/support/scope.rb
|
115
163
|
- lib/puppet/application/debugger.rb
|
116
164
|
- lib/trollop.rb
|
@@ -124,6 +172,11 @@ files:
|
|
124
172
|
- spec/fixtures/node_obj.yaml
|
125
173
|
- spec/fixtures/sample_manifest.pp
|
126
174
|
- spec/fixtures/sample_start_debugger.pp
|
175
|
+
- spec/hooks_spec.rb
|
176
|
+
- spec/input_responder_plugin_spec.rb
|
177
|
+
- spec/input_responders/help_spec.rb
|
178
|
+
- spec/input_responders/krt_spec.rb
|
179
|
+
- spec/input_responders/play_spec.rb
|
127
180
|
- spec/pdb_spec.rb
|
128
181
|
- spec/puppet/application/debugger_spec.rb
|
129
182
|
- spec/puppet_debugger_spec.rb
|
@@ -152,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
205
|
version: '0'
|
153
206
|
requirements: []
|
154
207
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.6.
|
208
|
+
rubygems_version: 2.6.12
|
156
209
|
signing_key:
|
157
210
|
specification_version: 4
|
158
211
|
summary: A repl based debugger for the puppet language
|
data/Gemfile.lock
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
CFPropertyList (2.2.8)
|
5
|
-
ast (2.3.0)
|
6
|
-
awesome_print (1.7.0)
|
7
|
-
coderay (1.1.1)
|
8
|
-
diff-lcs (1.3)
|
9
|
-
docile (1.1.5)
|
10
|
-
facter (2.4.6)
|
11
|
-
CFPropertyList (~> 2.2.6)
|
12
|
-
facterdb (0.3.10)
|
13
|
-
facter
|
14
|
-
jgrep
|
15
|
-
fast_gettext (1.1.0)
|
16
|
-
gettext (3.2.2)
|
17
|
-
locale (>= 2.0.5)
|
18
|
-
text (>= 1.3.0)
|
19
|
-
gettext-setup (0.16)
|
20
|
-
fast_gettext (~> 1.1.0)
|
21
|
-
gettext (>= 3.0.2)
|
22
|
-
locale
|
23
|
-
hiera (3.3.1)
|
24
|
-
jgrep (1.4.1)
|
25
|
-
json
|
26
|
-
json (1.8.6)
|
27
|
-
json_pure (1.8.6)
|
28
|
-
locale (2.1.2)
|
29
|
-
method_source (0.8.2)
|
30
|
-
parser (2.4.0.0)
|
31
|
-
ast (~> 2.2)
|
32
|
-
powerpack (0.1.1)
|
33
|
-
pry (0.10.4)
|
34
|
-
coderay (~> 1.1.0)
|
35
|
-
method_source (~> 0.8.1)
|
36
|
-
slop (~> 3.4)
|
37
|
-
puppet (4.9.4)
|
38
|
-
facter (> 2.0, < 4)
|
39
|
-
gettext-setup (>= 0.10, < 1)
|
40
|
-
hiera (>= 2.0, < 4)
|
41
|
-
json_pure (~> 1.8)
|
42
|
-
locale (~> 2.1)
|
43
|
-
rainbow (2.2.1)
|
44
|
-
rake (12.0.0)
|
45
|
-
rdoc (3.12.2)
|
46
|
-
json (~> 1.4)
|
47
|
-
release_me (0.1.4)
|
48
|
-
rspec (3.5.0)
|
49
|
-
rspec-core (~> 3.5.0)
|
50
|
-
rspec-expectations (~> 3.5.0)
|
51
|
-
rspec-mocks (~> 3.5.0)
|
52
|
-
rspec-core (3.5.4)
|
53
|
-
rspec-support (~> 3.5.0)
|
54
|
-
rspec-expectations (3.5.0)
|
55
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
56
|
-
rspec-support (~> 3.5.0)
|
57
|
-
rspec-mocks (3.5.0)
|
58
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
59
|
-
rspec-support (~> 3.5.0)
|
60
|
-
rspec-support (3.5.0)
|
61
|
-
rubocop (0.47.1)
|
62
|
-
parser (>= 2.3.3.1, < 3.0)
|
63
|
-
powerpack (~> 0.1)
|
64
|
-
rainbow (>= 1.99.1, < 3.0)
|
65
|
-
ruby-progressbar (~> 1.7)
|
66
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
67
|
-
ruby-progressbar (1.8.1)
|
68
|
-
simplecov (0.14.1)
|
69
|
-
docile (~> 1.1.0)
|
70
|
-
json (>= 1.8, < 3)
|
71
|
-
simplecov-html (~> 0.10.0)
|
72
|
-
simplecov-html (0.10.0)
|
73
|
-
slop (3.6.0)
|
74
|
-
text (1.3.1)
|
75
|
-
unicode-display_width (1.1.3)
|
76
|
-
|
77
|
-
PLATFORMS
|
78
|
-
ruby
|
79
|
-
|
80
|
-
DEPENDENCIES
|
81
|
-
awesome_print (~> 1.6)
|
82
|
-
bundler
|
83
|
-
facterdb (>= 0.3.8)
|
84
|
-
json_pure (<= 2.0.1)
|
85
|
-
pry
|
86
|
-
puppet (~> 4.9.0)
|
87
|
-
rake
|
88
|
-
rdoc (~> 3.12)
|
89
|
-
release_me
|
90
|
-
rspec
|
91
|
-
rubocop
|
92
|
-
simplecov
|
93
|
-
|
94
|
-
BUNDLED WITH
|
95
|
-
1.14.6
|
@@ -1,191 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
module PuppetDebugger
|
3
|
-
module Support
|
4
|
-
module InputResponders
|
5
|
-
def static_responder_list
|
6
|
-
%w(exit functions classification vars facterdb_filter krt facts types
|
7
|
-
resources classes whereami datatypes play reset help)
|
8
|
-
end
|
9
|
-
|
10
|
-
def disable_benchmark
|
11
|
-
$benchmark = false
|
12
|
-
$extra_prompt = ''
|
13
|
-
'Off'
|
14
|
-
end
|
15
|
-
|
16
|
-
def enable_benchmark(show_status = false)
|
17
|
-
require 'benchmark'
|
18
|
-
$benchmark = true
|
19
|
-
if show_status
|
20
|
-
$extra_prompt = 'BM'
|
21
|
-
'On'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def benchmark(args = [])
|
26
|
-
if args.count > 0
|
27
|
-
enable_benchmark(false)
|
28
|
-
out = handle_input(args.first)
|
29
|
-
disable_benchmark
|
30
|
-
out
|
31
|
-
else
|
32
|
-
status = $benchmark ? disable_benchmark : enable_benchmark(true)
|
33
|
-
"Benchmark Mode #{status}"
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def datatypes(_args = [])
|
38
|
-
types = all_data_types
|
39
|
-
return types.sort.ai if types.instance_of?(Array)
|
40
|
-
types
|
41
|
-
end
|
42
|
-
|
43
|
-
# @source_file and @source_line_num instance variables must be set for this
|
44
|
-
# method to show the surrounding code
|
45
|
-
# @return [String] - string output of the code surrounded by the breakpoint or nil if file
|
46
|
-
# or line_num do not exist
|
47
|
-
def whereami(_command = nil, _args = nil)
|
48
|
-
file = @source_file
|
49
|
-
line_num = @source_line_num
|
50
|
-
if file && line_num
|
51
|
-
if file == :code
|
52
|
-
source_code = Puppet[:code]
|
53
|
-
code = DebuggerCode.from_string(source_code, :puppet)
|
54
|
-
else
|
55
|
-
code = DebuggerCode.from_file(file, :puppet)
|
56
|
-
end
|
57
|
-
return code.with_marker(line_num).around(line_num, 5)
|
58
|
-
.with_line_numbers.with_indentation(5).with_file_reference.to_s
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
# @return - returns a list of types available to the environment
|
63
|
-
# if a error occurs we we run the types function again
|
64
|
-
def types(_args = [])
|
65
|
-
loaded_types = []
|
66
|
-
begin
|
67
|
-
# this loads all the types, if already loaded the file is skipped
|
68
|
-
Puppet::Type.loadall
|
69
|
-
Puppet::Type.eachtype do |t|
|
70
|
-
next if t.name == :component
|
71
|
-
loaded_types << t.name.to_s
|
72
|
-
end
|
73
|
-
loaded_types.ai
|
74
|
-
rescue Puppet::Error => e
|
75
|
-
puts e.message.red
|
76
|
-
Puppet.info(e.message)
|
77
|
-
# prevent more than two calls and recursive loop
|
78
|
-
return if caller_locations(1,10).find_all{|f| f.label == 'types' }.count > 2
|
79
|
-
types
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# displays the facterdb filter
|
84
|
-
# @param [Array] - args is not used
|
85
|
-
def facterdb_filter(_args = [])
|
86
|
-
dynamic_facterdb_filter.ai
|
87
|
-
end
|
88
|
-
|
89
|
-
def help(_args = [])
|
90
|
-
PuppetDebugger::Cli.print_repl_desc
|
91
|
-
end
|
92
|
-
|
93
|
-
def handle_set(input)
|
94
|
-
output = ''
|
95
|
-
args = input.split(' ')
|
96
|
-
args.shift # throw away the set
|
97
|
-
case args.shift
|
98
|
-
when /node/
|
99
|
-
if name = args.shift
|
100
|
-
output = "Resetting to use node #{name}"
|
101
|
-
reset
|
102
|
-
set_remote_node_name(name)
|
103
|
-
else
|
104
|
-
out_buffer.puts 'Must supply a valid node name'
|
105
|
-
end
|
106
|
-
when /loglevel/
|
107
|
-
if level = args.shift
|
108
|
-
@log_level = level
|
109
|
-
set_log_level(level)
|
110
|
-
output = "loglevel #{Puppet::Util::Log.level} is set"
|
111
|
-
end
|
112
|
-
end
|
113
|
-
output
|
114
|
-
end
|
115
|
-
|
116
|
-
def facts(_args = [])
|
117
|
-
variables = node.facts.values
|
118
|
-
variables.ai(sort_keys: true, indent: -1)
|
119
|
-
end
|
120
|
-
|
121
|
-
def functions(args = [])
|
122
|
-
filter = args.first || ''
|
123
|
-
function_map.keys.sort.grep(/^#{Regexp.escape(filter)}/)
|
124
|
-
end
|
125
|
-
|
126
|
-
def vars(_args = [])
|
127
|
-
# remove duplicate variables that are also in the facts hash
|
128
|
-
variables = scope.to_hash.delete_if { |key, _value| node.facts.values.key?(key) }
|
129
|
-
variables['facts'] = 'removed by the puppet-debugger' if variables.key?('facts')
|
130
|
-
output = 'Facts were removed for easier viewing'.ai + "\n"
|
131
|
-
output += variables.ai(sort_keys: true, indent: -1)
|
132
|
-
end
|
133
|
-
|
134
|
-
def environment(_args = [])
|
135
|
-
"Puppet Environment: #{puppet_env_name}"
|
136
|
-
end
|
137
|
-
|
138
|
-
def reset(_args = [])
|
139
|
-
set_scope(nil)
|
140
|
-
set_remote_node_name(nil)
|
141
|
-
set_node(nil)
|
142
|
-
set_facts(nil)
|
143
|
-
set_environment(nil)
|
144
|
-
set_compiler(nil)
|
145
|
-
set_log_level(log_level)
|
146
|
-
end
|
147
|
-
|
148
|
-
def set_log_level(level)
|
149
|
-
Puppet::Util::Log.level = level.to_sym
|
150
|
-
buffer_log = Puppet::Util::Log.newdestination(:buffer)
|
151
|
-
if buffer_log
|
152
|
-
# if this is already set the buffer_log is nil
|
153
|
-
buffer_log.out_buffer = out_buffer
|
154
|
-
buffer_log.err_buffer = out_buffer
|
155
|
-
end
|
156
|
-
nil
|
157
|
-
end
|
158
|
-
|
159
|
-
def krt(_args = [])
|
160
|
-
known_resource_types.ai(sort_keys: true, indent: -1)
|
161
|
-
end
|
162
|
-
|
163
|
-
def play(args = [])
|
164
|
-
config = {}
|
165
|
-
config[:play] = args.first
|
166
|
-
play_back(config)
|
167
|
-
nil # we don't want to return anything
|
168
|
-
end
|
169
|
-
|
170
|
-
def classification(_args = [])
|
171
|
-
node.classes.ai
|
172
|
-
end
|
173
|
-
|
174
|
-
def resources(args = [])
|
175
|
-
res = scope.compiler.catalog.resources.map do |res|
|
176
|
-
res.to_s.gsub(/\[/, "['").gsub(/\]/, "']") # ensure the title has quotes
|
177
|
-
end
|
178
|
-
if !args.first.nil?
|
179
|
-
res[args.first.to_i].ai
|
180
|
-
else
|
181
|
-
output = "Resources not shown in any specific order\n".warning
|
182
|
-
output += res.ai
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def classes(_args = [])
|
187
|
-
scope.compiler.catalog.classes.ai
|
188
|
-
end
|
189
|
-
end
|
190
|
-
end
|
191
|
-
end
|