Abstract out getting all active token vms into Utils

This commit is contained in:
Brian Cain 2016-11-12 13:59:26 -08:00
parent 2c9ce5644e
commit 586f4f5c05
4 changed files with 42 additions and 33 deletions

View file

@ -79,4 +79,17 @@ class Utils
puts "- #{vm}.#{domain} (#{metadata.join(", ")})"
end
end
def self.get_all_token_vms(verbose, url, token)
# get vms with token
status = Auth.token_status(verbose, url, token)
vms = status[token]['vms']
if vms.nil?
raise "You have no running vms"
end
running_vms = vms['running']
running_vms
end
end