lib/percheron/commands/abstract.rb in percheron-0.7.16 vs lib/percheron/commands/abstract.rb in percheron-0.8.0
- old
+ new
@@ -15,20 +15,28 @@
parameter('UNIT_NAMES', 'unit names', default: [], required: false) do |names|
names.split(/,/)
end
end
- def self.default_create_parameters!
- default_parameters!
- option('--start', :flag, 'Start unit', default: false)
+ def runit
+ yield
+ rescue Docker::Error::UnexpectedResponseError => e
+ $logger.error('')
+ $logger.error('An exception occurred :(')
+ $logger.error('')
+ $logger.error(e.inspect)
end
def execute
stack.valid?
+ rescue Errno::ENOENT, Errors::ConfigFileInvalid, Errors::StackInvalid => e
+ signal_usage_error(e.message)
+ exit(1)
rescue => e
puts "%s\n\n%s\n\n" % [ e.inspect, e.backtrace.join("\n") ]
signal_usage_error(e.message)
+ exit(1)
end
def stack
return NullStack.new if stack_name.nil?
Percheron::Stack.new(config, stack_name)
@@ -38,12 +46,9 @@
@config ||= begin
Percheron::Config.load!(config_file).tap do |c|
Percheron::Connection.load!(c)
end
end
- rescue Errors::ConfigFileInvalid => e
- $logger.error e.inspect
- exit(1)
end
end
end
end