From 8a3ad76b810181811cb4eccaabcd2fdf2056050d Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 21 Nov 2015 12:26:09 -0800 Subject: [PATCH 1/3] (#17) Add a force option for delete --all --- lib/vmfloaty.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 05a0fad..10d58ec 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -159,6 +159,7 @@ class Vmfloaty c.example 'Schedules the deletion of a host or hosts', 'floaty delete myhost1,myhost2 --url http://vmpooler.example.com' c.option '--verbose', 'Enables verbose output' c.option '--all', 'Deletes all vms acquired by a token' + c.option '--f', 'Does not prompt user when deleting all vms' c.option '--token STRING', String, 'Token for vmpooler' c.option '--url STRING', String, 'URL of vmpooler' c.action do |args, options| @@ -167,6 +168,7 @@ class Vmfloaty token = options.token || config['token'] url = options.url ||= config['url'] delete_all = options.all + force = options.f if delete_all # get vms with token @@ -183,8 +185,14 @@ class Vmfloaty if ! running_vms.nil? Utils.prettyprint_hosts(running_vms, verbose, url) # query y/n - puts "" - ans = agree("Delete all VMs associated with token #{token}? [y/N]") + puts + + if force + ans = true + else + ans = agree("Delete all VMs associated with token #{token}? [y/N]") + end + if ans # delete vms Pooler.delete(verbose, url, running_vms, token) From d4d6010edadf123d534071e48f0d3bff038e817e Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 21 Nov 2015 12:43:32 -0800 Subject: [PATCH 2/3] Make force flag single dash --- lib/vmfloaty.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vmfloaty.rb b/lib/vmfloaty.rb index 10d58ec..1d61733 100644 --- a/lib/vmfloaty.rb +++ b/lib/vmfloaty.rb @@ -159,7 +159,7 @@ class Vmfloaty c.example 'Schedules the deletion of a host or hosts', 'floaty delete myhost1,myhost2 --url http://vmpooler.example.com' c.option '--verbose', 'Enables verbose output' c.option '--all', 'Deletes all vms acquired by a token' - c.option '--f', 'Does not prompt user when deleting all vms' + c.option '-f', 'Does not prompt user when deleting all vms' c.option '--token STRING', String, 'Token for vmpooler' c.option '--url STRING', String, 'URL of vmpooler' c.action do |args, options| From 0cb635a6c738dba3392885af4466016235f19197 Mon Sep 17 00:00:00 2001 From: Brian Cain Date: Sat, 21 Nov 2015 12:44:32 -0800 Subject: [PATCH 3/3] Update to 0.2.18 --- lib/vmfloaty/version.rb | 2 +- vmfloaty.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vmfloaty/version.rb b/lib/vmfloaty/version.rb index c4dfafc..136b5d6 100644 --- a/lib/vmfloaty/version.rb +++ b/lib/vmfloaty/version.rb @@ -1,6 +1,6 @@ class Version - @version = '0.2.17' + @version = '0.2.18' def self.get @version diff --git a/vmfloaty.gemspec b/vmfloaty.gemspec index 94193f0..9d2975f 100644 --- a/vmfloaty.gemspec +++ b/vmfloaty.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'vmfloaty' - s.version = '0.2.17' + s.version = '0.2.18' s.authors = ['Brian Cain'] s.email = ['brian.cain@puppetlabs.com'] s.license = 'Apache'