Class: Vagabond::Vagabond
- Inherits:
-
Object
- Object
- Vagabond::Vagabond
- Includes:
- Helpers
- Defined in:
- lib/vagabond/vagabond.rb
Class Attribute Summary collapse
-
.ui ⇒ Object
Returns the value of attribute ui.
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#internal_config ⇒ Object
readonly
Returns the value of attribute internal_config.
-
#lxc ⇒ Object
readonly
Returns the value of attribute lxc.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ui ⇒ Object
readonly
Returns the value of attribute ui.
-
#vagabondfile ⇒ Object
readonly
Returns the value of attribute vagabondfile.
Instance Method Summary collapse
-
#initialize(action, name_args) ⇒ Vagabond
constructor
- action
- Action to perform name
- Name of vagabond config
-
Hash configuration.
- #load_configurations ⇒ Object
Constructor Details
#initialize(action, name_args) ⇒ Vagabond
- action
-
Action to perform
- name
-
Name of vagabond
- config
-
Hash configuration
Creates an instance
42 43 44 45 46 47 48 |
# File 'lib/vagabond/vagabond.rb', line 42 def initialize(action, name_args) setup_ui @action = action @name = name_args.shift load_configurations validate! end |
Class Attribute Details
.ui ⇒ Object
Returns the value of attribute ui.
21 22 23 |
# File 'lib/vagabond/vagabond.rb', line 21 def ui @ui end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
33 34 35 |
# File 'lib/vagabond/vagabond.rb', line 33 def config @config end |
#internal_config ⇒ Object (readonly)
Returns the value of attribute internal_config.
34 35 36 |
# File 'lib/vagabond/vagabond.rb', line 34 def internal_config @internal_config end |
#lxc ⇒ Object (readonly)
Returns the value of attribute lxc.
31 32 33 |
# File 'lib/vagabond/vagabond.rb', line 31 def lxc @lxc end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
30 31 32 |
# File 'lib/vagabond/vagabond.rb', line 30 def name @name end |
#ui ⇒ Object (readonly)
Returns the value of attribute ui.
35 36 37 |
# File 'lib/vagabond/vagabond.rb', line 35 def ui @ui end |
#vagabondfile ⇒ Object (readonly)
Returns the value of attribute vagabondfile.
32 33 34 |
# File 'lib/vagabond/vagabond.rb', line 32 def vagabondfile @vagabondfile end |
Instance Method Details
#load_configurations ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vagabond/vagabond.rb', line 50 def load_configurations @vagabondfile = Vagabondfile.new(Config[:vagabond_file]) Config[:sudo] = sudo Config[:disable_solo] = true if @action.to_sym == :status Lxc.use_sudo = @vagabondfile[:sudo].nil? ? true : @vagabondfile[:sudo] @internal_config = InternalConfiguration.new(@vagabondfile, ui) @config = @vagabondfile[:boxes][name] @lxc = Lxc.new(@internal_config[:mappings][name] || '____nonreal____') unless(Config[:disable_local_server]) if(@vagabondfile[:local_chef_server] && @vagabondfile[:local_chef_server][:enabled]) srv = Lxc.new(@internal_config[:mappings][:server]) if(srv.running?) Config[:knife_opts] = " --server-url https://#{srv.container_ip(10, true)}" else ui.warn 'Local chef server is not currently running!' unless @action.to_sym == :status Config[:knife_opts] = ' --server-url https://no-local-server' end end end end |