Sha256: 7a7983478fa90c67a0a609f7cf2ee40dec6862851b3619508b78ae0ca8994456
Contents?: true
Size: 1.2 KB
Versions: 20
Compression:
Stored size: 1.2 KB
Contents
module LitmusPaper module CLI class Admin class Force < Command def self.description "Force services up or down" end def self.build_request(options, args) options.merge! _default_options opt_parser = _extend_default_parser(options) do |opts| opts.banner = "Usage: litmusctl force <up|down> [service] [options]" opts.on("-d", "--delete", "Remove status file") do options[:delete] = true end opts.on("-r", "--reason=reason", String, "Reason for status file") do |reason| options[:reason] = reason end end opt_parser.parse! args direction, service = args path = service ? "/#{service}/#{direction}" : "/#{direction}" if options[:delete] request = Net::HTTP::Delete.new(path) else if !options.has_key?(:reason) print "Reason? " options[:reason] = STDIN.gets.chomp end request = Net::HTTP::Post.new(path) request.set_form_data('reason' => options[:reason]) end request end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems