Sha256: 49c8b7ab83a0252afb1c56bb126fa3ade6822d0ca9528678e69201887a517066

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'pp'
module Mccloud
  module Command
    def bootstrap(selection=nil,command="who am i",options=nil)
      
      on_selected_machines(selection) do |id,vm|
        puts "bootstrap #{selection} "
        server=vm.instance
        server.private_key_path=vm.private_key
        server.username = vm.user
        if server.state == "running"
          puts "Uploading bootstrap code to machine #{vm.name}"
          unless !File.exists?(vm.bootstrap)
            server.scp(vm.bootstrap,"/tmp/bootstrap.sh")
            puts "Enabling the bootstrap code to run"
            result=server.ssh("chmod +x /tmp/bootstrap.sh")
          else
            puts "Error: bootstrap file #{vm.bootstrap} does not exist"
            exit -1
          end
        else
          puts "server is not running, so bootstrapping will do no good"
        end
        #instance=PROVIDER.servers.get(id)
        #options={ :port => 22, :keys => [ vm.key ], :paranoid => false, :keys_only => true}
        #Mccloud::Ssh.execute(instance.public_ip_address,vm.user,options,"sudo /tmp/bootstrap.sh")
      end
      multi(selection,"/tmp/bootstrap.sh",options.merge({ "sudo" => true}))
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mccloud-0.0.13 lib/mccloud/command/bootstrap.rb
mccloud-0.0.12 lib/mccloud/command/bootstrap.rb