lib/right_chimp/Chimp.rb in right_chimp-2.1.12 vs lib/right_chimp/Chimp.rb in right_chimp-2.1.13
- old
+ new
@@ -1,14 +1,13 @@
#The Chimp class encapsulates the command-line program logic
#
module Chimp
class Chimp
-
attr_accessor :concurrency, :delay, :retry_count, :hold, :progress, :prompt,
:quiet, :use_chimpd, :chimpd_host, :chimpd_port, :tags, :array_names,
:deployment_names, :script, :all_scripts, :servers, :ssh, :report, :interactive, :action,
- :limit_start, :limit_end, :dry_run, :group, :job_id, :job_uuid, :verify, :cli_args
+ :limit_start, :limit_end, :dry_run, :group, :job_id, :job_uuid, :job_note, :verify, :cli_args
#
# These class variables control verbosity
#
@@verbose = false
@@quiet = false
@@ -257,11 +256,11 @@
if not (@servers.empty? )
if (@script != nil)
# If script is an uri/url no need to "detect it"
# https://my.rightscale.com/acct/9202/right_scripts/205347
if @script =~ /\A#{URI::regexp}\z/
- if not @use_chimpd
+ if not @use_chimpd || !@prompt
puts "=================================================="
puts "WARNING! You will be running this script on all "
puts "server matches! (Press enter to continue)"
puts "=================================================="
gets
@@ -331,11 +330,12 @@
[ '--group-type', '-2', GetoptLong::REQUIRED_ARGUMENT ],
[ '--group-concurrency', '-3', GetoptLong::REQUIRED_ARGUMENT ],
[ '--timing-log', '-4', GetoptLong::REQUIRED_ARGUMENT ],
[ '--timeout', '-5', GetoptLong::REQUIRED_ARGUMENT ],
[ '--noverify', '-6', GetoptLong::NO_ARGUMENT ],
- [ '--exact-matching', '-8', GetoptLong::NO_ARGUMENT ]
+ [ '--exact-matching', '-8', GetoptLong::NO_ARGUMENT ],
+ [ '--job-notes', '-k', GetoptLong::OPTIONAL_ARGUMENT ]
)
opts.each do |opt, arg|
case opt
when '--help', '-h'
@@ -426,10 +426,12 @@
@group = arg.to_sym
when '--group-type'
@group_type = arg.to_sym
when '--group-concurrency'
@group_concurrency = arg.to_i
+ when '--job-notes'
+ @job_notes = arg
when '--timing-log'
@timing_log = arg
when '--timeout'
@timeout = arg
when '--noverify'
@@ -902,10 +904,11 @@
if queue_executable
e = ExecRightScript.new(
:server => s,
:exec => queue_executable,
:job_uuid => @job_uuid,
+ :job_notes => @job_notes,
:inputs => @inputs,
:timeout => @timeout,
:verbose => @@verbose,
:quiet => @@quiet
)
@@ -1025,11 +1028,11 @@
if result[:status] == :error
name = result[:host] || "unknown"
message = result[:error].to_s || "unknown"
message.sub!("\n", "")
failed_workers << result[:worker]
- results_display << "#{name.ljust(40)} #{message}"
+ results_display << "#{name[0..40]} >> #{message}"
end
end
return [failed_workers, results_display]
end
@@ -1251,10 +1254,10 @@
puts "=================================================="
i = 0
items.sort.each do |item|
i += 1
- puts " %03d. #{item}" % i
+ puts "%03d.#{item}" % i
end
puts "=================================================="
if confirm