Do not export REG_HALT_UNREGISTER between hook scripts
Do not rely on environment changes (like exporting REG_HALT_UNREGISTER) to persist between different hooks run. This helps when the hooks are run in different new environments every time. Instead, in 99-unregister redo the same checks on REG_METHOD as done in 00-rhel-registration, still respecting REG_HALT_UNREGISTER in case the user does not want to unregister the image generated. Change-Id: Id594dcd72334f38a2fa96da21206da77a83d7a1a Closes-Bug: #1434431
This commit is contained in:
parent
8111fc40aa
commit
8d19032a4a
@ -15,6 +15,12 @@ set -o pipefail
|
|||||||
# debugging purposes so you can check the portal or satellite to see what was
|
# debugging purposes so you can check the portal or satellite to see what was
|
||||||
# registered. Set REG_HALT_UNREGISTER to any non-null value to enable this
|
# registered. Set REG_HALT_UNREGISTER to any non-null value to enable this
|
||||||
# functionality.
|
# functionality.
|
||||||
if [ -z "${REG_HALT_UNREGISTER:-}" ]; then
|
case "${REG_METHOD:-}" in
|
||||||
|
portal | satellite)
|
||||||
|
if [ -z "${REG_HALT_UNREGISTER:-}" ]; then
|
||||||
subscription-manager unregister
|
subscription-manager unregister
|
||||||
fi
|
fi
|
||||||
|
;;
|
||||||
|
disable)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
@ -102,7 +102,6 @@ case "${REG_METHOD:-}" in
|
|||||||
;;
|
;;
|
||||||
disable)
|
disable)
|
||||||
echo "Disabling RHEL registration"
|
echo "Disabling RHEL registration"
|
||||||
export REG_HALT_UNREGISTER=1 # stops attempt to unregister
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD."
|
echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD."
|
||||||
|
Loading…
Reference in New Issue
Block a user