aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/pre_deploy/rhel-registration/scripts/rhel-unregistration
blob: 916f97e3156b2035d766db2a2ab5e27ee30b2dc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash

set -eux
set -o pipefail

case "${REG_METHOD:-}" in
    portal|satellite)
        # Allow unregistration to fail.
        # We don't want to fail stack deletes if unregistration fails.
        # Note that this will be a no-op on satellite 5, which doesn't support
        # unregistering from the cli.
        subscription-manager unregister || true
        subscription-manager clean || true
        ;;
    disable)
        echo "Disabling RHEL unregistration"
        ;;
    *)
        echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD."
        exit 0
esac