Sha256: cf549a449e5bc86fc22609611a1f214e62f8d792cb4533e9aed21066451fa8fe
Contents?: true
Size: 1.69 KB
Versions: 45
Compression:
Stored size: 1.69 KB
Contents
module Onering module CLI module Automation def self.configure(global={}) @requests = Onering::CLI.connect(global).automation_requests @jobs = Onering::CLI.connect(global).automation_jobs @tasks = Onering::CLI.connect(global).automation_tasks end def self.run(args) sc = args.shift # subcommand ssc = args.shift # sub-subcommand case (sc.downcase.to_sym rescue nil) # ----------------------------------------------------------------------------- when :requests @opts = ::Trollop::options do banner <<-EOS Options: EOS stop_on %w{show status requeue flush purge} end case (ssc.downcase.to_sym rescue nil) when :show return @requests.show(args[0]) when :requeue return @requests.requeue_all_failed() if args[0].nil? return @requests.requeue(args[0]) when :status fields = (args.empty? ? ["status"] : args) rv = {} out = @requests.summary(fields) _rejigger_hash = Proc.new do |h| [*h].collect{|i| [i['id'], (i['children'].nil? ? i['count'] : Hash[_rejigger_hash.call(i['children'])])] } end return Hash[_rejigger_hash.call(out)] when :flush return @requests.flush_queue() when :purge return @requests.purge() end # ----------------------------------------------------------------------------- when :jobs # ----------------------------------------------------------------------------- when :tasks end end end end end
Version data entries
45 entries across 45 versions & 1 rubygems