puppet-debugger 0.16.0 → 1.1.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 +10 -26
- data/.rubocop.yml +64 -232
- data/.rubocop_todo.yml +89 -147
- data/.ruby-version +1 -1
- data/.vscode/launch.json +15 -0
- data/CHANGELOG.md +34 -0
- data/Gemfile +7 -5
- data/README.md +29 -261
- 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.rb +1 -45
- data/lib/puppet-debugger/cli.rb +130 -92
- 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 +57 -0
- data/lib/puppet-debugger/plugin_test_helper.rb +9 -8
- data/lib/puppet-debugger/support.rb +27 -17
- 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 +17 -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 -83
- 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 +56 -22
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.5
|
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,5 +1,39 @@
|
|
1
|
+
# Puppet Debugger Changelog
|
2
|
+
|
1
3
|
## Unreleased
|
2
4
|
|
5
|
+
## 1.1
|
6
|
+
- Catch signals and allow control-d for quitting.
|
7
|
+
## 1.0
|
8
|
+
Released: 8/3/2020
|
9
|
+
|
10
|
+
This is a major revision with breaking changes, notably the requirement of ruby 2.4 and puppet 5.5.
|
11
|
+
|
12
|
+
- Bump required ruby version to 2.4
|
13
|
+
- Bump required puppet version to puppet 5.5
|
14
|
+
- Add stacktrace plugin
|
15
|
+
- Add a pager for long output
|
16
|
+
- Remove puppet4 and older work arounds
|
17
|
+
- Use rubocop for better code quality
|
18
|
+
- Fix issue when the debugger was not loading the manifest properly
|
19
|
+
|
20
|
+
## 0.19.0
|
21
|
+
- Search datatypes with filter
|
22
|
+
- Fix #8 - trusted_server_facts' as a setting is deprecated
|
23
|
+
|
24
|
+
## 0.18.0
|
25
|
+
- Add bundler as a dependency
|
26
|
+
- Add ability to filter out classes
|
27
|
+
- Add ability to filter out resources
|
28
|
+
- Add ability to supply a catalog
|
29
|
+
- Add vendormoduledir to module paths
|
30
|
+
|
31
|
+
## 0.17.0
|
32
|
+
- Fix bolt issue when the catalog is referenced
|
33
|
+
- Fix bolt issue when scriptcompiler scope is used
|
34
|
+
and the debugger tries to expand the resources
|
35
|
+
in the catalog.
|
36
|
+
|
3
37
|
## 0.16.0
|
4
38
|
- Load bolt puppet modules if bolt exists
|
5
39
|
- Fix bolt datatype rendering issues
|
data/Gemfile
CHANGED
@@ -1,23 +1,25 @@
|
|
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'
|
9
11
|
group :test, :development do
|
10
12
|
# ruby versions prior to 2.0 cannot install json_pure 2.0.2+
|
11
13
|
gem 'bundler'
|
12
14
|
gem 'CFPropertyList'
|
13
15
|
gem 'pry'
|
14
16
|
gem 'puppet-debugger', path: './'
|
15
|
-
gem 'rake', '
|
17
|
+
gem 'rake', '~> 13.0'
|
16
18
|
gem 'rdoc', '~> 3.12'
|
17
19
|
gem 'release_me'
|
18
20
|
gem 'rspec', '~> 3.6'
|
21
|
+
gem 'rubocop'
|
22
|
+
gem 'rubocop-performance'
|
23
|
+
gem 'rubocop-rspec'
|
19
24
|
gem 'simplecov', '>= 0'
|
20
|
-
gem 'rubocop', '= 0.48.0'
|
21
|
-
|
22
25
|
end
|
23
|
-
|
data/README.md
CHANGED
@@ -31,8 +31,11 @@
|
|
31
31
|
|
32
32
|
A interactive command line tool for evaluating and debugging the puppet language.
|
33
33
|
|
34
|
+
## Documentation
|
35
|
+
Please visit https://docs.puppet-debugger.com for more info.
|
36
|
+
|
34
37
|
## Compatibility
|
35
|
-
Requires Puppet
|
38
|
+
Requires Puppet 5.5+, ruby 2.4+
|
36
39
|
|
37
40
|
## Production usage
|
38
41
|
The puppet debugger is a developer tool that should only be used when writing puppet code. Although it might seem useful
|
@@ -41,18 +44,6 @@ to install on your production puppet master. Please do not install because of th
|
|
41
44
|
## Installation
|
42
45
|
`gem install puppet-debugger`
|
43
46
|
|
44
|
-
## Load path
|
45
|
-
puppet-debugger will load all puppet functions from your basemodulepath and environmentpath.
|
46
|
-
|
47
|
-
This means if you run `puppet module install puppetlabs-stdlib` and they will be available
|
48
|
-
in the debugger.
|
49
|
-
|
50
|
-
## Interactive demo
|
51
|
-
I have put together a repo with a few setup instructions that will assist you in setting up a "mock" environment
|
52
|
-
for usage with the puppet-debugger. This was originally intended when giving a demo of the repl, but also seems
|
53
|
-
useful for other people.
|
54
|
-
|
55
|
-
https://github.com/nwops/puppet-debugger-demo
|
56
47
|
|
57
48
|
## Web demo
|
58
49
|
There is a web version of the [puppet-debugger](https://demo.puppet-debugger.com) online but is somewhat
|
@@ -72,260 +63,37 @@ and see what it would actual do when compiling a resource.
|
|
72
63
|
|
73
64
|
Example Usage
|
74
65
|
```
|
75
|
-
|
76
|
-
|
77
|
-
Puppet Version:
|
78
|
-
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
|
79
69
|
Created by: NWOps <corey@nwops.io>
|
80
|
-
Type "
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
Type "exit", "functions", "vars", "krt", "facts", "reset", "help" for more information.
|
102
|
-
|
103
|
-
>>
|
104
|
-
|
105
|
-
>> $config_file = '/etc/httpd/httpd.conf'
|
106
|
-
=> "/etc/httpd/httpd.conf"
|
107
|
-
>> file{$config_file: ensure => present, content => 'hello'}
|
108
|
-
=> Puppet::Type::File {
|
109
|
-
path => "/etc/httpd/httpd.conf",
|
110
|
-
provider => posix,
|
111
|
-
ensure => present,
|
112
|
-
content => "{md5}5d41402abc4b2a76b9719d911017c592",
|
113
|
-
checksum => nil,
|
114
|
-
backup => "puppet",
|
115
|
-
replace => true,
|
116
|
-
links => manage,
|
117
|
-
purge => false,
|
118
|
-
sourceselect => first,
|
119
|
-
show_diff => true,
|
120
|
-
validate_replacement => "%",
|
121
|
-
source_permissions => use,
|
122
|
-
selinux_ignore_defaults => false,
|
123
|
-
loglevel => notice,
|
124
|
-
name => "/etc/httpd/httpd.conf",
|
125
|
-
title => "/etc/httpd/httpd.conf"
|
126
|
-
}
|
127
|
-
>>
|
128
|
-
```
|
129
|
-
### Listing variables
|
130
|
-
To see the current variables in the scope use the `vars` keyword.
|
131
|
-
|
132
|
-
![variables](resources/variables.png)
|
133
|
-
|
134
|
-
## Listing functions
|
135
|
-
Knowing what functions are available and where they come from is extremely helpful especially in a debugger session. Run the `functions` keyword to get a name spaced list of functions. You can further filter out functions by passing in a filter argument. `functions stdlib`
|
136
|
-
|
137
|
-
![functions](resources/functions.png)
|
138
|
-
|
139
|
-
## Using functions
|
140
|
-
Functions will run and produce the desired output. If you type the word `functions`
|
141
|
-
a list of available functions will be displayed on the screen along with a namespace to help you identify where they came from.
|
142
|
-
|
143
|
-
```
|
144
|
-
>> split('hello/there/one/two/three','/')
|
145
|
-
=> ["hello", "there", "one", "two", "three"]
|
146
|
-
|
147
|
-
```
|
148
|
-
|
149
|
-
So you can imagine how much fun this can be trying out different types of functions.
|
150
|
-
|
151
|
-
## Duplicate resource error
|
152
|
-
Just like normal puppet code you cannot create duplicate resources.
|
153
|
-
|
154
|
-
```
|
155
|
-
>> file{'/tmp/failure2.txt': ensure => present}
|
156
|
-
=> Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: File[/tmp/failure2.txt] is already declared in file :1; cannot redeclare at line 1 at line 1:1
|
157
|
-
|
158
|
-
```
|
159
|
-
You can reset the parser by running `reset` within the debugger without having to exit.
|
160
|
-
|
161
|
-
## Setting the puppet log level
|
162
|
-
If you want to see what puppet is doing behind the scenes you can set the log level
|
163
|
-
via `:set loglevel debug`. Valid log levels are `debug`, `info`, `warning` and other
|
164
|
-
levels defined in puppet [config reference](https://docs.puppetlabs.com/puppet/4.4/reference/configuration.html#loglevel) .
|
165
|
-
|
166
|
-
![hiera](resources/hiera.png)
|
167
|
-
|
168
|
-
## Remote nodes
|
169
|
-
This is new for 0.2.0. The puppet-debugger now has the ability to pull in remote node information. Instead of mocking facts you can pull in real information! Get real facts and real node classification from the puppet master and then play with the info in the debugger session. This is made possible by using the puppet node indirector interface.
|
170
|
-
|
171
|
-
ie. `puppet node find hostname --terminus rest --render-as yaml`
|
172
|
-
|
173
|
-
In order to use this feature you will need to setup a few things.
|
174
|
-
|
175
|
-
### Setup
|
176
|
-
1. Allow node rest calls to your workstation on the puppet master(s)
|
177
|
-
See https://github.com/nwops/puppet-debugger/issues/17 for more info on allowing this rule.
|
178
|
-
|
179
|
-
2. Ensure you have the same code that your puppet master does. Since this pulls in classification you will need to have all the puppet modules defined in your
|
180
|
-
environmentpath or basemodulepath. The simple thing to do is to point your basemodulepath to your fixtures directory if using rspec-puppet or some other high level modules directory. For PE users you will want to ensure you have all the
|
181
|
-
pe specific modules in your development environment. Not doing this step will result in class not found errors.
|
182
|
-
|
183
|
-
3. Set the server config in your local puppet.conf. (on your development machine)
|
184
|
-
|
185
|
-
a. Find your puppet config file `puppet config print config`
|
186
|
-
|
187
|
-
b. edit the config file with an editor
|
188
|
-
|
189
|
-
c. add `server = <hostname>` to your main block
|
190
|
-
|
191
|
-
4. If using hiera you also need to set the path to your hiera config file since
|
192
|
-
the puppet-debugger will be compiling puppet code which could in turn call hiera
|
193
|
-
functions. Additionally, make sure your hiera config points to the correct
|
194
|
-
data location.
|
195
|
-
|
196
|
-
```
|
197
|
-
[main]
|
198
|
-
server = pe-puppet.localdomain
|
199
|
-
basemodulepath = /Users/cosman/github/puppet-debugger-demo/modules:/Users/cosman/Downloads/pe_modules
|
200
|
-
hiera_config = /Users/cosman/github/puppet-debugger-demo/hieradata/hiera.yaml
|
201
|
-
|
202
|
-
|
203
|
-
```
|
204
|
-
|
205
|
-
### Usage
|
206
|
-
There are two ways of using the remote node feature. You can either
|
207
|
-
pass in the node name from the command line or set the node name from the debugger session.
|
208
|
-
|
209
|
-
#### Command line:
|
210
|
-
`puppet debugger -n node_name`
|
211
|
-
|
212
|
-
![command line](resources/command_line_node.png)
|
213
|
-
|
214
|
-
#### From debugger session:
|
215
|
-
`:set node node_name`
|
216
|
-
|
217
|
-
![command line](resources/set_node.png)
|
218
|
-
|
219
|
-
|
220
|
-
This is also extremely useful to check classification rules and variables by your ENC. So instead of running your ENC script manually we get the puppet master to run this indirectly and return the results to you.
|
221
|
-
|
222
|
-
## Auto Complete
|
223
|
-
The puppet-debugger uses readline internally. So any variable or function is also available for auto completion.
|
224
|
-
Press the tab key to engage the auto complete functionality.
|
225
|
-
|
226
|
-
Currently native functions are not available in auto complete. See #24
|
227
|
-
|
228
|
-
## FacterDB and using different fact sets
|
229
|
-
The puppet-debugger internally leverages the [facterdb](https://github.com/camptocamp/facterdb/) gem to load pre-cached facts into the debugger session. At some point you
|
230
|
-
may need to override the debugger's default fact set with something of your own choosing. You can do this by setting one of the environment variables below.
|
231
|
-
|
232
|
-
* `DEBUGGER_FACTERDB_FILTER` Sets the entire filter
|
233
|
-
* `DEBUGGER_FACTER_OS_VERSION` Sets the OS version (only works with RHEL clones and Fedora)
|
234
|
-
* `DEBUGGER_FACTER_OS_NAME` Sets the OS name (only works with RHEL clones and Fedora)
|
235
|
-
* `DEBUGGER_FACTER_VERSION` Sets the facter version to use in the debugger session (uses facter 3.1 for puppet 4.4+ and facter 2.4 for 3.8-4.4)
|
236
|
-
|
237
|
-
By default it looks something like `operatingsystem=Fedora and operatingsystemrelease=23 and architecture=x86_64 and facterversion=/^3\\.1/`
|
238
|
-
depending on the puppet version currently running.
|
239
|
-
|
240
|
-
You can display the current facterdb filter by running `facterdb_filter` from the debugger session.
|
241
|
-
|
242
|
-
Why do facter versions matter? While facter and puppet work independently just fine, newer forge modules utilize certain data structures found only in newer versions of facter.
|
243
|
-
So its really up to the puppet code you use. With facter 3, almost every fact is now a data structure. So if you are having issues with facts not existing in the debugger you may need to change the facter version `REPL_FACTER_VERSION` to something different.
|
244
|
-
|
245
|
-
## Custom FacterDB Facts
|
246
|
-
As of FacterDB 0.4.0 we can now supply custom [external fact sets](https://github.com/camptocamp/facterdb#supplying-custom-external-facts) to facterDB.. This is a huge deal because you can take the facts from any system and play around with the fact data in the debugger. This makes the debugger appear as it was run on that system. Moreover, you can create shareable fact sets for your entire team. To use an external fact set you first need to grab the facts from the system you wish to "mock". This can be done with `puppet facts` or even puppetdb queries and then create a file with the values hash.
|
247
|
-
|
248
|
-
|
249
|
-
Take the values from the values hash only and place inside a new file.
|
250
|
-
```
|
251
|
-
{
|
252
|
-
"name": "macbook-pro-10.domain",
|
253
|
-
"values": {
|
254
|
-
"custom_datacenter_fact": "iceland",
|
255
|
-
"puppetversion": "5.3.2",
|
256
|
-
"architecture": "x86_64",
|
257
|
-
"kernel": "Darwin",
|
258
|
-
"domain": "domain"
|
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"
|
259
91
|
}
|
260
92
|
}
|
93
|
+
2:>>
|
261
94
|
|
262
95
|
```
|
263
96
|
|
264
|
-
This can be easily done if you have `jq` installed.
|
265
|
-
|
266
|
-
`puppet facts | jq '.values' > /tmp/custom_facts/datacenter_a/2.4/os_x.facts`
|
267
|
-
|
268
|
-
Once you have created a directory with one or more fact files you just need to set an environment variable to tell facterDB about the custom fact sets.
|
269
|
-
|
270
|
-
`export FACTERDB_SEARCH_PATHS="/tmp/custom_facts/"`
|
271
|
-
|
272
|
-
Now everytime you start the puppet debugger, facterDB will use these custom fact files
|
273
|
-
as part of the facterDB database. However, you will still need to provide a search filter that references your custom fact because there are over a thousand facterDB fact sets.
|
274
|
-
|
275
|
-
`puppet debugger --facterdb-filter 'custom_datacenter_fact=iceland'`
|
276
|
-
|
277
|
-
|
278
|
-
Alternatively you can bypass the internal facterDB database by setting `export FACTERDB_SKIP_DEFAULTDB=true` and force your custom facts to be the only facts facterDB uses.
|
279
|
-
|
280
|
-
*Note: when exporting facterDB environment variables you will also change the behavior for rspec_puppet_facts and other gems that also rely on facterDB. So please remember to unset the variables if not needed*
|
281
|
-
|
282
|
-
## Playback support
|
283
|
-
puppet-debugger now supports playing back files or urls and loading the content into the debugger session. This means if you want to start a debugger session from an existing file or url you can play the content back in the debugger.
|
284
|
-
You can also playback a file that contains puppet code and debugger commands.
|
285
|
-
|
286
|
-
`play https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw`
|
287
|
-
|
288
|
-
or
|
289
|
-
|
290
|
-
`puppet debugger -p https://gist.githubusercontent.com/logicminds/f9b1ac65a3a440d562b0/raw`
|
291
|
-
|
292
|
-
or just use STDIN `puppet debugger <some_file>` or `echo "abs(-3)" | puppet debugger`
|
293
|
-
|
294
|
-
### Web based playback support
|
295
|
-
If using the [web based debugger](https://www.puppet-debugger.com) you can playback a shared url
|
296
|
-
which would start a debugger session and then load the content from the url or parameter.
|
297
|
-
|
298
|
-
Example:
|
299
|
-
https://puppet-debugger.com/play?url=https://gist.github.com/logicminds/64f0fe9f64339f18f097a9f42acd6276
|
300
|
-
|
301
|
-
or for single commands
|
302
|
-
|
303
|
-
https://www.puppet-debugger.com/play?content=vars
|
304
|
-
|
305
|
-
Please note the web based debugger only contains a minimal amount of puppet modules. So its likely
|
306
|
-
that your code may not work if using third party modules. This may change in the future though.
|
307
|
-
|
308
|
-
## Plugins
|
309
|
-
The puppet debugger has a plugin system that allows anyone to create new functionality
|
310
|
-
for the puppet debugger. By default the puppet debugger ships with serveral core
|
311
|
-
plugins that provide basic usage. Any non core plugin can be installed as a separate
|
312
|
-
gem. The following is a list of plugins we wrote or know about.
|
313
|
-
|
314
|
-
|
315
|
-
| Name | Project Url | Type | Description |
|
316
|
-
| ------------- |:-------------:| -----:| -------------:|
|
317
|
-
| playbooks | [playbooks](https://gitlab.com/puppet-debugger/puppet-debugger-playbooks) | editing | Allows group playback of scripted puppet commands |
|
318
|
-
|
319
|
-
|
320
|
-
## Development
|
321
|
-
* [Plugin Development Guide](Plugin_development.md)
|
322
|
-
|
323
|
-
## Troubleshooting
|
324
|
-
Please file an issue so we can track bugs.
|
325
|
-
|
326
|
-
|
327
|
-
Pull requests welcomed.
|
328
|
-
|
329
97
|
## Copyright
|
330
98
|
|
331
99
|
Copyright (c) 2018 NWOPS, LLC. See LICENSE.txt for
|
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
|