Skip to content

Commit

Permalink
add cloud:vm:terminate rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
vlewin committed Apr 3, 2014
1 parent 2d337bb commit 28d48a9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ require_relative 'jenkins/cloud_vm.rb'

namespace :cloud do
namespace :vm do
desc 'Start new VM instance on cloud.suse.de; Optional parameter: name'
task :start, :name do |t, args|
args.has_key?(:name) ? Cloud::VM.start(args[:name]) : Cloud::VM.start
desc 'Creates and starts new VM instance on cloud.suse.de; Optional parameter: name'
task :create, :name do |t, args|
server = args.has_key?(:name) ? Cloud::VM.create(args[:name]) : Cloud::VM.create

# Store VM id in the environment variable so the jenkins can access it
ENV['CLOUD_VM_ID'] = server.id
end

desc 'Terminate VM instance on cloud.suse.de; Required parameter: name'
task :terminate, :name do |t, args|
if args.has_key?(:name)
Cloud::VM.destroy(args[:name])
else
puts 'Please specify the name of the virtual machine'
end
end
end
end

0 comments on commit 28d48a9

Please sign in to comment.