lib/mccloud/command/provision.rb in mccloud-0.0.13 vs lib/mccloud/command/provision.rb in mccloud-0.0.14

- old
+ new

@@ -1,31 +1,17 @@ -require 'net/scp' - module Mccloud module Command + class ProvisionCommand < Base - def provision(selection=nil,options=nil) - on_selected_machines(selection) do |id,vm| - - instance=vm.instance - instance.private_key_path=vm.private_key - instance.username = vm.user - - #p vm.provisioner - provisioner=@session.config.provisioners[vm.provisioner.to_s] - if provisioner.nil? - # We take the first provisioner defined - #provisioner=@session.config.provisioners.first[1] - else - puts "Starting provisioning on #{vm.name} with #{vm.provisioner} as provisioner" - provisioner.run(vm) + argument :box_name, :type => :string, :optional => false, :default => nil + + register "provision [NAME]", "Provisions the machine" + + def execute + env.config.providers.each do |name,provider| + env.logger.debug("Asking provider #{name} to provision box #{box_name}") + provider.provision(box_name,options) end end - ##on_selected_machines(selection) do |id,vm| - #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,"who am i") - #end end - end -end \ No newline at end of file +end