mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
Merge pull request #18 from briancain/add-force-to-delete-all
(#17) Add a force option for delete --all
This commit is contained in:
commit
19255bb3ba
3 changed files with 12 additions and 4 deletions
|
|
@ -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.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 '--verbose', 'Enables verbose output'
|
||||||
c.option '--all', 'Deletes all vms acquired by a token'
|
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 '--token STRING', String, 'Token for vmpooler'
|
||||||
c.option '--url STRING', String, 'URL of vmpooler'
|
c.option '--url STRING', String, 'URL of vmpooler'
|
||||||
c.action do |args, options|
|
c.action do |args, options|
|
||||||
|
|
@ -167,6 +168,7 @@ class Vmfloaty
|
||||||
token = options.token || config['token']
|
token = options.token || config['token']
|
||||||
url = options.url ||= config['url']
|
url = options.url ||= config['url']
|
||||||
delete_all = options.all
|
delete_all = options.all
|
||||||
|
force = options.f
|
||||||
|
|
||||||
if delete_all
|
if delete_all
|
||||||
# get vms with token
|
# get vms with token
|
||||||
|
|
@ -183,8 +185,14 @@ class Vmfloaty
|
||||||
if ! running_vms.nil?
|
if ! running_vms.nil?
|
||||||
Utils.prettyprint_hosts(running_vms, verbose, url)
|
Utils.prettyprint_hosts(running_vms, verbose, url)
|
||||||
# query y/n
|
# query y/n
|
||||||
puts ""
|
puts
|
||||||
ans = agree("Delete all VMs associated with token #{token}? [y/N]")
|
|
||||||
|
if force
|
||||||
|
ans = true
|
||||||
|
else
|
||||||
|
ans = agree("Delete all VMs associated with token #{token}? [y/N]")
|
||||||
|
end
|
||||||
|
|
||||||
if ans
|
if ans
|
||||||
# delete vms
|
# delete vms
|
||||||
Pooler.delete(verbose, url, running_vms, token)
|
Pooler.delete(verbose, url, running_vms, token)
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
class Version
|
class Version
|
||||||
@version = '0.2.17'
|
@version = '0.2.18'
|
||||||
|
|
||||||
def self.get
|
def self.get
|
||||||
@version
|
@version
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'vmfloaty'
|
s.name = 'vmfloaty'
|
||||||
s.version = '0.2.17'
|
s.version = '0.2.18'
|
||||||
s.authors = ['Brian Cain']
|
s.authors = ['Brian Cain']
|
||||||
s.email = ['brian.cain@puppetlabs.com']
|
s.email = ['brian.cain@puppetlabs.com']
|
||||||
s.license = 'Apache'
|
s.license = 'Apache'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue