Browse Source

Persist region name in overcloudrc

This is useful when deploying a cloud that doesn't use the default
region name.

Change-Id: I21b462f78b32cd334acdf8a5644b70b1f24c8162
Closes-Bug: #1804449
(cherry picked from commit 7cd99c8d13)
tags/8.7.1
Juan Antonio Osorio Robles 9 months ago
parent
commit
805b292458

+ 3
- 1
tripleo_common/actions/deployment.py View File

@@ -265,7 +265,9 @@ class OvercloudRcAction(base.TripleOAction):
265 265
                      "environment.")
266 266
             return actions.Result(error=error)
267 267
 
268
-        return overcloudrc.create_overcloudrc(stack, self.no_proxy, admin_pass)
268
+        region_name = parameter_defaults.get('KeystoneRegion')
269
+        return overcloudrc.create_overcloudrc(stack, self.no_proxy, admin_pass,
270
+                                              region_name)
269 271
 
270 272
 
271 273
 class DeploymentFailuresAction(base.TripleOAction):

+ 8
- 1
tripleo_common/tests/utils/test_overcloudrc.py View File

@@ -34,7 +34,8 @@ class OvercloudRcTest(base.TestCase):
34 34
             ]
35 35
         }
36 36
 
37
-        result = overcloudrc.create_overcloudrc(stack, "", "AdminPassword")
37
+        result = overcloudrc.create_overcloudrc(stack, "", "AdminPassword",
38
+                                                "regionTwo")
38 39
 
39 40
         self.assertIn("OS_PASSWORD=AdminPassword", result['overcloudrc'])
40 41
         self.assertIn("OS_PASSWORD=AdminPassword", result['overcloudrc.v3'])
@@ -44,3 +45,9 @@ class OvercloudRcTest(base.TestCase):
44 45
         self.assertIn(overcloudrc.CLOUDPROMPT, result['overcloudrc.v3'])
45 46
         self.assertIn("OS_AUTH_TYPE=password", result['overcloudrc'])
46 47
         self.assertIn("OS_AUTH_TYPE=password", result['overcloudrc.v3'])
48
+        self.assertIn("OS_AUTH_URL=http://foo.com:8000/",
49
+                      result['overcloudrc'])
50
+        self.assertIn("OS_AUTH_URL=http://foo.com:8000/",
51
+                      result['overcloudrc.v3'])
52
+        self.assertIn("OS_REGION_NAME=regionTwo",
53
+                      result['overcloudrc'])

+ 2
- 1
tripleo_common/utils/overcloudrc.py View File

@@ -73,7 +73,7 @@ fi
73 73
 """
74 74
 
75 75
 
76
-def create_overcloudrc(stack, no_proxy, admin_password):
76
+def create_overcloudrc(stack, no_proxy, admin_password, region_name):
77 77
     """Given the stack and proxy settings, create the overcloudrc
78 78
 
79 79
     stack: Heat stack containing the deployed overcloud
@@ -104,6 +104,7 @@ def create_overcloudrc(stack, no_proxy, admin_password):
104 104
         'OS_IDENTITY_API_VERSION': '3',
105 105
         'OS_IMAGE_API_VERSION': constants.DEFAULT_IMAGE_API_VERSION,
106 106
         'OS_VOLUME_API_VERSION': constants.DEFAULT_VOLUME_API_VERSION,
107
+        'OS_REGION_NAME': region_name or 'regionOne'
107 108
     }
108 109
 
109 110
     overcloudrc = CLEAR_ENV

Loading…
Cancel
Save