Consolidate module constants.
3 separate places had hardcoded values for the t-h-t directory. Many values are/will be shared, this patch consolidates them to avoid having them diverge in the future. Depends-On: I98e19cc29d69cbd6636cd4ce77a07c7a0e3dc048 Change-Id: I205569f4be0bcee2b284048dec7ddf0b28bbd8a1
This commit is contained in:
parent
2aac09de13
commit
59c5e4d980
85
tripleoclient/constants.py
Normal file
85
tripleoclient/constants.py
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# Copyright 2015 Red Hat, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
WEBROOT = '/dashboard/'
|
||||||
|
|
||||||
|
SERVICE_LIST = {
|
||||||
|
'ceilometer': {'password_field': 'OVERCLOUD_CEILOMETER_PASSWORD'},
|
||||||
|
'cinder': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
|
||||||
|
'cinderv2': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
|
||||||
|
'glance': {'password_field': 'OVERCLOUD_GLANCE_PASSWORD'},
|
||||||
|
'heat': {'password_field': 'OVERCLOUD_HEAT_PASSWORD'},
|
||||||
|
'neutron': {'password_field': 'OVERCLOUD_NEUTRON_PASSWORD'},
|
||||||
|
'nova': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
|
||||||
|
'novav3': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
|
||||||
|
'swift': {'password_field': 'OVERCLOUD_SWIFT_PASSWORD'},
|
||||||
|
'horizon': {
|
||||||
|
'port': '80',
|
||||||
|
'path': WEBROOT,
|
||||||
|
'admin_path': '%sadmin' % WEBROOT},
|
||||||
|
}
|
||||||
|
|
||||||
|
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
||||||
|
OVERCLOUD_YAML_NAME = "overcloud-without-mergepy.yaml"
|
||||||
|
RESOURCE_REGISTRY_NAME = "overcloud-resource-registry-puppet.yaml"
|
||||||
|
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
||||||
|
"extraconfig/post_deploy/rhel-registration/")
|
||||||
|
|
||||||
|
PARAMETERS = {
|
||||||
|
'AdminPassword': None,
|
||||||
|
'AdminToken': None,
|
||||||
|
'CeilometerPassword': None,
|
||||||
|
'CeilometerMeteringSecret': None,
|
||||||
|
'CinderPassword': None,
|
||||||
|
'CinderISCSIHelper': 'lioadm',
|
||||||
|
'CloudName': 'overcloud',
|
||||||
|
'ExtraConfig': '{}',
|
||||||
|
'GlancePassword': None,
|
||||||
|
'HeatPassword': None,
|
||||||
|
'HeatStackDomainAdminPassword': None,
|
||||||
|
'NeutronControlPlaneID': None,
|
||||||
|
'NeutronDnsmasqOptions': 'dhcp-option-force=26,1400',
|
||||||
|
'NeutronPassword': None,
|
||||||
|
'NeutronPublicInterface': 'nic1',
|
||||||
|
'NeutronFlatNetworks': 'datacentre',
|
||||||
|
'HypervisorNeutronPhysicalBridge': 'br-ex',
|
||||||
|
'NeutronBridgeMappings': 'datacentre:br-ex',
|
||||||
|
'HypervisorNeutronPublicInterface': 'nic1',
|
||||||
|
'NovaPassword': None,
|
||||||
|
'SwiftHashSuffix': None,
|
||||||
|
'SwiftPassword': None,
|
||||||
|
'SnmpdReadonlyUserPassword': None,
|
||||||
|
'NtpServer': '',
|
||||||
|
'controllerImage': 'overcloud-full',
|
||||||
|
'NovaImage': 'overcloud-full',
|
||||||
|
'BlockStorageImage': 'overcloud-full',
|
||||||
|
'SwiftStorageImage': 'overcloud-full',
|
||||||
|
'CephStorageImage': 'overcloud-full',
|
||||||
|
'OvercloudControlFlavor': 'baremetal',
|
||||||
|
'OvercloudComputeFlavor': 'baremetal',
|
||||||
|
'OvercloudBlockStorageFlavor': 'baremetal',
|
||||||
|
'OvercloudSwiftStorageFlavor': 'baremetal',
|
||||||
|
'OvercloudCephStorageFlavor': 'baremetal',
|
||||||
|
'NeutronNetworkVLANRanges': 'datacentre:1:1000',
|
||||||
|
}
|
||||||
|
|
||||||
|
NEW_STACK_PARAMETERS = {
|
||||||
|
'NovaComputeLibvirtType': 'kvm',
|
||||||
|
'NeutronTunnelIdRanges': ['1:1000'],
|
||||||
|
'NeutronVniRanges': ['1:1000'],
|
||||||
|
'NeutronEnableTunnelling': 'True',
|
||||||
|
'NeutronNetworkType': 'gre',
|
||||||
|
'NeutronTunnelTypes': 'gre',
|
||||||
|
}
|
@ -31,25 +31,6 @@ from heatclient.exc import HTTPNotFound
|
|||||||
from tripleoclient import exceptions
|
from tripleoclient import exceptions
|
||||||
|
|
||||||
|
|
||||||
WEBROOT = '/dashboard/'
|
|
||||||
|
|
||||||
SERVICE_LIST = {
|
|
||||||
'ceilometer': {'password_field': 'OVERCLOUD_CEILOMETER_PASSWORD'},
|
|
||||||
'cinder': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
|
|
||||||
'cinderv2': {'password_field': 'OVERCLOUD_CINDER_PASSWORD'},
|
|
||||||
'glance': {'password_field': 'OVERCLOUD_GLANCE_PASSWORD'},
|
|
||||||
'heat': {'password_field': 'OVERCLOUD_HEAT_PASSWORD'},
|
|
||||||
'neutron': {'password_field': 'OVERCLOUD_NEUTRON_PASSWORD'},
|
|
||||||
'nova': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
|
|
||||||
'novav3': {'password_field': 'OVERCLOUD_NOVA_PASSWORD'},
|
|
||||||
'swift': {'password_field': 'OVERCLOUD_SWIFT_PASSWORD'},
|
|
||||||
'horizon': {
|
|
||||||
'port': '80',
|
|
||||||
'path': WEBROOT,
|
|
||||||
'admin_path': '%sadmin' % WEBROOT},
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
_MIN_PASSWORD_SIZE = 25
|
_MIN_PASSWORD_SIZE = 25
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,62 +36,10 @@ from os_cloud_config.utils import clients
|
|||||||
from six.moves import configparser
|
from six.moves import configparser
|
||||||
from tripleo_common import update
|
from tripleo_common import update
|
||||||
|
|
||||||
|
from tripleoclient import constants
|
||||||
from tripleoclient import exceptions
|
from tripleoclient import exceptions
|
||||||
from tripleoclient import utils
|
from tripleoclient import utils
|
||||||
|
|
||||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
|
||||||
OVERCLOUD_YAML_NAME = "overcloud-without-mergepy.yaml"
|
|
||||||
RESOURCE_REGISTRY_NAME = "overcloud-resource-registry-puppet.yaml"
|
|
||||||
RHEL_REGISTRATION_EXTRACONFIG_NAME = (
|
|
||||||
"extraconfig/pre_deploy/rhel-registration/")
|
|
||||||
|
|
||||||
PARAMETERS = {
|
|
||||||
'AdminPassword': None,
|
|
||||||
'AdminToken': None,
|
|
||||||
'CeilometerPassword': None,
|
|
||||||
'CeilometerMeteringSecret': None,
|
|
||||||
'CinderPassword': None,
|
|
||||||
'CinderISCSIHelper': 'lioadm',
|
|
||||||
'CloudName': 'overcloud',
|
|
||||||
'ExtraConfig': '{}',
|
|
||||||
'GlancePassword': None,
|
|
||||||
'HeatPassword': None,
|
|
||||||
'HeatStackDomainAdminPassword': None,
|
|
||||||
'NeutronControlPlaneID': None,
|
|
||||||
'NeutronDnsmasqOptions': 'dhcp-option-force=26,1400',
|
|
||||||
'NeutronPassword': None,
|
|
||||||
'NeutronPublicInterface': 'nic1',
|
|
||||||
'NeutronFlatNetworks': 'datacentre',
|
|
||||||
'HypervisorNeutronPhysicalBridge': 'br-ex',
|
|
||||||
'NeutronBridgeMappings': 'datacentre:br-ex',
|
|
||||||
'HypervisorNeutronPublicInterface': 'nic1',
|
|
||||||
'NovaPassword': None,
|
|
||||||
'SwiftHashSuffix': None,
|
|
||||||
'SwiftPassword': None,
|
|
||||||
'SnmpdReadonlyUserPassword': None,
|
|
||||||
'NtpServer': '',
|
|
||||||
'controllerImage': 'overcloud-full',
|
|
||||||
'NovaImage': 'overcloud-full',
|
|
||||||
'BlockStorageImage': 'overcloud-full',
|
|
||||||
'SwiftStorageImage': 'overcloud-full',
|
|
||||||
'CephStorageImage': 'overcloud-full',
|
|
||||||
'OvercloudControlFlavor': 'baremetal',
|
|
||||||
'OvercloudComputeFlavor': 'baremetal',
|
|
||||||
'OvercloudBlockStorageFlavor': 'baremetal',
|
|
||||||
'OvercloudSwiftStorageFlavor': 'baremetal',
|
|
||||||
'OvercloudCephStorageFlavor': 'baremetal',
|
|
||||||
'NeutronNetworkVLANRanges': 'datacentre:1:1000',
|
|
||||||
}
|
|
||||||
|
|
||||||
NEW_STACK_PARAMETERS = {
|
|
||||||
'NovaComputeLibvirtType': 'kvm',
|
|
||||||
'NeutronTunnelIdRanges': ['1:1000'],
|
|
||||||
'NeutronVniRanges': ['1:1000'],
|
|
||||||
'NeutronEnableTunnelling': 'True',
|
|
||||||
'NeutronNetworkType': 'gre',
|
|
||||||
'NeutronTunnelTypes': 'gre',
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class DeployOvercloud(command.Command):
|
class DeployOvercloud(command.Command):
|
||||||
"""Deploy Overcloud"""
|
"""Deploy Overcloud"""
|
||||||
@ -133,9 +81,9 @@ class DeployOvercloud(command.Command):
|
|||||||
undercloud_ceilometer_snmpd_password)
|
undercloud_ceilometer_snmpd_password)
|
||||||
|
|
||||||
def _update_paramaters(self, args, network_client, stack):
|
def _update_paramaters(self, args, network_client, stack):
|
||||||
parameters = PARAMETERS.copy()
|
parameters = constants.PARAMETERS.copy()
|
||||||
if stack is None:
|
if stack is None:
|
||||||
parameters.update(NEW_STACK_PARAMETERS)
|
parameters.update(constants.NEW_STACK_PARAMETERS)
|
||||||
|
|
||||||
self.log.debug("Generating overcloud passwords")
|
self.log.debug("Generating overcloud passwords")
|
||||||
self.set_overcloud_passwords(parameters, args)
|
self.set_overcloud_passwords(parameters, args)
|
||||||
@ -227,14 +175,17 @@ class DeployOvercloud(command.Command):
|
|||||||
return parameters
|
return parameters
|
||||||
|
|
||||||
def _create_registration_env(self, args):
|
def _create_registration_env(self, args):
|
||||||
|
|
||||||
tht_root = args.templates
|
tht_root = args.templates
|
||||||
|
|
||||||
environment = os.path.join(tht_root,
|
environment = os.path.join(
|
||||||
RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
tht_root,
|
||||||
'environment-rhel-registration.yaml')
|
constants.RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
||||||
registry = os.path.join(tht_root, RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
'environment-rhel-registration.yaml')
|
||||||
'rhel-registration-resource-registry.yaml')
|
registry = os.path.join(
|
||||||
|
tht_root,
|
||||||
|
constants.RHEL_REGISTRATION_EXTRACONFIG_NAME,
|
||||||
|
'rhel-registration-resource-registry.yaml')
|
||||||
|
|
||||||
user_env = ("parameter_defaults:\n"
|
user_env = ("parameter_defaults:\n"
|
||||||
" rhel_reg_method: \"%(method)s\"\n"
|
" rhel_reg_method: \"%(method)s\"\n"
|
||||||
" rhel_reg_org: \"%(org)s\"\n"
|
" rhel_reg_org: \"%(org)s\"\n"
|
||||||
@ -363,8 +314,8 @@ class DeployOvercloud(command.Command):
|
|||||||
# default resource registry file should be passed only
|
# default resource registry file should be passed only
|
||||||
# when creating a new stack, otherwise it might overwrite
|
# when creating a new stack, otherwise it might overwrite
|
||||||
# resource_registries in existing stack
|
# resource_registries in existing stack
|
||||||
resource_registry_path = os.path.join(tht_root,
|
resource_registry_path = os.path.join(
|
||||||
RESOURCE_REGISTRY_NAME)
|
tht_root, constants.RESOURCE_REGISTRY_NAME)
|
||||||
environments.extend([resource_registry_path, env_path])
|
environments.extend([resource_registry_path, env_path])
|
||||||
|
|
||||||
environments.extend(self._create_parameters_env(parameters))
|
environments.extend(self._create_parameters_env(parameters))
|
||||||
@ -374,7 +325,7 @@ class DeployOvercloud(command.Command):
|
|||||||
if parsed_args.environment_files:
|
if parsed_args.environment_files:
|
||||||
environments.extend(parsed_args.environment_files)
|
environments.extend(parsed_args.environment_files)
|
||||||
|
|
||||||
overcloud_yaml = os.path.join(tht_root, OVERCLOUD_YAML_NAME)
|
overcloud_yaml = os.path.join(tht_root, constants.OVERCLOUD_YAML_NAME)
|
||||||
|
|
||||||
self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters,
|
self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters,
|
||||||
environments, parsed_args.timeout)
|
environments, parsed_args.timeout)
|
||||||
@ -474,7 +425,7 @@ class DeployOvercloud(command.Command):
|
|||||||
data.pop('ssl_port', None)
|
data.pop('ssl_port', None)
|
||||||
|
|
||||||
services = {}
|
services = {}
|
||||||
for service, data in six.iteritems(utils.SERVICE_LIST):
|
for service, data in six.iteritems(constants.SERVICE_LIST):
|
||||||
service_data = data.copy()
|
service_data = data.copy()
|
||||||
service_data.pop('password_field', None)
|
service_data.pop('password_field', None)
|
||||||
password_field = data.get('password_field')
|
password_field = data.get('password_field')
|
||||||
@ -778,7 +729,7 @@ class DeployOvercloud(command.Command):
|
|||||||
add_help=False
|
add_help=False
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
|
||||||
help=_("The directory containing the Heat templates to deploy"),
|
help=_("The directory containing the Heat templates to deploy"),
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
@ -19,7 +19,7 @@ from cliff import command
|
|||||||
from openstackclient.common import utils
|
from openstackclient.common import utils
|
||||||
from tripleo_common import scale
|
from tripleo_common import scale
|
||||||
|
|
||||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
from tripleoclient import constants
|
||||||
|
|
||||||
|
|
||||||
class DeleteNode(command.Command):
|
class DeleteNode(command.Command):
|
||||||
@ -36,7 +36,7 @@ class DeleteNode(command.Command):
|
|||||||
'(default=Env: OVERCLOUD_STACK_NAME)',
|
'(default=Env: OVERCLOUD_STACK_NAME)',
|
||||||
default=utils.env('OVERCLOUD_STACK_NAME'))
|
default=utils.env('OVERCLOUD_STACK_NAME'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
|
||||||
help="The directory containing the Heat templates to deploy"
|
help="The directory containing the Heat templates to deploy"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -20,7 +20,7 @@ from openstackclient.common import utils
|
|||||||
from openstackclient.i18n import _
|
from openstackclient.i18n import _
|
||||||
from tripleo_common import update
|
from tripleo_common import update
|
||||||
|
|
||||||
TRIPLEO_HEAT_TEMPLATES = "/usr/share/openstack-tripleo-heat-templates/"
|
from tripleoclient import constants
|
||||||
|
|
||||||
|
|
||||||
class UpdateOvercloud(command.Command):
|
class UpdateOvercloud(command.Command):
|
||||||
@ -36,7 +36,7 @@ class UpdateOvercloud(command.Command):
|
|||||||
'(default=Env: OVERCLOUD_STACK_NAME)'),
|
'(default=Env: OVERCLOUD_STACK_NAME)'),
|
||||||
default=utils.env('OVERCLOUD_STACK_NAME'))
|
default=utils.env('OVERCLOUD_STACK_NAME'))
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--templates', nargs='?', const=TRIPLEO_HEAT_TEMPLATES,
|
'--templates', nargs='?', const=constants.TRIPLEO_HEAT_TEMPLATES,
|
||||||
help=_("The directory containing the Heat templates to deploy"),
|
help=_("The directory containing the Heat templates to deploy"),
|
||||||
required=True
|
required=True
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user