Bug 1816699

Summary: Satellite Receptor Installer role can miss accounts under certain conditions
Product: Red Hat Satellite Reporter: jag <jag>
Component: RH Cloud - Cloud ConnectorAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: low Docs Contact:
Priority: unspecified    
Version: 6.7.0CC: ahumbe, aruzicka, bbuckingham, dvoss, jhutar, jyejare, lhellebr, mhulan, mmccune, pcreech
Target Milestone: 6.8.0Keywords: PrioBumpGSS, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Known Issue
Doc Text:
If all of a Red Hat account's organizations include both custom subscriptions and Red Hat subscriptions, and you added the custom subscriptions first, the "Configure Cloud Connector" Ansible playbook will not detect the account number and will fail to configure a Cloud Connector for that account. To work around this issue, add the Red Hat subscriptions before adding the custom subscriptions.
Story Points: ---
Clone Of:
: 1851148 (view as bug list) Environment:
Last Closed: 2020-10-27 13:00:52 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 jag 2020-03-24 14:54:02 UTC
Description of problem:

The role for installing Receptor with Satellite scans for organizations, looks for the first subscription associated with that organization, and extracts the account ID from that first subscription.

If a particular account is only associated with organizations that also have a custom subscription as their first subscription returned by the API, that account will not have a Receptor set up and running for it.


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

Applies to role version v0.6.2


Additional info:

The proper solution is to change the jmespath query here:
https://github.com/project-receptor/satellite-receptor-installer/blob/v0.6.2/tasks/extract_orgs.yml#L26

Instead of: results[0].account_number
It should be: results[?account_number != null] | [0].account_number

Comment 11 Adam Ruzicka 2020-06-29 15:10:41 UTC
*** Bug 1837866 has been marked as a duplicate of this bug. ***

Comment 12 Jitendra Yejare 2020-08-11 14:00:41 UTC
Verified!
------------------


As per discussion with DEV, the bug verification has been superseded by https://bugzilla.redhat.com/show_bug.cgi?id=1833031.

And the bug is already marked Verified hence changing the state to Verified!


Still I have retested it today and there is no change in Verification comment of that bug as :

```

Receptor installed and configured successfully through Configure Cloud Connector job template.

# grep foreman-rake /usr/share/ansible/roles/project-receptor.satellite_receptor_installer/tasks/main.yml 
      command: foreman-rake katello:receptor:extract_orgs OUTPUT_FILE={{ tempfile.path }}

# time foreman-rake katello:receptor:extract_orgs OUTPUT_FILE=/tmp/testfile
Wrote results to /tmp/testfile. Please delete it when finished.

real	0m35.491s
user	0m30.005s
sys	0m4.220s

# cat /tmp/testfile
[output omitted but contains account ID and key]

# cat /etc/receptor/*/receptor.conf | grep client_key
client_key=/etc/receptor/rh_<account_id>/key.pem

# cat /etc/receptor/rh_<account_id>/key.pem
-----BEGIN RSA PRIVATE KEY-----
[...]
```

Comment 15 errata-xmlrpc 2020-10-27 13:00:52 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.8 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-2020:4366