Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1913311 - hammer host list --help shows unusable name for IP field
Summary: hammer host list --help shows unusable name for IP field
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hosts
Version: 6.7.0
Hardware: Unspecified
OS: Linux
medium
low
Target Milestone: 6.10.0
Assignee: Oleh Fedorenko
QA Contact: tstrych
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-01-06 13:42 UTC by Francesco Ratto
Modified: 2024-03-25 17:45 UTC (History)
6 users (show)

Fixed In Version: tfm-rubygem-hammer_cli-2.5.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-11-16 14:09:38 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32444 0 Normal New hammer host list --help shows unusable name for IP field 2021-04-28 14:48:09 UTC
Red Hat Product Errata RHSA-2021:4702 0 None None None 2021-11-16 14:09:56 UTC

Description Francesco Ratto 2021-01-06 13:42:43 UTC
Description of problem: current hammer --csv implementation gives wrong results / some options seem inactive

hammer --csv host list --fields 'Name,IP,Organization,Environment,Operating System,Security,Bugfix,Enhancement' > /tmp/Errata_Report.csv 

miss ip , organization , environment columns even if the options are compliant to documentation obtained by # hammer --csv host list --help


Version-Release number of selected component (if applicable): tfm-rubygem-hammer_cli-0.19.2.1-1.el7sat.noarch


How reproducible: execute the command above 


The issue is blocking CU to create the proper report produced periodically for review and security purposes

Comment 1 Oleh Fedorenko 2021-01-06 15:56:00 UTC
Hello Francesco,

I've tried the same command and got few points to this issue:

1. Organization field is being shown as expected, it's not missing. Probably could be misspelled.
2. IP should be spelled in lower-case or capitalized. Upper-case is reserved for field sets.
3. Environment should be typed correctly (as per table in help output), i.e. Lifecycle Environment.

Please, could you try those points and give feedback if this helps?

Comment 2 Sayan Das 2021-01-06 16:13:14 UTC

# hammer --csv host list --fields 'Name,Ip,Organization,Lifecycle Environment,Operating System,Security,Bugfix,Enhancement' --search "hypervisor = false"

** Replaced IP with Ip

** Replace Environment with Lifecycle Environment


This works fine for me and prints the information i need on my test satellite.

Comment 3 Sayan Das 2021-01-06 18:05:20 UTC
I am clearing the needinfo for Fransesco as comment 2, solves the issue for CU.

Now, here's what I think should be fixed.

# hammer --csv host list --help | grep "^  FIELDS" -A18
  FIELDS                 | ALL | DEFAULT | THIN
  -----------------------|-----|---------|-----
  Id                     | x   | x       | x
  Name                   | x   | x       | x
  Operating System       | x   | x       |
  Host Group             | x   | x       |
  IP                     | x   | x       |   --------------> This should be "Ip" but not "IP"
  MAC                    | x   | x       |
  Global Status          | x   | x       |
  Organization           | x   |         |
  Location               | x   |         |
  Additional Information | x   |         |
  Content View           | x   | x       |
  Lifecycle Environment  | x   | x       |
  Security               | x   |         |
  Bugfix                 | x   |         |
  Enhancement            | x   |         |
  Trace Status           | x   | x       |
  -----------------------|-----|---------|-----


Is it possible to get all these fields tested and properly mentioned in the --help section so that there is no confusion present with what to use ?



-- Sayan

Comment 4 Oleh Fedorenko 2021-01-06 19:07:01 UTC
Hi Sayan,

Since everything works, I'd suggest to change the subject to a different issue or close this one.

Also, I agree on improving help section since there were misunderstandings before. Probably we could use this BZ to track the help improvement.

Comment 5 Sayan Das 2021-01-06 19:21:40 UTC
(In reply to Oleh Fedorenko from comment #4)
> Hi Sayan,
> 
> Since everything works, I'd suggest to change the subject to a different
> issue or close this one.
> 
> Also, I agree on improving help section since there were misunderstandings
> before. Probably we could use this BZ to track the help improvement.

I have changed the subject to make it more meaningful as per the current discussion we are having. Let me know if that looks ok to you. 

I think we can use this BZ now to track and fix the --help section .


-- Sayan

Comment 6 Francesco Ratto 2021-01-07 12:19:32 UTC
Hi everyone and thanks to quick reaction to my bz 

 I would highligt a few other differences before , with hammer csv the line used to generate the report was

 hammer csv content-hosts --export   --columns "Name,Organization,Environment,Virtual,OS,Arch,Sockets,RAM,Cores,Security Errata,Bug Fix Errata,Enhancement Errata"   --search $something 

 now is (do not consider the different fields like ip) 

 # hammer --csv host list --fields 'Name,Ip,Organization,Lifecycle Environment,Operating System,Security,Bugfix,Enhancement' --search $something 


 In old (and in current) version the clause 'environment' is present in --help but is now replaced by Lifecycle Environment and it seems not generating any output
 Are these clauses to be used with the initials capitalized ? Which are still effective ? This will be greatly useful to give the customer to create the most identical possible report 
 and improve consistency between documentation .It would be also useful to have a sort of conversion table between the two versions since it looks they are different not only for the csv --> --csv option 

 activation_key            string
  activation_key_id         string
  addon                     string
  addons_status             Values: mismatched, matched, not_specified
  ansible_role              string
  applicable_errata         string
  applicable_rpms           string
  architecture              string
  autoheal                  boolean
  boot_time
  build                     Values: true, false
  class                     string
  comment                   text
  compute_resource          string
  compute_resource_id       integer
  config_group              string
  content_source            string
  content_view              string
  content_view_id           integer
  created_at                datetime
  domain                    string
  domain_id                 integer
  environment               string
  errata_status             Values: security_needed, errata_needed, updated, unknown
  execution_status          Values: ok, error
  facts                     string
  global_status             Values: ok, warning, error
  has_ip                    string
  has_mac                   string
  hostgroup                 string
  hostgroup_fullname        string
  hostgroup_id              integer
  hostgroup_name            string
  hostgroup_title           string
  hypervisor                Values: true, false
  hypervisor_host           string
  image                     string
  installable_errata        string
  installed_at              datetime
  ip                        string
  job_invocation.id         string
  job_invocation.result     Values: cancelled, failed, pending, success
  last_checkin              datetime
  last_report               datetime
  lifecycle_environment     string
  lifecycle_environment_id  integer
  location                  string
  location_id               integer
  mac                       string
  managed                   Values: true, false
  model                     string
  name                      string
  organization              string
  organization_id           integer
  origin                    string
  os                        string
  os_description            string
  os_id                     integer
  os_major                  string
  os_minor                  string
  os_title                  string
  owner                     string
  owner_id                  integer
  owner_type                string
  params                    string
  params_name               string
  parent_hostgroup          string
  puppet_ca                 string
  puppet_proxy_id           integer
  puppetmaster              string
  purpose_status            Values: mismatched, matched, not_specified
  realm                     string
  realm_id                  integer
  registered_at             datetime
  registered_through        string
  release_version           string
  role                      text
  role_status               Values: mismatched, matched, not_specified
  service_level             string
  sla_status                Values: mismatched, matched, not_specified
  smart_proxy               string
  status.applied            integer
  status.enabled            Values: true, false
  status.failed             integer
  status.failed_restarts    integer
  status.interesting        Values: true, false
  status.pending            integer
  status.restarted          integer
  status.skipped            integer
  subnet                    string
  subnet.name               text
  subnet6                   string
  subnet6.name              text
  subscription_id           string
  subscription_name         string
  subscription_status       Values: valid, partial, invalid, unknown, unsubscribed_hypervisor
  subscription_uuid         string
  trace_status              Values: reboot_needed, process_restart_needed, updated
  upgradable_rpms           string
  usage                     text
  usage_status              Values: mismatched, matched, not_specified
  user.firstname            string
  user.lastname             string
  user.login                string
  user.mail                 string
  usergroup                 string
  usergroup.name            string
  uuid                      string



 Many Thanks

  Francesco

Comment 7 Sayan Das 2021-01-07 12:33:44 UTC
Hello Francesco,

The "hammer csv" and "hammer --csv" are two entirely different commands.

And for "hammer csv" there was a entire different module present earlier which was provided by "tfm-rubygem-hammer_cli_csv" but that has been discontinued now. 

So you cannot expect to exact same fields to be available in "hammer csv content-hosts" and "hammer --csv hosts list" .

As far as I know, The "hammer csv content-hosts" has been discontinued as we have now introduced report templates and that can generate exact same details much faster on Satellite 6.8 [ Sat 6.7 still has some limitations ].


I hope this helps.


-- Sayan

Comment 13 Oleh Fedorenko 2021-04-28 14:48:08 UTC
Created redmine issue https://projects.theforeman.org/issues/32444 from this bug

Comment 14 Bryan Kearney 2021-04-28 16:03:57 UTC
Upstream bug assigned to ofedoren

Comment 15 Bryan Kearney 2021-04-28 16:03:59 UTC
Upstream bug assigned to ofedoren

Comment 17 Bryan Kearney 2021-05-11 12:04:42 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32444 has been resolved.

Comment 18 tstrych 2021-06-18 12:29:58 UTC
1.) all other search fields except boot_time have the type, or values that should be expected, I think boot_time also should have it

# hammer host list --help
<omitted>
Search / Order fields:
  <omitted>

  architecture                    string
  autoheal                        boolean
  boot_time  --------------------------------> missing type
  <omitted>


2.) 
IP field is working now, but it seems that no other fields except Id,Name,IP,MAC,Organization,Location are working. 

I put all options to the command, ( I found --output=csv is same thins as --csv)
hammer -v --output=csv host list --fields="activation_key,activation_key_id,addon,addons_status,ansible_role,applicable_errata,applicable_errata_issued,applicable_rpms,architecture,autoheal,boot_time,build,class,comment,compute_resource,compute_resource_id,config_group,content_source,content_view,content_view_id,created_at,cve_id,domain,domain_id,environment,errata_status,execution_status,facts,global_status,has_ip,has_mac,hostgroup,hostgroup_fullname,hostgroup_id,hostgroup_name,hostgroup_title,hypervisor,hypervisor_host,id,image,insights_recommendations_count,installable_errata,installed_at,ip,job_invocation.id,job_invocation.result,last_checkin,last_report,lifecycle_environment,lifecycle_environment_id,location,location_id,mac,managed,model,name,organization,organization_id,origin,os,os_description,os_id,os_major,os_minor,os_title,owner,owner_id,owner_type,params,params_name,parent_hostgroup,puppet_ca,puppet_proxy_id,puppetmaster,purpose_status,realm,realm_id,registered_at,registered_through,release_version,role,role_status,service_level,sla_status,smart_proxy,status.applied,status.enabled,status.failed,status.failed_restarts,status.interesting,status.pending,status.restarted,status.skipped,subnet,subnet.name,subnet6,subnet6.name,subscription_id,subscription_name,subscription_status,subscription_uuid,trace_status,upgradable_rpms,usage,usage_status,user.firstname,user.lastname,user.login,user.mail,usergroup,usergroup.name,uuid" --per-page="10000"'

Result:
Id,Name,IP,MAC,Organization,Location
    1,<hostname>,<ip>,56:6f:0d:72:0b:87,Default Organization,Default Location
    2,<hostname>,<ip>,56:6f:0d:72:0c:a9,Default Organization,Default Location
    3,zyoquaqn.fwvmv1x1iu,,64:40:8b:f3:73:03,CbgmBOhSdQo,aVrNbAsttM

I was thinking if it can be caused that there is no other info, or there is maximum of fields that can be used
As you can see host 3 has no ip address and yet is written there. So I would expect as host 3 has subnet (based on command below), the field of subnet should be in the result.

hammer host info --id 3 | grep Subnet
    Subnet ipv4: ZHmHUNUUgwOK


I tried also only two fields id and subnet, doesn't work
 hammer --csv host list --fields 'id,subnet'
Id
1
2
3

tried capital S, and subnet name -> same results as above only id is shown
hammer --csv host list --fields 'id,Subnet' 
hammer --csv host list --fields 'id,subnet.name'


Please let me know what do you thing about it.

Comment 19 Oleh Fedorenko 2021-06-23 13:31:07 UTC
1) This should be handled in a separate BZ since some changes in the upstream [1] will add more fields with "empty" types.

2) You're mixing up the *output* fields with *search / order* fields.
--fields option accepts *output* fields only when --search/--order accept only *search / order* fields.


[1] - https://github.com/theforeman/foreman/pull/8524

Comment 20 tstrych 2021-06-24 14:15:29 UTC
Verified with sat 6.10 snap 5. 
All fields are now lowercase. (shown in table below)
Search of specified fields where first character is upper and rest is lower work as expected. Also completely lowercase strings works as well.

hammer --csv host list --fields=Id,Ip,Mac
Id,IP,MAC
1,10.1.3.127,56:6f:0d:72:0b:87
2,10.1.3.80,56:6f:0d:72:0c:a9
3,,64:40:8b:f3:73:03

The upper case IP and MAC is still shown in output text, but I think that is not part of this BZ and I hope that this fact is not important. If it is please do not hesitate to comment this BZ.

Predefined field sets:
  -----------------------|-----|---------|-----
  FIELDS                 | ALL | DEFAULT | THIN
  -----------------------|-----|---------|-----
  Id                     | x   | x       | x
  Name                   | x   | x       | x
  Operating system       | x   | x       |
  Host group             | x   | x       |
  Ip                     | x   | x       |
  Mac                    | x   | x       |
  Global status          | x   | x       |
  Organization           | x   |         |
  Location               | x   |         |
  Additional information | x   |         |
  Content view           | x   | x       |
  Lifecycle environment  | x   | x       |
  Security               | x   |         |
  Bugfix                 | x   |         |
  Enhancement            | x   |         |
  Trace status           | x   | x       |
  -----------------------|-----|---------|-----

Comment 21 tstrych 2021-06-24 14:17:57 UTC
The package version on 6.10 snap 5 is tfm-rubygem-hammer_cli-2.5.1-1.el7sat.noarch. (newer than version with fix)

Comment 24 errata-xmlrpc 2021-11-16 14:09:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.10 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2021:4702


Note You need to log in before you can comment on or make changes to this bug.