Fix usage of satellite in organization mode

When satellite is used in organization mode, deployments were failing
due to a change on code return on subscription manager. This last will
generate an error any way so this is a bypass.

Tested on queen.

Closes-Bug: #1822725

Change-Id: I0dd65cc752a6bd94bec59f695e55aa85ef8f0192
Signed-off-by: Cyril Lopez <cylopez@redhat.com>
This commit is contained in:
Cyril Lopez 2019-04-02 09:06:54 +02:00
parent 8a8d152de3
commit d80a956d72
2 changed files with 17 additions and 2 deletions

View File

@ -70,6 +70,10 @@ parameters:
default:
- CREATE
description: Actions when the system profile will be registered, by default we only do this on CREATE of a new server, not for existing nodes.
UseSatelliteOrgMode:
type: boolean
default: false
description: When satellite is used in Organisation mode, this option must be enabled.
conditions:
unregister_on_delete:
@ -110,6 +114,7 @@ resources:
- name: REG_HTTP_PROXY_PORT
- name: REG_HTTP_PROXY_USERNAME
- name: REG_HTTP_PROXY_PASSWORD
- name: REG_SAT_ORGMODE
config: {get_file: scripts/rhel-registration}
RHELRegistrationDeployment:
@ -142,6 +147,7 @@ resources:
REG_HTTP_PROXY_PORT: {get_param: rhel_reg_http_proxy_port}
REG_HTTP_PROXY_USERNAME: {get_param: rhel_reg_http_proxy_username}
REG_HTTP_PROXY_PASSWORD: {get_param: rhel_reg_http_proxy_password}
REG_SAT_ORGMODE: {get_param: UseSatelliteOrgMode}
RHELUnregistration:
type: OS::Heat::SoftwareConfig

View File

@ -272,8 +272,17 @@ case "${REG_METHOD:-}" in
fi
rpm -Uvh katello-ca-consumer-latest.noarch.rpm || true
if [ "$REG_SAT_ORGMODE" = "True" ]; then
subscription-manager register $opts || true
subscription-manager $repos || true
if [ $(subscription-manager status |grep -c "Content Access Mode is set to Organization/Environment") = 0 ]; then
echo "Fail to register the node to satellite in Organization mode"
exit 1
fi
else
retry subscription-manager register $opts
retry subscription-manager $repos
fi
yum install -y katello-agent || true # needed for errata reporting to satellite6
katello-package-upload