Class: Vagabond::Knife
- Inherits:
-
Object
- Object
- Vagabond::Knife
- Includes:
- Helpers
- Defined in:
- lib/vagabond/knife.rb
Instance Attribute Summary collapse
-
#name_args ⇒ Object
readonly
Returns the value of attribute name_args.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(name, name_args) ⇒ Knife
constructor
A new instance of Knife.
Constructor Details
#initialize(name, name_args) ⇒ Knife
Returns a new instance of Knife.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagabond/knife.rb', line 10 def initialize(name, name_args) @name_args = name_args @vagabondfile = Vagabondfile.new(Config[:vagabond_file]) Config[:disable_solo] = true Config[:sudo] = sudo Lxc.use_sudo = @vagabondfile[:sudo].nil? ? true : @vagabondfile[:sudo] @internal_config = InternalConfiguration.new(@vagabondfile, nil) 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] = " -s https://#{srv.container_ip(10, true)}" else Config[:knife_opts] = ' -s https://no-local-server' end end end end |
Instance Attribute Details
#name_args ⇒ Object (readonly)
Returns the value of attribute name_args.
8 9 10 |
# File 'lib/vagabond/knife.rb', line 8 def name_args @name_args end |
Instance Method Details
#execute ⇒ Object
30 31 32 |
# File 'lib/vagabond/knife.rb', line 30 def execute exec("knife #{name_args.join(' ')} #{Config[:knife_opts]}") end |