From a76749a837a2552b72be34d91330f8983f740860 Mon Sep 17 00:00:00 2001 From: elijah Date: Thu, 14 Mar 2013 02:05:58 -0700 Subject: added exit codes for puppet apply --- lib/leap_cli/commands/deploy.rb | 2 +- lib/leap_cli/logger.rb | 5 ++++- lib/leap_cli/util.rb | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb index d7f5df8..76df4fb 100644 --- a/lib/leap_cli/commands/deploy.rb +++ b/lib/leap_cli/commands/deploy.rb @@ -60,7 +60,7 @@ module LeapCli else '' end - ssh.set :puppet_command, "/usr/bin/puppet apply --color=false --tags=#{tags.join(',')} #{verbosity}" + ssh.set :puppet_command, "/usr/bin/puppet apply --color=false --tags=#{tags.join(',')} --detailed-exitcodes #{verbosity}" ssh.set :puppet_lib, "puppet/modules" ssh.set :puppet_parameters, '--libdir puppet/lib --confdir puppet puppet/manifests/site.pp' ssh.set :puppet_stream_output, true diff --git a/lib/leap_cli/logger.rb b/lib/leap_cli/logger.rb index 58aa3c0..e700ee6 100644 --- a/lib/leap_cli/logger.rb +++ b/lib/leap_cli/logger.rb @@ -121,6 +121,8 @@ module LeapCli { :match => /^warning:/, :level => 0, :color => :yellow, :priority => -20}, { :match => /^Duplicate declaration:/, :level => 0, :color => :red, :priority => -20}, { :match => /Finished catalog run/, :level => 0, :color => :green, :priority => -10}, + { :match => /^Puppet apply complete \(changes made\)/, :level => 0, :color => :green, :priority => -10}, + { :match => /^Puppet apply complete \(no changes\)/, :level => 0, :color => :green, :priority => -10}, # PUPPET FATAL ERRORS { :match => /^err:/, :level => 0, :color => :red, :priority => -1, :exit => 1}, @@ -128,7 +130,8 @@ module LeapCli { :match => /^Parameter matches failed:/, :level => 0, :color => :red, :priority => -1, :exit => 1}, { :match => /^Syntax error/, :level => 0, :color => :red, :priority => -1, :exit => 1}, { :match => /^Cannot reassign variable/, :level => 0, :color => :red, :priority => -1, :exit => 1}, - { :match => /^Could not find template/, :level => 0, :color => :red, :priority => -1, :exit => 1} + { :match => /^Could not find template/, :level => 0, :color => :red, :priority => -1, :exit => 1}, + { :match => /^Puppet apply complete.*fail/, :level => 0, :color => :red, :priority => -1, :exit => 1} ] def self.sorted_formatters diff --git a/lib/leap_cli/util.rb b/lib/leap_cli/util.rb index 155796f..0453b6d 100644 --- a/lib/leap_cli/util.rb +++ b/lib/leap_cli/util.rb @@ -12,8 +12,9 @@ module LeapCli ## QUITTING ## - def exit_status(code) - @exit_status = code + def exit_status(code=nil) + @exit_status = code if code + @exit_status end # -- cgit v1.2.3