Merge "Allow to actually disable heat-native"

This commit is contained in:
Zuul 2018-10-07 01:46:32 +00:00 committed by Gerrit Code Review
commit 71f51369a0
5 changed files with 31 additions and 12 deletions

View File

@ -157,7 +157,12 @@ class StandaloneConfig(BaseConfig):
),
cfg.BoolOpt('heat_native',
default=True,
help=_('Use native heat templates.')),
help=_('Execute the heat-all process natively on this '
'host. This option requires that the heat-all '
'binaries be installed locally on this machine.'
' This option is enabled by default which means'
' heat-all is executed on the host OS '
' directly.')),
cfg.StrOpt('heat_container_image',
default='',
help=_('URL for the heat container image to use.')

View File

@ -251,7 +251,14 @@ class HeatDockerLauncher(HeatBaseLauncher):
self.container_image, 'heat-all'
]
log.debug(' '.join(cmd))
subprocess.check_call(cmd)
try:
subprocess.check_output(cmd)
except subprocess.CalledProcessError as e:
# 137 means the container was killed by 'kill -9' which happens
# then we're done creating the Heat stack, so we consider it
# as successful.
if e.returncode is not 137:
raise Exception('heat_all container did not run as expected.')
def heat_db_sync(self):

View File

@ -121,6 +121,7 @@ class TestUndercloudInstall(TestPluginV1):
mock_copy, mock_user):
self.conf.config(output_dir='/foo')
self.conf.config(templates='/usertht')
self.conf.config(heat_native='false')
self.conf.config(roles_file='foo/roles.yaml')
arglist = ['--no-validations', '--force-stack-update']
verifylist = []
@ -141,7 +142,7 @@ class TestUndercloudInstall(TestPluginV1):
'--local-ip=192.168.24.1/24',
'--templates=/usertht',
'--roles-file=foo/roles.yaml',
'--heat-native', '-e',
'--heat-native=False', '-e',
'/usertht/environments/docker.yaml', '-e',
'/usertht/environments/undercloud.yaml', '-e',
'/home/stack/foo.yaml', '-e',

View File

@ -450,13 +450,14 @@ class Deploy(command.Command):
def _launch_heat(self, parsed_args):
# we do this as root to chown config files properly for docker, etc.
if parsed_args.heat_native:
self.heat_launch = heat_launcher.HeatNativeLauncher(
if parsed_args.heat_native is not None and \
parsed_args.heat_native.lower() == "false":
self.heat_launch = heat_launcher.HeatDockerLauncher(
parsed_args.heat_api_port,
parsed_args.heat_container_image,
parsed_args.heat_user)
else:
self.heat_launch = heat_launcher.HeatDockerLauncher(
self.heat_launch = heat_launcher.HeatNativeLauncher(
parsed_args.heat_api_port,
parsed_args.heat_container_image,
parsed_args.heat_user)
@ -468,7 +469,8 @@ class Deploy(command.Command):
# it always below.
self.heat_pid = os.fork()
if self.heat_pid == 0:
if parsed_args.heat_native:
if parsed_args.heat_native is not None and \
parsed_args.heat_native.lower() == "true":
try:
uid = pwd.getpwnam(parsed_args.heat_user).pw_uid
gid = pwd.getpwnam(parsed_args.heat_user).pw_gid
@ -853,15 +855,17 @@ class Deploy(command.Command):
parser.add_argument(
'--heat-container-image', metavar='<HEAT_CONTAINER_IMAGE>',
dest='heat_container_image',
default='tripleomaster/centos-binary-heat-all',
default='tripleomaster/centos-binary-heat-all:current-tripleo',
help=_('The container image to use when launching the heat-all '
'process. Defaults to: '
'tripleomaster/centos-binary-heat-all')
'tripleomaster/centos-binary-heat-all:current-tripleo')
)
parser.add_argument(
'--heat-native',
action='store_true',
default=True,
dest='heat_native',
nargs='?',
default=None,
const="true",
help=_('Execute the heat-all process natively on this host. '
'This option requires that the heat-all binaries '
'be installed locally on this machine. '

View File

@ -356,7 +356,9 @@ def prepare_undercloud_deploy(upgrade=False, no_validations=False,
tht_templates,
"environments/lifecycle/undercloud-upgrade-prepare.yaml")]
if CONF.get('heat_native', None):
if not CONF.get('heat_native', False):
deploy_args.append('--heat-native=False')
else:
deploy_args.append('--heat-native')
if CONF.get('heat_container_image'):