Sha256: 5787e6c75f77be478575155fce2e33bad8fd2ca95c01484a9882be72eb890bb0

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

module Vagabond
  module Actions
    module Create
      def create
        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
        com = "#{sudo}lxc-start-ephemeral -d -o #{config[:template]}"
        debug(com)
        c = Mixlib::ShellOut.new("#{com} && sleep 3", :live_stream => Config[:debug])
        c.run_command
        e_name = c.stdout.split("\n").last.split(' ').last.strip
        @internal_config[:mappings][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.1.4 lib/vagabond/actions/create.rb
vagabond-0.1.2 lib/vagabond/actions/create.rb