class Nucleon::Extension::Vagrant

Public Instance Methods

network_new_node_config(config) click to toggle source
   # File lib/nucleon/extension/vagrant.rb
 6 def network_new_node_config(config)
 7   plugin   = config[:plugin]
 8   provider = plugin.plugin_provider
 9 
10   if provider == :vagrant
11     image_name   = string(config.delete(:image))
12     machine_type = symbol(config.delete(:machine_type))
13     hostname     = string(config[:hostname])
14 
15     public_ip    = string(config.delete(:public_ip))
16 
17     case machine_type
18     when :docker
19       config.set([ :vm, :providers, :docker, :image ], image_name)
20     else
21       config.set([ :vm, :providers, machine_type, :private_network ], public_ip) if public_ip
22       config.set([ :vm, :providers, machine_type, :override, :vm, :box ], image_name)
23     end
24 
25     config.set([ :vm, :providers, :docker, :create_args ], [ "--hostname='#{hostname}'" ])
26   end
27 end