Refactor manifest execution
Previously, Packstack created many individual manifest files from smaller snippets (templates), and executed them following a certain order. This is sub-optimal, since it forces code duplication and goes against the Puppet design of running a single manifest. This patch refactors the manifest execution, following these principles: - Only 3 templates used, so max 3 Puppet executions on a host: controller manifest, network node manifest, compute node manifest. - The previous snippets are now part of the Packstack Puppet module, and included as needed by the controller/network/compute manifests. This concept is similar to the one used by the puppet-openstack-integration project [1]. - The remaining Python code is left untouched, so we can keep complete compatibility with previous answer files. - Redis HA support has been removed, as this was the only service with HA enabled and didn't fit the general purpose of Packstack. [1] - https://github.com/openstack/puppet-openstack-integration Change-Id: I87591be0fce98079c85c5c12ad76ea7115fb9c75
This commit is contained in:
@@ -23,9 +23,6 @@ from packstack.installer import utils
|
||||
|
||||
from packstack.modules.common import filtered_hosts
|
||||
from packstack.modules.documentation import update_params_usage
|
||||
from packstack.modules.ospluginutils import appendManifestFile
|
||||
from packstack.modules.ospluginutils import createFirewallResources
|
||||
from packstack.modules.ospluginutils import getManifestTemplate
|
||||
|
||||
# ------------- MariaDB Packstack Plugin Initialization --------------
|
||||
|
||||
@@ -89,7 +86,7 @@ def initConfig(controller):
|
||||
|
||||
def initSequences(controller):
|
||||
mariadbsteps = [
|
||||
{'title': 'Adding MariaDB manifest entries',
|
||||
{'title': 'Preparing MariaDB entries',
|
||||
'functions': [create_manifest]}
|
||||
]
|
||||
controller.addSequence("Installing MariaDB", [], [], mariadbsteps)
|
||||
@@ -99,10 +96,8 @@ def initSequences(controller):
|
||||
|
||||
def create_manifest(config, messages):
|
||||
if config['CONFIG_MARIADB_INSTALL'] == 'y':
|
||||
suffix = 'install'
|
||||
host = config['CONFIG_MARIADB_HOST']
|
||||
else:
|
||||
suffix = 'noinstall'
|
||||
host = config['CONFIG_CONTROLLER_HOST']
|
||||
|
||||
if config['CONFIG_IP_VERSION'] == 'ipv6':
|
||||
@@ -110,30 +105,8 @@ def create_manifest(config, messages):
|
||||
else:
|
||||
config['CONFIG_MARIADB_HOST_URL'] = host
|
||||
|
||||
manifestfile = "%s_mariadb.pp" % host
|
||||
manifestdata = [getManifestTemplate('mariadb_%s' % suffix)]
|
||||
|
||||
def append_for(module, suffix):
|
||||
# Modules have to be appended to the existing mysql.pp
|
||||
# otherwise pp will fail for some of them saying that
|
||||
# Mysql::Config definition is missing.
|
||||
template = "mariadb_%s_%s" % (module, suffix)
|
||||
manifestdata.append(getManifestTemplate(template))
|
||||
|
||||
append_for("keystone", suffix)
|
||||
for mod in ['nova', 'cinder', 'glance', 'neutron', 'heat', 'sahara',
|
||||
'trove', 'ironic', 'manila']:
|
||||
if config['CONFIG_%s_INSTALL' % mod.upper()] == 'y':
|
||||
append_for(mod, suffix)
|
||||
|
||||
if (config['CONFIG_GNOCCHI_INSTALL'] == 'y' and
|
||||
config['CONFIG_CEILOMETER_INSTALL'] == 'y'):
|
||||
append_for('gnocchi', suffix)
|
||||
|
||||
hosts = filtered_hosts(config, exclude=False, dbhost=True)
|
||||
|
||||
fw_details = dict()
|
||||
for host in hosts:
|
||||
for host in filtered_hosts(config, exclude=False, dbhost=True):
|
||||
key = "mariadb_%s" % host
|
||||
fw_details.setdefault(key, {})
|
||||
fw_details[key]['host'] = "%s" % host
|
||||
@@ -142,6 +115,3 @@ def create_manifest(config, messages):
|
||||
fw_details[key]['ports'] = ['3306']
|
||||
fw_details[key]['proto'] = "tcp"
|
||||
config['FIREWALL_MARIADB_RULES'] = fw_details
|
||||
|
||||
manifestdata.append(createFirewallResources('FIREWALL_MARIADB_RULES'))
|
||||
appendManifestFile(manifestfile, "\n".join(manifestdata), 'pre')
|
||||
|
Reference in New Issue
Block a user