diff --git a/lib/vagrant-lxc/action/create.rb b/lib/vagrant-lxc/action/create.rb index 25a7513..569cf28 100644 --- a/lib/vagrant-lxc/action/create.rb +++ b/lib/vagrant-lxc/action/create.rb @@ -25,7 +25,11 @@ module Vagrant end driver = env[:machine].provider.driver template_options = env[:lxc_template_opts] - if ! driver.supports_new_config_format + if driver.supports_new_config_format + if env[:lxc_box_config] + driver.update_config_keys(env[:lxc_box_config]) + end + else template_options['--oldconfig'] = '' end driver.create( diff --git a/lib/vagrant-lxc/action/handle_box_metadata.rb b/lib/vagrant-lxc/action/handle_box_metadata.rb index 6d78800..10581b7 100644 --- a/lib/vagrant-lxc/action/handle_box_metadata.rb +++ b/lib/vagrant-lxc/action/handle_box_metadata.rb @@ -33,8 +33,10 @@ module Vagrant end if template_config_file.exist? + @env[:lxc_box_config] = template_config_file.to_s @env[:lxc_template_opts].merge!('--config' => template_config_file.to_s) elsif old_template_config_file.exist? + @env[:lxc_box_config] = old_template_config_file.to_s @env[:lxc_template_config] = old_template_config_file.to_s end diff --git a/lib/vagrant-lxc/driver.rb b/lib/vagrant-lxc/driver.rb index 58a6474..1c1a024 100644 --- a/lib/vagrant-lxc/driver.rb +++ b/lib/vagrant-lxc/driver.rb @@ -249,8 +249,9 @@ module Vagrant write_config(contents) end - def update_config_keys - @cli.update_config(config_path) + def update_config_keys(path = nil) + path = path || config_path + @cli.update_config(path) rescue Errors::ExecuteError # not on LXC 2.1+. Doesn't matter, ignore. end