mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
(maint) Adding a provider method tag_vm_user
This method should be called only once, when the VM is moved to a running state which is when the data for the user (if using tokens) is available. In vmpooler base provider it is a noop method, but the various providers can implement it to tag or label a running VM with the name of the user who checked it out
This commit is contained in:
parent
0777bd36d4
commit
daea25b1d1
3 changed files with 41 additions and 0 deletions
|
|
@ -294,6 +294,12 @@ module Vmpooler
|
|||
move_vm_queue(pool, vm, 'running', 'completed', redis, 'is listed as running, but has no checkouttime data. Removing from running')
|
||||
end
|
||||
|
||||
# tag VM if not tagged yet, this ensures the method is only called once
|
||||
unless redis.hget("vmpooler__vm__#{vm}", 'user_tagged')
|
||||
success = provider.tag_vm_user(pool, vm)
|
||||
redis.hset("vmpooler__vm__#{vm}", 'user_tagged', 'true') if success
|
||||
end
|
||||
|
||||
throw :stop_checking if provider.vm_ready?(pool, vm)
|
||||
|
||||
throw :stop_checking if provider.get_vm(pool, vm)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue