Adds Hiera implementation within Packstack
Packstack configures Hiera as data backend. Packstack puppet templates are now using hiera() and hiera_array() functions to fetch data from hiera backend. Packstack generates a defaults.yaml file in the /var/tmp/packstack directory. Firewall rules for each openstack components are inserted into the hiera backend as hash and created by the create_resources function. Change-Id: Iab553a71264b0fc0f26d33a6304b545ad302f664 Fixes: rhbz#1145223 Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
This commit is contained in:
committed by
Lukas Bezdicka
parent
a0454d82fa
commit
219cf98b4f
@@ -2,6 +2,7 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import yaml
|
||||
|
||||
from packstack.installer import basedefs
|
||||
from packstack.installer.setup_controller import Controller
|
||||
@@ -11,6 +12,7 @@ controller = Controller()
|
||||
|
||||
PUPPET_DIR = os.path.join(basedefs.DIR_PROJECT_DIR, "puppet")
|
||||
PUPPET_TEMPLATE_DIR = os.path.join(PUPPET_DIR, "templates")
|
||||
HIERA_DEFAULTS_YAML = os.path.join(basedefs.HIERADATA_DIR, "defaults.yaml")
|
||||
|
||||
|
||||
class NovaConfig(object):
|
||||
@@ -80,6 +82,19 @@ def appendManifestFile(manifest_name, data, marker=''):
|
||||
manifestfiles.addFile(manifest_name, marker, data)
|
||||
|
||||
|
||||
def generateHieraDataFile():
|
||||
os.mkdir(basedefs.HIERADATA_DIR, 0700)
|
||||
with open(HIERA_DEFAULTS_YAML, 'w') as outfile:
|
||||
outfile.write(yaml.dump(controller.CONF,
|
||||
explicit_start=True,
|
||||
default_flow_style=False))
|
||||
|
||||
|
||||
def createFirewallResources(hiera_key, default_value='{}'):
|
||||
hiera_function = "hiera('%s', %s)" % (hiera_key, default_value)
|
||||
return "create_resources(packstack::firewall, %s)\n\n" % hiera_function
|
||||
|
||||
|
||||
def gethostlist(CONF):
|
||||
hosts = []
|
||||
for key, value in CONF.items():
|
||||
|
||||
Reference in New Issue
Block a user