Skip to content

Instantly share code, notes, and snippets.

@jlsherrill
Last active June 10, 2016 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlsherrill/35c7a27a9bcf0b0d885e23f6bc25b57d to your computer and use it in GitHub Desktop.
Save jlsherrill/35c7a27a9bcf0b0d885e23f6bc25b57d to your computer and use it in GitHub Desktop.
Gather system and host info

# foreman-rake console

User.current = User.anonymous_api_admin

output = []
output << "Systems"
Katello::System.includes(:environment).all.each do |sys|
  output << [sys.name, sys.id, sys.hostname, sys.environment.organization_id, sys.host_id].join(',')
end

output << ""
output << "Hosts"
Host.all.each do |host|
  output << [host.name, host.id, host.organization_id].join(',')
end

File.open('/tmp/system_debug.txt', 'w'){|f| f.write(output.join("\n"))}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment