mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
(QENG-7604) Add support for Job IDs to ABS delete
This commit adds support for passing in a JobID when deleting with ABS.
This commit is contained in:
parent
d6a69d08ac
commit
51a7eb809e
3 changed files with 40 additions and 3 deletions
|
|
@ -185,9 +185,11 @@ class Vmfloaty
|
|||
|
||||
command :delete do |c|
|
||||
c.syntax = 'floaty delete hostname,hostname2 [options]'
|
||||
c.syntax += "\n floaty delete job1,job2 [options] (only supported with ABS)"
|
||||
c.summary = 'Schedules the deletion of a host or hosts'
|
||||
c.description = 'Given a comma separated list of hostnames, or --all for all vms, vmfloaty makes a request to the pooler service to schedule the deletion of those vms.'
|
||||
c.description = 'Given a comma separated list of hostnames, or --all for all vms, vmfloaty makes a request to the pooler service to schedule the deletion of those vms. If you are using the ABS service, you can also pass in JobIDs here. Note that passing in a Job ID will delete *all* of the hosts in the job.' # rubocop:disable Layout/LineLength
|
||||
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 JobID or JobIDs', 'floaty delete 1579300120799,1579300120800 --url http://abs.example.com'
|
||||
c.option '--verbose', 'Enables verbose output'
|
||||
c.option '--service STRING', String, 'Configured pooler service name'
|
||||
c.option '--all', 'Deletes all vms acquired by a token'
|
||||
|
|
|
|||
|
|
@ -100,6 +100,11 @@ class ABS
|
|||
requests.each do |req_hash|
|
||||
next unless req_hash['state'] == 'allocated' || req_hash['state'] == 'filled'
|
||||
|
||||
if hosts.include? req_hash['request']['job']['id']
|
||||
jobs_to_delete.push(req_hash)
|
||||
next
|
||||
end
|
||||
|
||||
req_hash['allocated_resources'].each do |vm_name, _i|
|
||||
if hosts.include? vm_name['hostname']
|
||||
if all_job_resources_accounted_for(req_hash['allocated_resources'], hosts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue