Prepare defaults, defer detecting undercloud registry

Now that the undercloud is containerized, the following command will
sometimes need to be run before the undercloud is installed:

  openstack tripleo container image prepare default --local-push-destination

Doing this currently results in push_destination:localhost:8787
because the required network interface doesn't yet exist for the
registry detection logic.

This change will make push_destination be set to True, so that the
registry address is detected at upload time, which is late enough in
the undercloud install to actually work.

Change-Id: I69a30be9372dc2349b3339019be9d45b632f4a74
Closes-Bug: #1783204
Depends-On: I8a35755ac28c419490159f3cb0f60b7d54f3958d
This commit is contained in:
Steve Baker 2018-07-25 14:01:21 +12:00
parent a33b1499d7
commit 205431b179
2 changed files with 3 additions and 6 deletions

View File

@ -410,15 +410,13 @@ class TestTripleoImagePrepareDefault(TestPluginV1):
}
self.assertEqual(expected, yaml.safe_load(result))
@mock.patch('tripleo_common.image.image_uploader.get_undercloud_registry')
def test_prepare_default_local_registry(self, mock_gur):
def test_prepare_default_local_registry(self):
temp = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, temp)
env_file = os.path.join(temp, 'containers_env.yaml')
arglist = ['--local-push-destination', '--output-env-file', env_file]
verifylist = []
mock_gur.return_value = '192.0.2.1:8787'
self.app.command_options = [
'tripleo', 'container', 'image', 'prepare', 'default'
@ -431,7 +429,7 @@ class TestTripleoImagePrepareDefault(TestPluginV1):
with open(env_file) as f:
result = yaml.safe_load(f)
self.assertEqual(
'192.0.2.1:8787',
True,
result['parameter_defaults']['ContainerImagePrepare']
[0]['push_destination']
)

View File

@ -523,9 +523,8 @@ class TripleOImagePrepareDefault(command.Command):
cip = copy.deepcopy(kolla_builder.CONTAINER_IMAGE_PREPARE_PARAM)
if parsed_args.push_destination:
local_registry = image_uploader.get_undercloud_registry()
for entry in cip:
entry['push_destination'] = local_registry
entry['push_destination'] = True
params = {
'ContainerImagePrepare': cip
}