Merge "Ignore missing rendered heat envs in prepare" into stable/pike

This commit is contained in:
Zuul 2017-11-13 22:23:49 +00:00 committed by Gerrit Code Review
commit 6dad59b242
2 changed files with 16 additions and 3 deletions

View File

@ -205,7 +205,9 @@ class TestContainerImagePrepare(TestPluginV1):
self.cmd.take_action(parsed_args)
mock_builder.assert_called_once_with([tmpl_file])
pmef.assert_called_once_with(['environment/docker.yaml'])
pmef.assert_called_once_with(['environment/docker.yaml'],
env_path_is_object=mock.ANY,
object_request=mock.ANY)
cift.assert_called_once_with(
filter=mock.ANY,
name_prefix='os-',
@ -295,7 +297,9 @@ class TestContainerImagePrepare(TestPluginV1):
self.cmd.take_action(parsed_args)
mock_builder.assert_called_once_with([tmpl_file])
pmef.assert_called_once_with(pmef_call_args)
pmef.assert_called_once_with(pmef_call_args,
env_path_is_object=mock.ANY,
object_request=mock.ANY)
cift.assert_called_once_with(
filter=mock.ANY,
name_prefix='os-',

View File

@ -22,10 +22,12 @@ import sys
import tempfile
from heatclient.common import template_utils
from heatclient.common import utils as heat_utils
from osc_lib.command import command
from osc_lib import exceptions as oscexc
from osc_lib.i18n import _
import requests
from six.moves.urllib import request
import yaml
from tripleo_common.image import image_uploader
@ -378,9 +380,16 @@ class PrepareImageFiles(command.Command):
if not environment_files:
return None
def get_env_file(method, path):
if not os.path.exists(path):
return '{}'
env_url = heat_utils.normalise_file_path_to_url(path)
return request.urlopen(env_url).read()
env_files, env = (
template_utils.process_multiple_environments_and_files(
environment_files))
environment_files, env_path_is_object=lambda path: True,
object_request=get_env_file))
enabled_services = self.get_enabled_services(env, roles_file)
containerized_services = set()
for service, env_path in env.get('resource_registry', {}).items():