pdk-akerl 1.9.1.1 → 1.14.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +180 -0
  3. data/README.md +43 -4
  4. data/lib/pdk.rb +4 -2
  5. data/lib/pdk/analytics.rb +44 -0
  6. data/lib/pdk/analytics/client/google_analytics.rb +141 -0
  7. data/lib/pdk/analytics/client/noop.rb +23 -0
  8. data/lib/pdk/analytics/util.rb +17 -0
  9. data/lib/pdk/answer_file.rb +4 -1
  10. data/lib/pdk/cli.rb +50 -3
  11. data/lib/pdk/cli/build.rb +10 -4
  12. data/lib/pdk/cli/bundle.rb +10 -8
  13. data/lib/pdk/cli/config.rb +20 -0
  14. data/lib/pdk/cli/config/get.rb +24 -0
  15. data/lib/pdk/cli/console.rb +148 -0
  16. data/lib/pdk/cli/convert.rb +7 -2
  17. data/lib/pdk/cli/exec.rb +22 -190
  18. data/lib/pdk/cli/exec/command.rb +238 -0
  19. data/lib/pdk/cli/exec/interactive_command.rb +114 -0
  20. data/lib/pdk/cli/exec_group.rb +6 -6
  21. data/lib/pdk/cli/module/build.rb +0 -2
  22. data/lib/pdk/cli/module/generate.rb +4 -2
  23. data/lib/pdk/cli/new.rb +2 -0
  24. data/lib/pdk/cli/new/class.rb +2 -2
  25. data/lib/pdk/cli/new/defined_type.rb +4 -2
  26. data/lib/pdk/cli/new/module.rb +5 -0
  27. data/lib/pdk/cli/new/provider.rb +4 -2
  28. data/lib/pdk/cli/new/task.rb +4 -1
  29. data/lib/pdk/cli/new/test.rb +53 -0
  30. data/lib/pdk/cli/new/transport.rb +27 -0
  31. data/lib/pdk/cli/test.rb +0 -1
  32. data/lib/pdk/cli/test/unit.rb +18 -13
  33. data/lib/pdk/cli/update.rb +25 -3
  34. data/lib/pdk/cli/util.rb +111 -14
  35. data/lib/pdk/cli/util/interview.rb +10 -2
  36. data/lib/pdk/cli/util/option_validator.rb +4 -0
  37. data/lib/pdk/cli/util/spinner.rb +13 -0
  38. data/lib/pdk/cli/validate.rb +16 -5
  39. data/lib/pdk/config.rb +121 -0
  40. data/lib/pdk/config/analytics_schema.json +26 -0
  41. data/lib/pdk/config/errors.rb +5 -0
  42. data/lib/pdk/config/json.rb +34 -0
  43. data/lib/pdk/config/json_schema_namespace.rb +143 -0
  44. data/lib/pdk/config/json_schema_setting.rb +53 -0
  45. data/lib/pdk/config/json_with_schema.rb +50 -0
  46. data/lib/pdk/config/namespace.rb +332 -0
  47. data/lib/pdk/config/setting.rb +132 -0
  48. data/lib/pdk/config/yaml.rb +43 -0
  49. data/lib/pdk/config/yaml_with_schema.rb +59 -0
  50. data/lib/pdk/generate.rb +10 -3
  51. data/lib/pdk/generate/defined_type.rb +1 -0
  52. data/lib/pdk/generate/module.rb +62 -35
  53. data/lib/pdk/generate/provider.rb +0 -5
  54. data/lib/pdk/generate/puppet_class.rb +1 -0
  55. data/lib/pdk/generate/puppet_object.rb +88 -41
  56. data/lib/pdk/generate/transport.rb +87 -0
  57. data/lib/pdk/logger.rb +21 -1
  58. data/lib/pdk/module.rb +2 -2
  59. data/lib/pdk/module/build.rb +103 -10
  60. data/lib/pdk/module/convert.rb +85 -19
  61. data/lib/pdk/module/metadata.rb +17 -12
  62. data/lib/pdk/module/templatedir.rb +108 -40
  63. data/lib/pdk/module/update.rb +27 -15
  64. data/lib/pdk/module/update_manager.rb +23 -15
  65. data/lib/pdk/report.rb +4 -3
  66. data/lib/pdk/report/event.rb +8 -6
  67. data/lib/pdk/template_file.rb +1 -1
  68. data/lib/pdk/tests/unit.rb +48 -21
  69. data/lib/pdk/util.rb +29 -63
  70. data/lib/pdk/util/bundler.rb +19 -15
  71. data/lib/pdk/util/filesystem.rb +64 -1
  72. data/lib/pdk/util/git.rb +52 -1
  73. data/lib/pdk/util/puppet_strings.rb +123 -0
  74. data/lib/pdk/util/puppet_version.rb +27 -12
  75. data/lib/pdk/util/ruby_version.rb +30 -7
  76. data/lib/pdk/util/template_uri.rb +281 -0
  77. data/lib/pdk/util/vendored_file.rb +28 -24
  78. data/lib/pdk/util/version.rb +7 -8
  79. data/lib/pdk/util/windows.rb +1 -0
  80. data/lib/pdk/util/windows/api_types.rb +0 -7
  81. data/lib/pdk/util/windows/file.rb +1 -1
  82. data/lib/pdk/util/windows/string.rb +1 -1
  83. data/lib/pdk/validate/base_validator.rb +12 -14
  84. data/lib/pdk/validate/metadata/metadata_json_lint.rb +0 -4
  85. data/lib/pdk/validate/metadata/metadata_syntax.rb +5 -3
  86. data/lib/pdk/validate/metadata_validator.rb +0 -2
  87. data/lib/pdk/validate/puppet/puppet_epp.rb +137 -0
  88. data/lib/pdk/validate/puppet/puppet_lint.rb +0 -3
  89. data/lib/pdk/validate/puppet/puppet_syntax.rb +5 -5
  90. data/lib/pdk/validate/puppet_validator.rb +2 -3
  91. data/lib/pdk/validate/ruby/rubocop.rb +1 -6
  92. data/lib/pdk/validate/ruby_validator.rb +0 -2
  93. data/lib/pdk/validate/tasks/metadata_lint.rb +9 -5
  94. data/lib/pdk/validate/tasks/name.rb +5 -3
  95. data/lib/pdk/validate/tasks_validator.rb +0 -2
  96. data/lib/pdk/validate/yaml/syntax.rb +6 -4
  97. data/lib/pdk/validate/yaml_validator.rb +0 -2
  98. data/lib/pdk/version.rb +1 -1
  99. data/locales/pdk.pot +634 -307
  100. metadata +100 -45
@@ -1,5 +1,3 @@
1
- require 'pdk/cli/util'
2
-
3
1
  module PDK::CLI
4
2
  @convert_cmd = @base_cmd.define_command do
5
3
  name 'convert'
@@ -7,13 +5,16 @@ module PDK::CLI
7
5
  summary _('Convert an existing module to be compatible with the PDK.')
8
6
 
9
7
  PDK::CLI.template_url_option(self)
8
+ PDK::CLI.template_ref_option(self)
10
9
  PDK::CLI.skip_interview_option(self)
11
10
  PDK::CLI.full_interview_option(self)
12
11
  flag nil, :noop, _('Do not convert the module, just output what would be done.')
13
12
  flag nil, :force, _('Convert the module automatically, with no prompts.')
13
+ flag nil, :'add-tests', _('Add any missing tests while converting the module.')
14
14
 
15
15
  run do |opts, _args, _cmd|
16
16
  require 'pdk/module/convert'
17
+ require 'pdk/cli/util'
17
18
 
18
19
  PDK::CLI::Util.ensure_in_module!(
19
20
  check_module_layout: true,
@@ -21,10 +22,14 @@ module PDK::CLI
21
22
  log_level: :info,
22
23
  )
23
24
 
25
+ PDK::CLI::Util.validate_template_opts(opts)
26
+
24
27
  if opts[:noop] && opts[:force]
25
28
  raise PDK::CLI::ExitWithError, _('You can not specify --noop and --force when converting a module')
26
29
  end
27
30
 
31
+ PDK::CLI::Util.analytics_screen_view('convert', opts)
32
+
28
33
  if opts[:'skip-interview'] && opts[:'full-interview']
29
34
  PDK.logger.info _('Ignoring --full-interview and continuing with --skip-interview.')
30
35
  opts[:'full-interview'] = false
data/lib/pdk/cli/exec.rb CHANGED
@@ -1,25 +1,33 @@
1
- require 'bundler'
2
- require 'childprocess'
3
- require 'tempfile'
4
- require 'tty-spinner'
5
- require 'tty-which'
6
-
7
- require 'pdk/util'
8
- require 'pdk/util/git'
9
- require 'pdk/util/ruby_version'
10
-
11
1
  module PDK
12
2
  module CLI
13
3
  module Exec
14
4
  def self.execute(*cmd)
5
+ require 'pdk/cli/exec/command'
6
+
15
7
  Command.new(*cmd).execute!
16
8
  end
17
9
 
18
10
  def self.execute_with_env(env, *cmd)
11
+ require 'pdk/cli/exec/command'
12
+
19
13
  Command.new(*cmd).tap { |c| c.environment = env }.execute!
20
14
  end
21
15
 
16
+ def self.execute_interactive(*cmd)
17
+ require 'pdk/cli/exec/interactive_command'
18
+
19
+ InteractiveCommand.new(*cmd).execute!
20
+ end
21
+
22
+ def self.execute_interactive_with_env(env, *cmd)
23
+ require 'pdk/cli/exec/interactive_command'
24
+
25
+ InteractiveCommand.new(*cmd).tap { |c| c.environment = env }.execute!
26
+ end
27
+
22
28
  def self.ensure_bin_present!(bin_path, bin_name)
29
+ require 'tty-which'
30
+
23
31
  message = _('Unable to find `%{name}`. Check that it is installed and try again.') % {
24
32
  name: bin_name,
25
33
  }
@@ -34,6 +42,8 @@ module PDK
34
42
  end
35
43
 
36
44
  def self.bundle_bin
45
+ require 'pdk/util/ruby_version'
46
+
37
47
  bundle_bin = Gem.win_platform? ? 'bundle.bat' : 'bundle'
38
48
  vendored_bin_path = File.join('private', 'ruby', PDK::Util::RubyVersion.active_ruby_version, 'bin', bundle_bin)
39
49
 
@@ -41,6 +51,8 @@ module PDK
41
51
  end
42
52
 
43
53
  def self.try_vendored_bin(vendored_bin_path, fallback)
54
+ require 'pdk/util'
55
+
44
56
  unless PDK::Util.package_install?
45
57
  PDK.logger.debug(_("PDK package installation not found. Trying '%{fallback}' from the system PATH instead.") % {
46
58
  fallback: fallback,
@@ -61,186 +73,6 @@ module PDK
61
73
  PDK.logger.debug(_("Using '%{vendored_bin}' from PDK package.") % { vendored_bin: vendored_bin_full_path })
62
74
  vendored_bin_full_path
63
75
  end
64
-
65
- # TODO: decide how/when to connect stdin to child process for things like pry
66
- # TODO: need a way to set callbacks on new stdout/stderr data
67
- class Command
68
- attr_reader :argv
69
- attr_reader :context
70
- attr_accessor :timeout
71
- attr_accessor :environment
72
- attr_writer :exec_group
73
-
74
- def initialize(*argv)
75
- @argv = argv
76
-
77
- @process = ChildProcess.build(*@argv)
78
- @process.leader = true
79
-
80
- @stdout = Tempfile.new('stdout').tap { |io| io.sync = true }
81
- @stderr = Tempfile.new('stderr').tap { |io| io.sync = true }
82
-
83
- @process.io.stdout = @stdout
84
- @process.io.stderr = @stderr
85
-
86
- # Default to running things in the system context.
87
- @context = :system
88
-
89
- # Extra environment vars to add to base set.
90
- @environment = {}
91
-
92
- # Register the ExecGroup when running in parallel
93
- @exec_group = nil
94
- end
95
-
96
- def context=(new_context)
97
- unless [:system, :module, :pwd].include?(new_context)
98
- raise ArgumentError, _("Expected execution context to be :system or :module but got '%{context}'.") % { context: new_context }
99
- end
100
-
101
- @context = new_context
102
- end
103
-
104
- def register_spinner(spinner, opts = {})
105
- return unless PDK::CLI::Util.interactive?
106
- @success_message = opts.delete(:success)
107
- @failure_message = opts.delete(:failure)
108
-
109
- @spinner = spinner
110
- end
111
-
112
- def add_spinner(message, opts = {})
113
- return unless PDK::CLI::Util.interactive?
114
- @success_message = opts.delete(:success)
115
- @failure_message = opts.delete(:failure)
116
-
117
- @spinner = TTY::Spinner.new("[:spinner] #{message}", opts.merge(PDK::CLI::Util.spinner_opts_for_platform))
118
- end
119
-
120
- def update_environment(additional_env)
121
- @environment.merge!(additional_env)
122
- end
123
-
124
- def execute!
125
- # Start spinning if configured.
126
- @spinner.auto_spin if @spinner
127
-
128
- # Add custom env vars.
129
- @environment.each do |k, v|
130
- @process.environment[k] = v
131
- end
132
-
133
- @process.environment['BUNDLE_IGNORE_CONFIG'] = '1'
134
-
135
- if [:module, :pwd].include?(context)
136
- @process.environment['GEM_HOME'] = PDK::Util::RubyVersion.gem_home
137
- @process.environment['GEM_PATH'] = PDK::Util::RubyVersion.gem_path
138
-
139
- # Make sure invocation of Ruby prefers our private installation.
140
- package_binpath = PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil
141
- @process.environment['PATH'] = [
142
- PDK::Util::RubyVersion.bin_path,
143
- File.join(@process.environment['GEM_HOME'], 'bin'),
144
- PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path| File.join(gem_path, 'bin') },
145
- package_binpath,
146
- PDK::Util.package_install? ? PDK::Util::Git.git_paths : nil,
147
- ENV['PATH'],
148
- ].compact.flatten.join(File::PATH_SEPARATOR)
149
-
150
- mod_root = PDK::Util.module_root
151
-
152
- unless mod_root
153
- @spinner.error if @spinner
154
-
155
- raise PDK::CLI::FatalError, _('Current working directory is not part of a module. (No metadata.json was found.)')
156
- end
157
-
158
- if Dir.pwd == mod_root || context == :pwd
159
- run_process_in_clean_env!
160
- else
161
- Dir.chdir(mod_root) do
162
- run_process_in_clean_env!
163
- end
164
- end
165
- else
166
- run_process!
167
- end
168
-
169
- # Stop spinning when done (if configured).
170
- stop_spinner
171
-
172
- @stdout.rewind
173
- @stderr.rewind
174
-
175
- process_data = {
176
- stdout: @stdout.read,
177
- stderr: @stderr.read,
178
- exit_code: @process.exit_code,
179
- duration: @duration,
180
- }
181
-
182
- return process_data
183
- ensure
184
- @stdout.close
185
- @stderr.close
186
- end
187
-
188
- protected
189
-
190
- def stop_spinner
191
- return unless @spinner
192
-
193
- # If it is a single spinner, we need to send it a success/error message
194
- if @process.exit_code.zero?
195
- @spinner.success(@success_message || '')
196
- else
197
- @spinner.error(@failure_message || '')
198
- end
199
- end
200
-
201
- def run_process_in_clean_env!
202
- ::Bundler.with_clean_env do
203
- run_process!
204
- end
205
- end
206
-
207
- def run_process!
208
- command_string = argv.join(' ')
209
-
210
- PDK.logger.debug(_("Executing '%{command}'") % { command: command_string })
211
-
212
- if context == :module
213
- PDK.logger.debug(_('Command environment:'))
214
- @process.environment.each do |var, val|
215
- PDK.logger.debug(" #{var}: #{val}")
216
- end
217
- end
218
-
219
- start_time = Time.now
220
-
221
- begin
222
- @process.start
223
- rescue ChildProcess::LaunchError => e
224
- raise PDK::CLI::FatalError, _("Failed to execute '%{command}': %{message}") % { command: command_string, message: e.message }
225
- end
226
-
227
- if timeout
228
- begin
229
- @process.poll_for_exit(timeout)
230
- rescue ChildProcess::TimeoutError
231
- @process.stop # tries increasingly harsher methods to kill the process.
232
- end
233
- else
234
- # Wait indfinitely if no timeout set.
235
- @process.wait
236
- end
237
-
238
- @duration = Time.now - start_time
239
-
240
- PDK.logger.debug(_("Execution of '%{command}' complete (duration: %{duration_in_seconds}s; exit code: %{exit_code})") %
241
- { command: command_string, duration_in_seconds: @duration, exit_code: @process.exit_code })
242
- end
243
- end
244
76
  end
245
77
  end
246
78
  end
@@ -0,0 +1,238 @@
1
+ module PDK
2
+ module CLI
3
+ module Exec
4
+ class Command
5
+ attr_reader :argv
6
+ attr_reader :context
7
+ attr_accessor :timeout
8
+ attr_accessor :environment
9
+ attr_writer :exec_group
10
+
11
+ def initialize(*argv)
12
+ require 'childprocess'
13
+ require 'tempfile'
14
+
15
+ @argv = argv
16
+
17
+ @process = ChildProcess.build(*@argv)
18
+ @process.leader = true
19
+
20
+ @stdout = Tempfile.new('stdout').tap { |io| io.sync = true }
21
+ @stderr = Tempfile.new('stderr').tap { |io| io.sync = true }
22
+
23
+ @process.io.stdout = @stdout
24
+ @process.io.stderr = @stderr
25
+
26
+ # Default to running things in the system context.
27
+ @context = :system
28
+
29
+ # Extra environment vars to add to base set.
30
+ @environment = {}
31
+
32
+ # Register the ExecGroup when running in parallel
33
+ @exec_group = nil
34
+ end
35
+
36
+ def context=(new_context)
37
+ unless [:system, :module, :pwd].include?(new_context)
38
+ raise ArgumentError, _("Expected execution context to be :system or :module but got '%{context}'.") % { context: new_context }
39
+ end
40
+
41
+ @context = new_context
42
+ end
43
+
44
+ def register_spinner(spinner, opts = {})
45
+ require 'pdk/cli/util'
46
+
47
+ return unless PDK::CLI::Util.interactive?
48
+ @success_message = opts.delete(:success)
49
+ @failure_message = opts.delete(:failure)
50
+
51
+ @spinner = spinner
52
+ end
53
+
54
+ def add_spinner(message, opts = {})
55
+ require 'pdk/cli/util'
56
+
57
+ return unless PDK::CLI::Util.interactive?
58
+ @success_message = opts.delete(:success)
59
+ @failure_message = opts.delete(:failure)
60
+
61
+ require 'pdk/cli/util/spinner'
62
+
63
+ @spinner = TTY::Spinner.new("[:spinner] #{message}", opts.merge(PDK::CLI::Util.spinner_opts_for_platform))
64
+ end
65
+
66
+ def update_environment(additional_env)
67
+ @environment.merge!(additional_env)
68
+ end
69
+
70
+ def execute!
71
+ # Start spinning if configured.
72
+ @spinner.auto_spin if @spinner
73
+
74
+ # Set env for child process
75
+ resolved_env_for_command.each { |k, v| @process.environment[k] = v }
76
+
77
+ if [:module, :pwd].include?(context)
78
+ require 'pdk/util'
79
+ mod_root = PDK::Util.module_root
80
+
81
+ unless mod_root
82
+ @spinner.error if @spinner
83
+
84
+ raise PDK::CLI::FatalError, _('Current working directory is not part of a module. (No metadata.json was found.)')
85
+ end
86
+
87
+ if Dir.pwd == mod_root || context == :pwd
88
+ run_process_in_clean_env!
89
+ else
90
+ Dir.chdir(mod_root) do
91
+ run_process_in_clean_env!
92
+ end
93
+ end
94
+ else
95
+ run_process!
96
+ end
97
+
98
+ # Stop spinning when done (if configured).
99
+ stop_spinner
100
+
101
+ @stdout.rewind
102
+ @stderr.rewind
103
+
104
+ process_data = {
105
+ stdout: @stdout.read,
106
+ stderr: @stderr.read,
107
+ exit_code: @process.exit_code,
108
+ duration: @duration,
109
+ }
110
+
111
+ PDK.logger.debug _('STDOUT: %{output}') % {
112
+ output: process_data[:stdout].empty? ? 'N/A' : "\n#{process_data[:stdout]}",
113
+ }
114
+ PDK.logger.debug _('STDERR: %{output}') % {
115
+ output: process_data[:stderr].empty? ? 'N/A' : "\n#{process_data[:stderr]}",
116
+ }
117
+
118
+ process_data
119
+ ensure
120
+ @stdout.close
121
+ @stderr.close
122
+ end
123
+
124
+ protected
125
+
126
+ def warn_on_legacy_env_vars!
127
+ if ENV['PUPPET_GEM_VERSION']
128
+ PDK.logger.warn_once _(
129
+ 'PUPPET_GEM_VERSION is not supported by PDK. ' \
130
+ 'Use the --puppet-version option on your PDK command ' \
131
+ 'or set the PDK_PUPPET_VERSION environment variable instead',
132
+ )
133
+ end
134
+
135
+ %w[FACTER HIERA].each do |gem|
136
+ if ENV["#{gem}_GEM_VERSION"]
137
+ PDK.logger.warn_once _('%{varname} is not supported by PDK.') % { varname: "#{gem}_GEM_VERSION" }
138
+ end
139
+ end
140
+ end
141
+
142
+ def resolved_env_for_command
143
+ warn_on_legacy_env_vars!
144
+
145
+ resolved_env = {}
146
+
147
+ resolved_env['TERM'] = ENV['TERM']
148
+ resolved_env['PUPPET_GEM_VERSION'] = nil
149
+ resolved_env['FACTER_GEM_VERSION'] = nil
150
+ resolved_env['HIERA_GEM_VERSION'] = nil
151
+
152
+ resolved_env.merge!(@environment.dup)
153
+
154
+ resolved_env['BUNDLE_IGNORE_CONFIG'] = '1'
155
+
156
+ if [:module, :pwd].include?(context)
157
+ require 'pdk/util'
158
+ require 'pdk/util/git'
159
+ require 'pdk/util/ruby_version'
160
+
161
+ resolved_env['GEM_HOME'] = PDK::Util::RubyVersion.gem_home
162
+ resolved_env['GEM_PATH'] = PDK::Util::RubyVersion.gem_path
163
+
164
+ # Make sure invocation of Ruby prefers our private installation.
165
+ package_binpath = PDK::Util.package_install? ? File.join(PDK::Util.pdk_package_basedir, 'bin') : nil
166
+
167
+ resolved_env['PATH'] = [
168
+ PDK::Util::RubyVersion.bin_path,
169
+ File.join(resolved_env['GEM_HOME'], 'bin'),
170
+ PDK::Util::RubyVersion.gem_paths_raw.map { |gem_path| File.join(gem_path, 'bin') },
171
+ package_binpath,
172
+ PDK::Util.package_install? ? PDK::Util::Git.git_paths : nil,
173
+ ENV['PATH'],
174
+ ].compact.flatten.join(File::PATH_SEPARATOR)
175
+ end
176
+
177
+ resolved_env
178
+ end
179
+
180
+ def stop_spinner
181
+ return unless @spinner
182
+
183
+ # If it is a single spinner, we need to send it a success/error message
184
+ if @process.exit_code.zero?
185
+ @spinner.success(@success_message || '')
186
+ else
187
+ @spinner.error(@failure_message || '')
188
+ end
189
+ end
190
+
191
+ def run_process_in_clean_env!
192
+ require 'bundler'
193
+
194
+ ::Bundler.with_clean_env do
195
+ run_process!
196
+ end
197
+ end
198
+
199
+ def run_process!
200
+ command_string = argv.join(' ')
201
+
202
+ PDK.logger.debug(_("Executing '%{command}'") % { command: command_string })
203
+
204
+ if context == :module
205
+ PDK.logger.debug(_('Command environment:'))
206
+ @process.environment.each do |var, val|
207
+ PDK.logger.debug(" #{var}: #{val}")
208
+ end
209
+ end
210
+
211
+ start_time = Time.now
212
+
213
+ begin
214
+ @process.start
215
+ rescue ChildProcess::LaunchError => e
216
+ raise PDK::CLI::FatalError, _("Failed to execute '%{command}': %{message}") % { command: command_string, message: e.message }
217
+ end
218
+
219
+ if timeout
220
+ begin
221
+ @process.poll_for_exit(timeout)
222
+ rescue ChildProcess::TimeoutError
223
+ @process.stop # tries increasingly harsher methods to kill the process.
224
+ end
225
+ else
226
+ # Wait indfinitely if no timeout set.
227
+ @process.wait
228
+ end
229
+
230
+ @duration = Time.now - start_time
231
+
232
+ PDK.logger.debug(_("Execution of '%{command}' complete (duration: %{duration_in_seconds}s; exit code: %{exit_code})") %
233
+ { command: command_string, duration_in_seconds: @duration, exit_code: @process.exit_code })
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end