Sha256: dea139ee5293575f5c94e727a7be1fd839d9cadddebe466a6df0a59a3dd7a4e2
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
require 'elecksee/ephemeral' module Vagabond module Actions module Create def _create name_required! if(lxc.exists?) ui.warn "Node already exists: #{name}" unless name == 'server' _start else ui.info "#{ui.color('Vagabond:', :bold)} Creating #{ui.color(name, :green)}" do_create ui.info ui.color(' -> CREATED!', :green) end end private def do_create tmpl = config[:template] if(internal_config[:template_mappings].keys.include?(tmpl)) tmpl = internal_config[:template_mappings][tmpl] elsif(!BASE_TEMPLATES.include?(tmpl)) ui.fatal "Template requested for node does not exist: #{tmpl}" raise VagabondError::InvalidTemplate.new(tmpl) end unless(config[:device]) config[:directory] = true end config[:daemon] = true config[:original] = tmpl config[:bind] = File.expand_path(File.dirname(vagabondfile.store_path)) ephemeral = Lxc::Ephemeral.new(config) ephemeral.start!(:fork) e_name = ephemeral.name @internal_config[mappings_key][name] = e_name @internal_config.save @lxc = Lxc.new(e_name) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vagabond-0.2.4 | lib/vagabond/actions/create.rb |
vagabond-0.2.2 | lib/vagabond/actions/create.rb |