lib/right_chimp/Chimp.rb in right_chimp-1.0.9 vs lib/right_chimp/Chimp.rb in right_chimp-1.1.0

- old
+ new

@@ -2,11 +2,11 @@ # The Chimp class encapsulates the command-line program logic # module Chimp class Chimp - attr_accessor :concurrency, :delay, :retry_count, :progress, :prompt, + attr_accessor :concurrency, :delay, :retry_count, :hold, :progress, :prompt, :quiet, :use_chimpd, :chimpd_host, :chimpd_port, :tags, :array_names, :deployment_names, :script, :servers, :ssh, :report, :interactive, :action, :limit_start, :limit_end, :dry_run, :group, :job_id, :verify # @@ -32,10 +32,11 @@ # Job control options # @concurrency = 1 @delay = 0 @retry_count = 0 + @hold = false @timeout = 900 @limit_start = 0 @limit_end = 0 @@ -203,10 +204,11 @@ [ '--quiet', '-q', GetoptLong::NO_ARGUMENT ], [ '--noprompt', '-z', GetoptLong::NO_ARGUMENT ], [ '--concurrency', '-c', GetoptLong::REQUIRED_ARGUMENT ], [ '--delay', '-d', GetoptLong::REQUIRED_ARGUMENT ], [ '--retry', '-y', GetoptLong::REQUIRED_ARGUMENT ], + [ '--hold', '-7', GetoptLong::NO_ARGUMENT ], [ '--dry-run', '-n', GetoptLong::NO_ARGUMENT ], [ '--limit', '-l', GetoptLong::REQUIRED_ARGUMENT ], [ '--version', '-1', GetoptLong::NO_ARGUMENT ], [ '--chimpd', '-f', GetoptLong::OPTIONAL_ARGUMENT ], [ '--chimpd-wait-until-done', '-j', GetoptLong::NO_ARGUMENT ], @@ -280,10 +282,12 @@ @prompt = false when '--concurrency', '-c' @concurrency = arg.to_i when '--delay', '-d' @delay = arg.to_i + when '--hold', '-7' + @hold = true when '--retry', '-y' @retry_count = arg.to_i when '--limit', '-l' @limit_start, @limit_end = arg.split(',') when '--verbose', '-v' @@ -476,11 +480,11 @@ # # If we have a script name but no template, check # each server for the script until we locate it. # if script and template == nil - Log.debug "getting template URI..." + Log.debug "Getting template URI..." if not servers.empty? for i in (0..servers.size - 1) template = servers[i]['server_template_href'] if not servers[i].empty? @@ -586,11 +590,11 @@ script_data = {} script_data[ 'name' ] = script_obj.params['name'] script = ::RightScript.new({ :href => script_URI, :right_script => script_data }) end else - Log.debug "looking for script \"#{script}\"" + Log.debug "Looking for script \"#{script}\"" script = st.executables.detect { |ex| ex.name =~ /#{script}/ } end if script != nil and script['right_script'] != nil puts "RightScript: \"#{script['right_script']['name']}\"" if @interactive @@ -719,10 +723,12 @@ end if e != nil e.dry_run = @dry_run e.quiet = @@quiet + e.status = Executor::STATUS_HOLDING if @hold + tasks.push(e) end end @@ -1162,9 +1168,10 @@ puts " --version display version and exit" puts puts "chimpd options:" puts " --chimpd=<port> send jobs to chimpd listening on <port> on localhost" puts " --chimpd-wait-until-done wait until all chimpd jobs are done" + puts " --hold create a job in chimpd without executing until requested" puts puts "Misc Notes:" puts " * If you leave the name of a --script or --ssh command blank, chimp will prompt you" puts " * You cannot operate on array instances by selecting them with tag queries" puts " * URIs must be API URIs in the format https://my.rightscale.com/api/acct/<acct>/ec2_server_templates/<id>"