Browse Source

Merge "Automatically run overcloud export when using ephemeral heat"

changes/57/787157/2
Zuul 2 weeks ago
committed by Gerrit Code Review
parent
commit
ddef2fb6f2
4 changed files with 42 additions and 13 deletions
  1. +3
    -0
      tripleoclient/export.py
  2. +13
    -0
      tripleoclient/utils.py
  3. +18
    -0
      tripleoclient/v1/overcloud_deploy.py
  4. +8
    -13
      tripleoclient/v1/overcloud_export.py

+ 3
- 0
tripleoclient/export.py View File

@ -91,6 +91,9 @@ def export_stack(heat, stack, should_filter=False,
file = os.path.join(config_download_dir,
stack,
export_param["file"])
if not os.path.exists(file):
LOG.warning('File %s was not found during export' %
file)
with open(file, 'r') as ff:
try:
export_data = json.load(ff)


+ 13
- 0
tripleoclient/utils.py View File

@ -68,6 +68,7 @@ from tripleo_common.utils import stack as stack_utils
from tripleo_common import update
from tripleoclient import constants
from tripleoclient import exceptions
from tripleoclient import export
from tripleoclient import heat_launcher
try:
@ -2636,3 +2637,15 @@ def get_default_working_dir(stack):
return os.path.join(
os.path.expanduser('~'),
"overcloud-deploy", stack)
def export_overcloud(heat, stack, excludes, should_filter,
config_download_dir):
data = export.export_passwords(heat, stack, excludes)
data.update(export.export_stack(
heat, stack, should_filter, config_download_dir))
# do not add extra host entries for VIPs for stacks deployed off that
# exported data, since it already contains those entries
data.update({'AddVipsToEtcHosts': False})
data = dict(parameter_defaults=data)
return data

+ 18
- 0
tripleoclient/v1/overcloud_deploy.py View File

@ -1200,6 +1200,24 @@ class DeployOvercloud(command.Command):
utils.copy_clouds_yaml(user)
utils.create_tempest_deployer_input(output_dir=self.working_dir)
try:
if (parsed_args.heat_type != 'installed' and
parsed_args.config_download):
# Create overcloud export
data = utils.export_overcloud(
self.orchestration_client,
parsed_args.stack, True, False,
config_download_dir)
export_file = os.path.join(
self.working_dir, "%s-export.yaml" % parsed_args.stack)
# write the exported data
with open(export_file, 'w') as f:
yaml.safe_dump(data, f, default_flow_style=False)
os.chmod(export_file, 0o600)
except Exception as e:
self.log.error('Exception creating overcloud export.')
self.log.error(e)
print("Overcloud Endpoint: {0}".format(overcloud_endpoint))
print("Overcloud Horizon Dashboard URL: {0}".format(horizon_url))
print("Overcloud rc file: {} and {}".format(


+ 8
- 13
tripleoclient/v1/overcloud_export.py View File

@ -16,10 +16,10 @@ import os.path
import yaml
from osc_lib.i18n import _
from osc_lib import utils
from osc_lib import utils as osc_utils
from tripleoclient import command
from tripleoclient import export
from tripleoclient import utils
class ExportOvercloud(command.Command):
@ -36,8 +36,9 @@ class ExportOvercloud(command.Command):
help=_('Name of the environment main Heat stack '
'to export information from. '
'(default=Env: OVERCLOUD_STACK_NAME)'),
default=utils.env('OVERCLOUD_STACK_NAME',
default='overcloud'))
default=osc_utils.env(
'OVERCLOUD_STACK_NAME',
default='overcloud'))
parser.add_argument('--output-file', '-o', metavar='<output file>',
help=_('Name of the output file for the stack '
'data export. It will default to '
@ -86,15 +87,9 @@ class ExportOvercloud(command.Command):
# prepare clients to access the environment
clients = self.app.client_manager
heat = clients.orchestration
data = export.export_passwords(heat, stack,
not parsed_args.no_password_excludes)
data.update(export.export_stack(
heat, stack, False, config_download_dir))
# do not add extra host entries for VIPs for stacks deployed off that
# exported data, since it already contains those entries
data.update({'AddVipsToEtcHosts': False})
data = dict(parameter_defaults=data)
data = utils.export_overcloud(
heat, stack, excludes=not parsed_args.no_password_excludes,
should_filter=False, config_download_dir=config_download_dir)
# write the exported data
with open(output_file, 'w') as f:
yaml.safe_dump(data, f, default_flow_style=False)


Loading…
Cancel
Save