From 697800987fc059277b43cbab606243a6c5602047 Mon Sep 17 00:00:00 2001 From: James Slagle Date: Tue, 9 Dec 2014 14:14:53 -0500 Subject: [PATCH] Allow for disabling rhel registration When using the rhel element, it can be uesful to disable registration. For instance, if using an internal mirror repository that does not require registration/authentication. Change-Id: I42fa34e7f146137e5b1b9c5d7785702311e1dca1 --- elements/rhel-common/README.md | 5 +++-- .../pre-configure.d/06-rhel-registration | 7 +++++-- elements/rhel-common/pre-install.d/00-rhel-registration | 8 ++++++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/elements/rhel-common/README.md b/elements/rhel-common/README.md index 4cdd184f..61ae3457 100644 --- a/elements/rhel-common/README.md +++ b/elements/rhel-common/README.md @@ -59,7 +59,7 @@ the hostname. #### REG\_METHOD Sets the method of registration. Use "portal" to register a system with the Red Hat Customer Portal. Use "satellite" to register a system with Red -Hat Satellite 6. +Hat Satellite 6. Use "disable" to skip the registration process. #### REG\_ORG Gives the organization to which to join the system. @@ -190,7 +190,8 @@ Heat metadata can be used to configure the rhel-common element. method: # Sets the method of registration. Use "portal" to register a # system with the Red Hat Customer Portal. Use "satellite" to - # register a system with Red Hat Satellite 6. + # register a system with Red Hat Satellite 6. Use "disable" to + # skip the registration process. Configuration Registration Examples ------------------------------------ diff --git a/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration b/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration index 4f75d5dc..999bdfd3 100755 --- a/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration +++ b/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration @@ -116,7 +116,10 @@ case "${REG_METHOD:-}" in # beta-rpms repo only needed to support the katello-ca rpm above. subscription-manager repos --disable ${satellite_repo} ;; + disable) + echo "Disabling RHEL registration" + ;; *) - echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD." - exit 0 # keeps the stack from failing if you don't set a value in REG_METHOD + echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD." + exit 0 esac diff --git a/elements/rhel-common/pre-install.d/00-rhel-registration b/elements/rhel-common/pre-install.d/00-rhel-registration index 52832361..eee5d1ba 100755 --- a/elements/rhel-common/pre-install.d/00-rhel-registration +++ b/elements/rhel-common/pre-install.d/00-rhel-registration @@ -97,7 +97,11 @@ case "${REG_METHOD:-}" in # beta-rpms repo only needed to support the katello-ca rpm above. subscription-manager repos --disable rhel-7-server-rh-common-beta-rpms ;; + disable) + echo "Disabling RHEL registration" + export REG_HALT_UNREGISTER=1 # stops attempt to unregister + ;; *) - echo "WARNING: only 'portal' and 'satellite' are valid values for REG_METHOD." - exit 1 # RHEL requires registration, fail image build if REG_Method isn't set + echo "WARNING: only 'portal', 'satellite', and 'disable' are valid values for REG_METHOD." + exit 1 esac