[SEBA-477] Removing service generated migrations from the core repository and expanding documentation
Change-Id: If6353db935c82ac2e40cb67bf81b7d245fe1252a
diff --git a/lib/xos-migrate/xosmigrate/main.py b/lib/xos-migrate/xosmigrate/main.py
index e6901e2..f4620de 100644
--- a/lib/xos-migrate/xosmigrate/main.py
+++ b/lib/xos-migrate/xosmigrate/main.py
@@ -36,7 +36,7 @@
def get_abs_path(dir_):
if os.path.isabs(dir_):
- return dir_
+ return os.path.realpath(dir_)
if dir_[0] == '~' and not os.path.exists(dir_):
dir_ = os.path.expanduser(dir_)
return os.path.abspath(dir_)
@@ -54,8 +54,6 @@
log.info(r"---------------------------------------------------------------")
log.debug("CORD repo root", root=root)
log.debug("Storing logs in: %s" % os.environ["LOG_FILE"])
- # log.debug("Config schema: %s" % os.environ['XOS_CONFIG_SCHEMA'])
- # log.debug("Config: %s" % os.environ['XOS_CONFIG_FILE'])
log.debug(r"---------------------------------------------------------------")
@@ -207,13 +205,14 @@
:param service_name: string (name of the service)
:return: void
"""
- # FIXME Django eats this message
log.debug("Copying %s migrations to %s" % (service_name, service_dir))
migration_dir = os.path.join(service_dest_dir, service_name, "migrations")
dest_dir = os.path.join(service_dir, "xos", "synchronizer", "migrations")
if os.path.isdir(dest_dir):
shutil.rmtree(dest_dir) # empty the folder, we'll copy everything again
shutil.copytree(migration_dir, dest_dir)
+ # clean after the tool, generated migrations has been moved in the service repo
+ shutil.rmtree(get_abs_path(os.path.join(migration_dir, "../")))
def monkey_patch_migration_template():