vagrant-lxc-ng/lib/vagrant-lxc/action/create.rb

29 lines
642 B
Ruby
Raw Normal View History

module Vagrant
module LXC
module Action
2013-04-02 00:05:19 +00:00
class Create
def initialize(app, env)
@app = app
end
def call(env)
2013-11-06 23:06:25 +00:00
container_name = "#{env[:root_path].basename}_#{env[:machine].name}"
container_name.gsub!(/[^-a-z0-9_]/i, "")
container_name << "-#{Time.now.to_i}"
env[:machine].provider.driver.create(
container_name,
env[:lxc_template_src],
env[:lxc_template_config],
env[:lxc_template_opts]
)
env[:machine].id = container_name
@app.call env
end
end
end
end
end