Merge "Fix usage of satellite in organization mode"

This commit is contained in:
Zuul 2019-04-11 23:35:10 +00:00 committed by Gerrit Code Review
commit ff52c2de67
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
retry subscription-manager register $opts
retry subscription-manager $repos
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