Bug 2255329

Summary: Install Errata - Katello Ansible Default Remote Execution Fails ( Syntax Error While Loading Yaml )
Product: Red Hat Satellite Reporter: myoder
Component: Hosts - ContentAssignee: Jeremy Lenz <jlenz>
Status: CLOSED ERRATA QA Contact: visawant
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.14.0CC: ahumbe, iballou, nalfassi, rlavi, visawant, wpinheir, zhunting
Target Milestone: 6.15.0Keywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-katello-4.11.0.3-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-04-23 17:16:29 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 myoder 2023-12-20 06:58:04 UTC
Description of problem:

Using "Install Errata - Katello Ansible Default" to install errata on a content host is failing to generate a valid Ansible playbook.  The playbook generated has 4 spaces before the beginning "---" which makes invalidates the playbook as a yaml file.

The error from the template invocation screen shows:

~~~
   1:
ERROR! We were unable to read either as JSON nor YAML, these are the errors we got from each:
   2:
JSON: Expecting value: line 1 column 5 (char 4)
   3:
Syntax Error while loading YAML.
   4:
  mapping values are not allowed in this context
   5:
The error appears to be in '/tmp/d20231219-112896-1iychip/project/playbook.yml': line 2, column 8, but may
   6:
be elsewhere in the file depending on the exact syntax problem.
   7:
The offending line appears to be:
   8:
    ---
   9:
- hosts: all
  10:
       ^ here
  11:
Exit status: 4
  12:
StandardError: Job execution failed
~~~

Further, the actual playbook generated on the Ansible working directory of the Satellite looks like this:

~~~
    ---
- hosts: all
  tasks:
    - shell:
        cmd: |
          yum -y update-minimal --advisory=RHSA-2022:4867
      register: out
    - debug: var=out
~~~

This was working in Satellite 6.13, and is now broken in 6.14.


Version-Release number of selected component (if applicable):
Satellite 6.14

How reproducible:
always

Steps to Reproduce:
1. Navigate to "Hosts => Content Hosts"
2. Select checkbox next to a host (that has installable errata), and select "Manage Errata" from the "Select Action" drop down menu
3. Select 1 errata from the list, and select "via remote execution" from the "Install Selected" drop down menu.
4. Step 3 may trigger the Katello Errata Install via SSH, and not Ansible.  If so, instead of selecting "via remote execution", select "via remote execution - customize first".  Then select "Katello via Ansible" for the job category, and "Install Errata - Katello Ansible Default" for the job template.  Make sure to add errata if it gets removed (e.g. errata_id ^ (RHSA-2022:4867) ).

Actual results:
Remote Execution task fails

Expected results:
Remote Execution task succeeds, and tries to install errata on the host

Additional info:
As a work around, the "Install Errata - Katello Script Default" job template from the "Katello" job category still works.

Comment 1 Ian Ballou 2024-01-08 18:48:47 UTC
Changing component to Hosts - Content since the change will need to be made in Katello.

Comment 2 Bryan Kearney 2024-01-13 00:03:02 UTC
Upstream bug assigned to jlenz

Comment 3 Bryan Kearney 2024-01-13 00:03:06 UTC
Upstream bug assigned to jlenz

Comment 4 Bryan Kearney 2024-01-18 04:03:03 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/36994 has been resolved.

Comment 10 errata-xmlrpc 2024-04-23 17:16:29 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 (Important: Satellite 6.15.0 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-2024:2010