mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Add --hostnameonly option to floaty list --active
Adds an option to the `floaty list` subcommand so that, when listing active hosts, floaty will output just the hostnames, without any additional information or formatting. Hostnames will be separated by a newline. This functionality is primarily intended for consuming by tooling (such as the tab completion scripts).
This commit is contained in:
parent
40072e90e4
commit
b31f44fb40
3 changed files with 103 additions and 0 deletions
|
|
@ -84,6 +84,21 @@ class Utils
|
|||
os_types
|
||||
end
|
||||
|
||||
def self.print_fqdn_for_host(service, hostname, host_data)
|
||||
case service.type
|
||||
when 'ABS'
|
||||
host_data['allocated_resources'].each do |vm_name, _i|
|
||||
puts vm_name['hostname']
|
||||
end
|
||||
when 'Pooler'
|
||||
puts "#{hostname}.#{host_data['domain']}"
|
||||
when 'NonstandardPooler'
|
||||
puts host_data['fqdn']
|
||||
else
|
||||
raise "Invalid service type #{service.type}"
|
||||
end
|
||||
end
|
||||
|
||||
def self.pretty_print_hosts(verbose, service, hostnames = [], print_to_stderr = false, indent = 0)
|
||||
output_target = print_to_stderr ? $stderr : $stdout
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue