Sha256: e34ba44efb56ab1615fba6ce3e702b75ead9ea82212ed765653892f4c7b9cc56
Contents?: true
Size: 1.15 KB
Versions: 22
Compression:
Stored size: 1.15 KB
Contents
require 'optparse' class Common def initialize @options = {} end def parse options = {} OptionParser.new do |opt| opt.on("--hostname HOSTNAME", String, "Hostname") { |v| options[:hostname] = v } opt.on("--port PORT", Integer, "Port" ) { |v| options[:port] = v } opt.on("--username USERNAME", String, "Username") { |v| options[:user] = v } opt.on("--password PASSWORD", String, "Password") { |v| options[:password] = v } opt.on("--debug") { ManageIQ::Messaging.logger = Logger.new(STDOUT) } opt.parse! end options[:hostname] ||= ENV["QUEUE_HOSTNAME"] || "localhost" options[:port] ||= ENV["QUEUE_PORT"] || 61616 options[:user] ||= ENV["QUEUE_USER"] || "admin" options[:password] ||= ENV["QUEUE_PASSWORD"] || "smartvm" options[:port] = options[:port].to_i @options = options self end def q_options { :host => @options[:hostname], :port => @options[:port].to_i, :username => @options[:user], :password => @options[:password], :client_ref => "background_example", } end end
Version data entries
22 entries across 22 versions & 1 rubygems