Removed some duplicate code
Duplicate code in manifest generation
This commit is contained in:
@@ -11,6 +11,8 @@ import packstack.installer.engine_validators as validate
|
||||
from packstack.installer import basedefs
|
||||
import packstack.installer.common_utils as utils
|
||||
|
||||
from packstack.modules.ospluginutils import getManifestTemplate, appendManifestFile
|
||||
|
||||
# Controller object will be initialized from main flow
|
||||
controller = None
|
||||
|
||||
@@ -20,9 +22,6 @@ PLUGIN_NAME_COLORED = utils.getColoredText(PLUGIN_NAME, basedefs.BLUE)
|
||||
|
||||
logging.debug("plugin %s loaded", __name__)
|
||||
|
||||
PUPPET_MANIFEST_TEMPLATE = os.path.join(basedefs.DIR_PROJECT_DIR, 'puppet/templates/openstack_client.pp')
|
||||
|
||||
|
||||
def initConfig(controllerObject):
|
||||
global controller
|
||||
controller = controllerObject
|
||||
@@ -62,17 +61,6 @@ def initSequences(controller):
|
||||
controller.addSequence("Installing OpenStack Client", [], [], osclientsteps)
|
||||
|
||||
def createmanifest():
|
||||
with open(PUPPET_MANIFEST_TEMPLATE) as fp:
|
||||
manifestdata = fp.read()
|
||||
manifestdata = manifestdata%controller.CONF
|
||||
|
||||
if not os.path.exists(basedefs.PUPPET_MANIFEST_DIR):
|
||||
os.mkdir(basedefs.PUPPET_MANIFEST_DIR)
|
||||
manifestfile = os.path.join(basedefs.PUPPET_MANIFEST_DIR, "%s_osclient.pp"%controller.CONF['CONFIG_OSCLIENT_HOST'])
|
||||
if manifestfile not in controller.CONF['CONFIG_MANIFESTFILES']:
|
||||
controller.CONF['CONFIG_MANIFESTFILES'].append(manifestfile)
|
||||
|
||||
with open(manifestfile, 'a') as fp:
|
||||
fp.write("\n")
|
||||
fp.write(manifestdata)
|
||||
|
||||
manifestfile = "%s_osclient.pp"%controller.CONF['CONFIG_OSCLIENT_HOST']
|
||||
manifestdata = getManifestTemplate("openstack_client.pp")
|
||||
appendManifestFile(manifestfile, manifestdata)
|
||||
|
||||
Reference in New Issue
Block a user