Bug 1844151
| Summary: | [RFE] Need a way to print the complete input of a REX job using the hammer command line on Red Hat Satellite 6. | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Kshitij <kupadhya> |
| Component: | Remote Execution | Assignee: | Maria <magaphon> |
| Status: | CLOSED ERRATA | QA Contact: | Peter Ondrejka <pondrejk> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 6.7.0 | CC: | aruzicka, bkearney, inecas, manoj.xavier |
| Target Milestone: | 6.9.0 | Keywords: | FutureFeature, Triaged |
| Target Release: | Unused | ||
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Whiteboard: | |||
| 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: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-04-21 13:14:56 UTC | 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
Kshitij
2020-06-04 17:33:26 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)? 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].
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"
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 |