f7e4e03
From b4e6e579d106c75dd5a5142b4e09d1805bdd4711 Mon Sep 17 00:00:00 2001
f7e4e03
From: Ryan Brady <rbrady@redhat.com>
f7e4e03
Date: Thu, 4 Dec 2014 16:09:18 -0500
f7e4e03
Subject: [PATCH] Fix repo enablement for RHEL during registration
f7e4e03
f7e4e03
Previously the REG_REPOS value was a space delimited list of repo
f7e4e03
names, but the spaces were incompatible with passing through json.
f7e4e03
If you pass a list in json through the heat parameter, the output
f7e4e03
is the string representation of a python list of unicode vaules.
f7e4e03
This patch changes the rhel-registration scripts to process the
f7e4e03
REG_REPOS value as a comma delimited list which is more easily
f7e4e03
passed through json.  Both scripts have been updated to remain
f7e4e03
consistent.
f7e4e03
f7e4e03
Change-Id: I21b3fd115e53aa3b0fa4af9bbfb1f08b6fe163ab
f7e4e03
---
f7e4e03
 elements/rhel-common/README.md                               | 12 ++++++------
f7e4e03
 .../os-refresh-config/pre-configure.d/06-rhel-registration   |  2 +-
f7e4e03
 elements/rhel-common/pre-install.d/00-rhel-registration      |  2 +-
f7e4e03
 3 files changed, 8 insertions(+), 8 deletions(-)
f7e4e03
f7e4e03
diff --git a/elements/rhel-common/README.md b/elements/rhel-common/README.md
f7e4e03
index 4cdd184..d57d165 100644
f7e4e03
--- a/elements/rhel-common/README.md
f7e4e03
+++ b/elements/rhel-common/README.md
f7e4e03
@@ -81,8 +81,8 @@ It will change over time as new releases come out.  There are also variants
f7e4e03
 
f7e4e03
 #### REG\_REPOS
f7e4e03
 A single string representing a list of repository names separated by a
f7e4e03
-space.  Each of the repositories in this string are enabled through
f7e4e03
-subscription manager.  Once you've attached a subscription, you can
f7e4e03
+comma (No spaces).  Each of the repositories in this string are enabled
f7e4e03
+through subscription manager.  Once you've attached a subscription, you can
f7e4e03
 find available repositories by running subscription-manager repos --list.
f7e4e03
 
f7e4e03
 #### REG\_SERVER\_URL
f7e4e03
@@ -119,7 +119,7 @@ REG_METHOD=satellite
f7e4e03
 To register with the Red Hat Customer Portal, a common example would be to
f7e4e03
 set the following variables:
f7e4e03
 
f7e4e03
-REG_REPOS='rhel-7-server-optional-rpms rhel-7-server-extras-rpms'
f7e4e03
+REG_REPOS='rhel-7-server-optional-rpms,rhel-7-server-extras-rpms'
f7e4e03
 REG_AUTO_ATTACH=true
f7e4e03
 REG_USER='tripleo'
f7e4e03
 REG_PASSWORD='tripleo'
f7e4e03
@@ -165,8 +165,8 @@ Heat metadata can be used to configure the rhel-common element.
f7e4e03
             # minor release version. This is only used with the auto_attach
f7e4e03
             # option.
f7e4e03
         repos:
f7e4e03
-            # A single string representing a list of repository names separated
f7e4e03
-            # by a space.  Each of the repositories in this string are enabled
f7e4e03
+            # A single string representing a list of repository names separated by a
f7e4e03
+            # comma (No spaces).  Each of the repositories in this string are enabled
f7e4e03
             # through subscription manager.
f7e4e03
         satellite_url:
f7e4e03
             # The url of the Satellite instance to register with.  Required for
f7e4e03
@@ -214,7 +214,7 @@ use the following metadata:
f7e4e03
 
f7e4e03
     {
f7e4e03
         "rh_registration":{
f7e4e03
-            "repos":"rhel-7-server-optional-rpms rhel-7-server-extras-rpms",
f7e4e03
+            "repos":"rhel-7-server-optional-rpms,rhel-7-server-extras-rpms",
f7e4e03
             "auto_attach":true,
f7e4e03
             "user":"tripleo",
f7e4e03
             "password":"tripleo",
f7e4e03
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
f7e4e03
index 90306c2..53ef58a 100755
f7e4e03
--- a/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration
f7e4e03
+++ b/elements/rhel-common/os-refresh-config/pre-configure.d/06-rhel-registration
f7e4e03
@@ -89,7 +89,7 @@ if [ -n "${REG_ORG:-}" ]; then
f7e4e03
 fi
f7e4e03
 
f7e4e03
 if [ -n "${REG_REPOS:-}" ]; then
f7e4e03
-    for repo in $REG_REPOS; do
f7e4e03
+    for repo in $(echo $REG_REPOS | tr ',' '\n'); do
f7e4e03
         repos="$repos --enable $repo"
f7e4e03
     done
f7e4e03
 fi
f7e4e03
diff --git a/elements/rhel-common/pre-install.d/00-rhel-registration b/elements/rhel-common/pre-install.d/00-rhel-registration
f7e4e03
index f1a528d..fe19593 100755
f7e4e03
--- a/elements/rhel-common/pre-install.d/00-rhel-registration
f7e4e03
+++ b/elements/rhel-common/pre-install.d/00-rhel-registration
f7e4e03
@@ -72,7 +72,7 @@ if [ -n "${REG_ORG:-}" ]; then
f7e4e03
 fi
f7e4e03
 
f7e4e03
 if [ -n "${REG_REPOS:-}" ]; then
f7e4e03
-    for repo in $REG_REPOS; do
f7e4e03
+    for repo in $(echo $REG_REPOS | tr ',' '\n'); do
f7e4e03
         repos="$repos --enable $repo"
f7e4e03
     done
f7e4e03
 fi