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 1844151 - [RFE] Need a way to print the complete input of a REX job using the hammer command line on Red Hat Satellite 6.
Summary: [RFE] Need a way to print the complete input of a REX job using the hammer co...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Remote Execution
Version: 6.7.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: 6.9.0
Assignee: Maria
QA Contact: Peter Ondrejka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-06-04 17:33 UTC by Kshitij
Modified: 2023-10-06 20:25 UTC (History)
4 users (show)

Fixed In Version: tfm-rubygem-hammer_cli_foreman_remote_execution-0.2.0, tfm-rubygem-foreman_remote_execution-4.2.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-21 13:14:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5149861 0 None None None 2020-06-11 04:11:06 UTC
Red Hat Product Errata RHSA-2021:1313 0 None None None 2021-04-21 13:17:14 UTC

Description Kshitij 2020-06-04 17:33:26 UTC
1. Proposed title of this feature request

Feature to print the complete input of the REX job from the hammer command line on Red Hat Satellite 6. Currently, we can achieve this by printing the description of the job but that has a limitation of 255 characters.



2. What are the nature and description of the request?

The customer wants to check the complete input of a remote job using the hammer command line. Currently, customers can check the same using the following command from the hammer command line which will print the description of the job but it has a limitation of 255 characters.

# hammer job-invocation info  --id <job-id>

The above has a limit of 255 characters and will not list the complete input if the job size is more than 255 characters.

3. Why does the customer need this? 

To check the input of the REX Job using the hammer command line for a large job.

4. How would the customer like to achieve this? (List the functional requirements here)

Currently, is it not possible to print the REX input either through the hammer or API as the required database table is not exposed to them. Although we can print the description of a REX task using the hammer command that too has a character limit of 255.

5. For each functional requirement listed in question 5, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented.

This can be tested easily by executing the respective commands on the satellite server.

No

6. Is there already an existing RFE upstream or in Red Hat Bugzilla?

No

7. Does the customer have any specific timeline dependencies?

No

8. Is the sales team involved in this request and do they have any additional input?

No

9. List any affected packages or components.

REX

10. Would the customer be able to assist in testing this functionality if implemented?

NA

Comment 1 Adam Ruzicka 2020-06-05 09:35:52 UTC
By complete inputs you mean really the inputs themselves (per-job) or the rendered template which is being run on the host (per-host)?

Comment 2 Kshitij 2020-06-05 09:51:24 UTC
Hello,

[1] We are actually looking for the complete input of the REX Job itself.

For eg. if we run the following script as a REX job on the client using satellite Web UI.

---
export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin
FILENAME=/tmp/$(hostname -s).csv
echo -e "$(hostname)\n===========================\nALL USERS ON THE SERVER\n===========================\n" > $FILENAME
cat /etc/passwd | sed 's/:/,/g' >> $FILENAME
echo -e "\n===========================\nALL GROUPS ON THE SERVER\n===========================\n" >> $FILENAME
cat /etc/group | sed 's/:/,/g' >> $FILENAME
echo -e "\n===========================\nSUDO PRIVILEGES ON THE SERVER\n===========================\n" >> $FILENAME
cat /etc/sudoers >> $FILENAME
echo -e "===========================\nINDIVIDUAL USER DETAILS\n===========================" >> $FILENAME
for i in $(awk -F: '{print $1}' /etc/passwd); do echo -e "\n$i";chage -l $i; done >> $FILENAME
echo -e "\n===========================\nACCOUNTS LOCKED\n===========================\n" >> $FILENAME
---


[2].Upon checking the input from the hammer command following input is observed.

# hammer job-invocation info --id 3

===
ID:           3
Description:  Run export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin
FILENAME=/tmp/$(hostname -s).csv
echo -e "$(hostname)\n===========================\nALL USERS ON THE SERVER\n===========================\n" > $FILENAME
cat /etc/passwd | sed 's/:/,/g' >> $FIL
Status:       failed
Success:      0
Failed:       1
Pending:      0
Total:        1
Start:        2020-06-03 16:35:53 UTC
Job Category: Commands
Hosts:        
 - host1.example.com
====

In the above, the hammer is printing the description of the task which has word limitation. So we are looking for a feature to print the complete input [1].

Comment 4 Peter Ondrejka 2020-12-07 14:41:33 UTC
Verified on Satellite 6.9 snap 4.
The --show-inputs flag has been added to show the full input on individual hosts, for example:


]# hammer job-invocation info --id 2 --show-inputs
---
ID: 2
Description: "Run export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin\r\nFILENAME=/tmp/$(hostname
  -s).csv\r\necho -e \"$(hostname)\\n===========================\\nALL USERS ON THE
  SERVER\\n===========================\\n\" > $FILENAME\r\ncat /etc/passwd | sed 's/:/,/g'
  >> $FIL"
Status: failed
Success: 1
Failed: 1
Pending: 0
Missing: 0
Total: 2
Start: 2020-12-07 13:41:13 UTC
Randomized ordering: false
Job Category: Commands
Hosts:
- Name: host.example.com
  Inputs:
    command: "export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin\r\nFILENAME=/tmp/$(hostname
      -s).csv\r\necho -e \"$(hostname)\\n===========================\\nALL USERS ON
      THE SERVER\\n===========================\\n\" > $FILENAME\r\ncat /etc/passwd
      | sed 's/:/,/g' >> $FILENAME\r\necho -e \"\\n===========================\\nALL
      GROUPS ON THE SERVER\\n===========================\\n\" >> $FILENAME\r\ncat
      /etc/group | sed 's/:/,/g' >> $FILENAME\r\necho -e \"\\n===========================\\nSUDO
      PRIVILEGES ON THE SERVER\\n===========================\\n\" >> $FILENAME\r\ncat
      /etc/sudoers >> $FILENAME\r\necho -e \"===========================\\nINDIVIDUAL
      USER DETAILS\\n===========================\" >> $FILENAME\r\nfor i in $(awk
      -F: '{print $1}' /etc/passwd); do echo -e \"\\n$i\";chage -l $i; done >> $FILENAME\r\necho
      -e \"\\n===========================\\nACCOUNTS LOCKED\\n===========================\\n\"
      >> $FILENAME"
- Name: host2.example.com
  Inputs:
    command: "export PATH=/usr/bin:/bin:/sbin:/usr/sbin:/usr/local/bin\r\nFILENAME=/tmp/$(hostname
      -s).csv\r\necho -e \"$(hostname)\\n===========================\\nALL USERS ON
      THE SERVER\\n===========================\\n\" > $FILENAME\r\ncat /etc/passwd
      | sed 's/:/,/g' >> $FILENAME\r\necho -e \"\\n===========================\\nALL
      GROUPS ON THE SERVER\\n===========================\\n\" >> $FILENAME\r\ncat
      /etc/group | sed 's/:/,/g' >> $FILENAME\r\necho -e \"\\n===========================\\nSUDO
      PRIVILEGES ON THE SERVER\\n===========================\\n\" >> $FILENAME\r\ncat
      /etc/sudoers >> $FILENAME\r\necho -e \"===========================\\nINDIVIDUAL
      USER DETAILS\\n===========================\" >> $FILENAME\r\nfor i in $(awk
      -F: '{print $1}' /etc/passwd); do echo -e \"\\n$i\";chage -l $i; done >> $FILENAME\r\necho
      -e \"\\n===========================\\nACCOUNTS LOCKED\\n===========================\\n\"
      >> $FILENAME"

Comment 7 errata-xmlrpc 2021-04-21 13:14:56 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.9 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:1313


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