Module: Knife::Clc::Base
- Included in:
- Chef::Knife::ClcServerCreate
- Defined in:
- lib/knife-clc/base.rb,
lib/knife-clc/base/config_options.rb
Defined Under Namespace
Classes: ConfigOptions
Class Method Summary collapse
Instance Method Summary collapse
- #connection ⇒ Object
- #context ⇒ Object
- #errors ⇒ Object
- #execute ⇒ Object
- #parse_and_validate_parameters ⇒ Object
- #run ⇒ Object
- #show_errors ⇒ Object
Class Method Details
.included(command_class) ⇒ Object
10 11 12 |
# File 'lib/knife-clc/base.rb', line 10 def self.included(command_class) ConfigOptions.attach(command_class) end |
Instance Method Details
#connection ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/knife-clc/base.rb', line 14 def connection @connection ||= ::Clc::Client.new( :username => config[:clc_username], :password => config[:clc_password], :endpoint => config[:clc_endpoint], :verbosity => config[:verbosity] ) end |
#context ⇒ Object
23 24 25 |
# File 'lib/knife-clc/base.rb', line 23 def context @context ||= {} end |
#errors ⇒ Object
47 48 49 |
# File 'lib/knife-clc/base.rb', line 47 def errors @errors ||= [] end |
#execute ⇒ Object
44 45 |
# File 'lib/knife-clc/base.rb', line 44 def execute end |
#parse_and_validate_parameters ⇒ Object
41 42 |
# File 'lib/knife-clc/base.rb', line 41 def parse_and_validate_parameters end |
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/knife-clc/base.rb', line 27 def run $stdout.sync = true parse_and_validate_parameters if errors.any? show_errors show_usage exit 1 else execute end end |
#show_errors ⇒ Object
51 52 53 |
# File 'lib/knife-clc/base.rb', line 51 def show_errors errors.each { || ui.error } end |