Fixing a missing file in rpm for pf9-mors

Fixing a missing file in rpm for pf9-mors. Also added a fix for the migration script.

Tested installation through pf9-main ansible script (part of changes on pf9-main)
This commit is contained in:
Roopak Parikh 2016-04-10 14:53:23 -07:00 committed by Roopak Parikh
parent e62bf60096
commit 684cd9f6ae
3 changed files with 12 additions and 3 deletions

View File

@ -4,6 +4,7 @@
import argparse, logging
import ConfigParser
from migrate.versioning.api import upgrade, create, version_control
from migrate.exceptions import DatabaseAlreadyControlledError
def _get_arg_parser():
parser = argparse.ArgumentParser(description="Lease Manager for VirtualMachines")
@ -11,13 +12,20 @@ def _get_arg_parser():
parser.add_argument('--command', dest='command', default='db_sync')
return parser.parse_args()
def _version_control(conf):
try:
version_control(conf.get("DEFAULT", "db_conn"), conf.get("DEFAULT", "repo"))
except DatabaseAlreadyControlledError as e:
print e
# Ignore the already controlled error
if __name__ == '__main__':
parser = _get_arg_parser()
conf = ConfigParser.ConfigParser()
conf.readfp(open(parser.config_file))
if 'db_sync' == parser.command:
version_control(conf.get("DEFAULT", "db_conn"), conf.get("DEFAULT", "repo"))
upgrade(conf.get("DEFAULT", "db_conn"), , conf.get("DEFAULT", "repo"))
_version_control(conf)
upgrade(conf.get("DEFAULT", "db_conn"), conf.get("DEFAULT", "repo"))
exit(0)
else:
print 'Unknown command'

View File

@ -45,4 +45,4 @@ if __name__ == '__main__':
parser = _get_arg_parser()
conf = ConfigParser.ConfigParser()
conf.readfp(open(parser.config_file))
start_server(conf, parser.pate_file)
start_server(conf, parser.paste_file)

View File

@ -40,6 +40,7 @@ ${APP_RPM_VENV}:
stage: $(APP_RPM_DIR) $(APP_RPM_STAGE_DIR) $(APP_RPM_VENV)
cp -r $(SRC_DIR)/etc/ $(APP_RPM_STAGE_DIR)/
cp $(SRC_DIR)/mors_repo/migrate.cfg $(APP_RPM_VENV)/lib/python2.7/site-packages/mors_repo/
${APP_RPM}: stage
echo "RPM build "