scripts/cloud_controller.rb in right_link-5.9.1 vs scripts/cloud_controller.rb in right_link-5.9.2
- old
+ new
@@ -1,7 +1,7 @@
# === Synopsis:
-# RightScale Cloud Controller (cloud) - Copyright (c) 2011 by RightScale Inc
+# RightScale Cloud Controller (cloud) - Copyright (c) 2013 by RightScale Inc
#
# cloud is a command line tool which invokes cloud-specific actions
#
# === Examples:
# Write cloud and user metadata to cache directory using default cloud:
@@ -35,14 +35,16 @@
require 'right_agent'
require 'right_agent/scripts/usage'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'instance', 'agent_config'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'clouds', 'register_clouds'))
+require File.expand_path(File.join(File.dirname(__FILE__), 'command_helper'))
module RightScale
class CloudController
+ include CommandHelper
# Convenience wrapper
def self.run
controller = CloudController.new
controller.control(controller.parse_args)
@@ -119,23 +121,24 @@
opt :only_if
opt :parameters, "",:type => :string
opt :quiet # note that :quiet is deprecated (use -v instead) because Trollop cannot easily support inverse flags that default to true
opt :verbose
end
- begin
+ parse do
options = parser.parse
if options[:parameters_given]
if options[:parameters].start_with?("[")
options[:parameters] = JSON.parse(options[:parameters])
else
options[:parameters] = [options[:parameters]]
end
end
options
- rescue Trollop::HelpNeeded
- puts Usage.scan(__FILE__)
- exit 0
end
+ end
+
+ def usage
+ Usage.scan(__FILE__)
end
# Default logger for printing to console
def default_logger(verbose)
if verbose