Class: PuppetLocal::Command
- Inherits:
-
Clamp::Command
- Object
- Clamp::Command
- PuppetLocal::Command
- Includes:
- Term::ANSIColor
- Defined in:
- lib/puppet_local/command.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Install
Instance Method Summary collapse
Instance Method Details
#run(arguments) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/puppet_local/command.rb', line 19 def run(arguments) begin super rescue Exception => e $stderr.print on_red ' ' $stderr.print bold ' Error: ' if e..empty? $stderr.puts 'Unknown error/Interrupt' else $stderr.puts e. end exit 1 end end |
#system_command(command, options = {}) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/puppet_local/command.rb', line 6 def system_command(command, ={}) .each do |name, value| command += ' ' if value.is_a? String command += name + ' ' + Shellwords.escape(value) elsif value.is_a? TrueClass command += name end end system command raise 'Puppet apply failed' unless $?.success? end |