12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- """
- Plugin responsible for post-installation configuration
- """
- from packstack.installer import utils
- from packstack.installer import basedefs
- PLUGIN_NAME = "Postscript"
- PLUGIN_NAME_COLORED = utils.color_text(PLUGIN_NAME, 'blue')
- def initConfig(controller):
- group = {"GROUP_NAME": "POSTSCRIPT",
- "DESCRIPTION": "POSTSCRIPT Config parameters",
- "PRE_CONDITION": lambda x: 'yes',
- "PRE_CONDITION_MATCH": "yes",
- "POST_CONDITION": False,
- "POST_CONDITION_MATCH": True}
- controller.addGroup(group, [])
- def initSequences(controller):
- config = controller.CONF
- postscript_steps = []
- if (config['CONFIG_PROVISION_TEMPEST'] == "y" and
- config['CONFIG_RUN_TEMPEST'] == "y"):
- postscript_steps.append(
- {'title': 'Running Tempest',
- 'functions': [run_tempest]}
- )
- controller.addSequence("Running post install scripts", [], [],
- postscript_steps)
- def run_tempest(config, messages):
- logfile = basedefs.DIR_LOG + "/tempest.log"
- print("Running Tempest on %s" % config['CONFIG_TEMPEST_HOST'])
- server = utils.ScriptRunner(config['CONFIG_TEMPEST_HOST'])
- server.append('pushd /var/lib/tempest')
- server.append('tempest run --regex \'(%s)\' --concurrency 2 > %s'
- % (config['CONFIG_RUN_TEMPEST_TESTS'].replace(' ', '|'),
- logfile))
- server.append('popd')
- server.execute()
|