Bug 2219700

Summary: [RFE] Hammer Command to get the all registered hosts UUID details
Product: Red Hat Satellite Reporter: Amit Agarwal <amiagarw>
Component: HostsAssignee: satellite6-bugs <satellite6-bugs>
Status: NEW --- QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.12.4CC: aruzicka, rlavi
Target Milestone: UnspecifiedKeywords: FutureFeature
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Amit Agarwal 2023-07-04 20:46:53 UTC
Description of problem:

There does not seem to have a single command which can give details of all registered hosts UUID at a time. 

hammer host info --id will give the UUID info for individual host.  


Steps to Reproduce:
CSV file that we generate from Web UI under Host -> All host or even Hosts -> Content Hosts does not show the UUIDs of the hosts


Actual results:
There does not seem to have a single command which can give details of all registered hosts UUID details at a time.

Expected results:
Hammer Command to get the all registered hosts UUID details

Comment 1 Marek Hulan 2023-08-03 13:40:05 UTC
The best way to achieve this is to create a report template and then render it from hammer. Attaching an example report template and the hammer commands needed to import and use it.

hammer report-template import --file /root/host_uuids.erb --name 'Host - UUIDs' --organization 'Default Organization' --location 'Default Location'
hammer report-template generate --name 'Host - UUIDs'

Example output as CSV

> Name,UUID
> foreman-nuc2.example.com,588766ef-60a1-446b-8db2-7460a6ae1b74
> tony-sloane.example.com,afd308ce-71f1-4e0d-abc2-1ab2f47cfa27
> clark-dirksen.example.com,3b1766f7-3fc2-4ca8-991c-88e181fb173f
> mqtt.example.com,e69c179e-176d-44db-914d-ca46f7e93a13

I don't think we'll be adding option to customize columns for host list hammer command.

Comment 3 Amit Agarwal 2023-08-11 14:55:55 UTC
Query from customer

"What is expected entries in  /root/host_uuids.erb   ?
Do I need to create this file ? "

Comment 4 Amit Agarwal 2023-08-11 14:56:08 UTC
Query from customer

"What is expected entries in  /root/host_uuids.erb   ?
Do I need to create this file ? "

Comment 6 Amit Agarwal 2023-08-16 17:57:31 UTC
Thanks for the input.

Customer is facing below issue while attempting the last command? Please advise

hammer report-template generate --name 'Host - UUIDs'
Generating Report template failed for: undefined method '#uuid' for Host::Managed::Jail (Host::Managed).