2013-03-03 05:24:05 +00:00
|
|
|
module Vagrant
|
|
|
|
module LXC
|
|
|
|
module Action
|
2013-04-02 00:05:19 +00:00
|
|
|
class Create
|
|
|
|
def initialize(app, env)
|
|
|
|
@app = app
|
|
|
|
end
|
|
|
|
|
2013-03-03 05:24:05 +00:00
|
|
|
def call(env)
|
2013-03-29 05:17:34 +00:00
|
|
|
base_name = env[:root_path].basename.to_s
|
|
|
|
base_name.gsub!(/[^-a-z0-9_]/i, "")
|
|
|
|
|
2013-03-29 15:24:37 +00:00
|
|
|
target_rootfs_path = env[:machine].provider_config.target_rootfs_path
|
|
|
|
|
2013-04-05 05:23:30 +00:00
|
|
|
machine_id = env[:machine].provider.driver.create(base_name, target_rootfs_path, env[:machine].box.metadata)
|
2013-03-03 05:24:05 +00:00
|
|
|
env[:machine].id = machine_id
|
|
|
|
env[:just_created] = true
|
|
|
|
@app.call env
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|