SEBA-509 Allow xos-migrate to use relative path
Change-Id: I3251a03b6f29efef92ceb8ab80e3e0414e941646
diff --git a/VERSION b/VERSION
index b1b25a5..5859406 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.2
+2.2.3
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index bfb2026..90ae1e1 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -14,7 +14,7 @@
# xosproject/chameleon
-FROM xosproject/xos-base:2.2.2
+FROM xosproject/xos-base:2.2.3
# xos-base already has protoc and dependencies installed
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index 8253f10..331f503 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -14,7 +14,7 @@
# xosproject/xos-client
-FROM xosproject/xos-libraries:2.2.2
+FROM xosproject/xos-libraries:2.2.3
# Install XOS client
COPY lib/xos-api /tmp/xos-api
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index 24f7bdd..3b87c5a 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -14,7 +14,7 @@
# xosproject/xos-libraries
-FROM xosproject/xos-base:2.2.2
+FROM xosproject/xos-base:2.2.3
# Add libraries
COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index f32b590..b27815a 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -14,7 +14,7 @@
# xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.2.2
+FROM xosproject/xos-client:2.2.3
COPY xos/synchronizers/new_base /opt/xos/synchronizers/new_base
COPY xos/xos/logger.py /opt/xos/xos/logger.py
diff --git a/containers/xos/Dockerfile.xos-core b/containers/xos/Dockerfile.xos-core
index 2e4219d..431f002 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -14,7 +14,7 @@
# xosproject/xos-core
-FROM xosproject/xos-libraries:2.2.2
+FROM xosproject/xos-libraries:2.2.3
# Install XOS
ADD xos /opt/xos
diff --git a/lib/xos-genx/xosgenx/generator.py b/lib/xos-genx/xosgenx/generator.py
index 3e650be..af99a23 100644
--- a/lib/xos-genx/xosgenx/generator.py
+++ b/lib/xos-genx/xosgenx/generator.py
@@ -243,9 +243,9 @@
)
if args.output is not None and not os.path.isabs(args.output):
- raise Exception("[XosGenX] The output dir must be an absolute path!")
+ raise Exception("[XosGenX] The output dir (%s) must be an absolute path!" % args.output)
if args.output is not None and not os.path.isdir(args.output):
- raise Exception("[XosGenX] The output dir must be a directory!")
+ raise Exception("[XosGenX] The output dir (%s) must be a directory!" % args.output)
if hasattr(args, "files"):
inputs = XOSProcessor._read_input_from_files(args.files)
diff --git a/lib/xos-migrate/xosmigrate/main.py b/lib/xos-migrate/xosmigrate/main.py
index 3bea379..3fcbe89 100644
--- a/lib/xos-migrate/xosmigrate/main.py
+++ b/lib/xos-migrate/xosmigrate/main.py
@@ -32,13 +32,20 @@
from xosconfig import Config
from multistructlog import create_logger
-
def get_abs_path(dir_):
+ """ Convert a path specified by the user, which might be relative or based on
+ home directory location, into an absolute path.
+ """
if os.path.isabs(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_)
+ return os.path.abspath(os.path.join(os.getcwd(), dir_))
+
+
+def get_migration_library_path(dir_):
+ """ Return a directory relative to the location of the migration library """
return os.path.dirname(os.path.realpath(__file__)) + "/" + dir_
@@ -265,9 +272,9 @@
# SETTING ENV
-os.environ["LOG_FILE"] = get_abs_path("django.log")
-os.environ["XOS_CONFIG_SCHEMA"] = get_abs_path("migration_cfg_schema.yaml")
-os.environ["XOS_CONFIG_FILE"] = get_abs_path("migration_cfg.yaml")
+os.environ["LOG_FILE"] = get_migration_library_path("django.log")
+os.environ["XOS_CONFIG_SCHEMA"] = get_migration_library_path("migration_cfg_schema.yaml")
+os.environ["XOS_CONFIG_FILE"] = get_migration_library_path("migration_cfg.yaml")
os.environ["MIGRATIONS"] = "true"
# this is populated in case we generate migrations for services and it's used in settings.py
os.environ["INSTALLED_APPS"] = ""