[SEBA-492] Fixing migrations template to include CORD copyright

Change-Id: I6a72742517a0605bb83994fe173aca645417cb39
diff --git a/VERSION b/VERSION
index e21e941..8b34a22 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.1.54
+2.1.55
diff --git a/containers/chameleon/Dockerfile.chameleon b/containers/chameleon/Dockerfile.chameleon
index feb82ed..cb72f9b 100644
--- a/containers/chameleon/Dockerfile.chameleon
+++ b/containers/chameleon/Dockerfile.chameleon
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/chameleon
-FROM xosproject/xos-base:2.1.54
+FROM xosproject/xos-base:2.1.55
 
 # xos-base already has protoc and dependencies installed
 
diff --git a/containers/xos/Dockerfile.client b/containers/xos/Dockerfile.client
index c9427b4..95d9efa 100644
--- a/containers/xos/Dockerfile.client
+++ b/containers/xos/Dockerfile.client
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-client
-FROM xosproject/xos-libraries:2.1.54
+FROM xosproject/xos-libraries:2.1.55
 
 
 # Install XOS client
diff --git a/containers/xos/Dockerfile.libraries b/containers/xos/Dockerfile.libraries
index 99013b2..300b915 100644
--- a/containers/xos/Dockerfile.libraries
+++ b/containers/xos/Dockerfile.libraries
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-libraries
-FROM xosproject/xos-base:2.1.54
+FROM xosproject/xos-base:2.1.55
 
 # Add libraries
 COPY lib /opt/xos/lib
diff --git a/containers/xos/Dockerfile.synchronizer-base b/containers/xos/Dockerfile.synchronizer-base
index 3a91c2f..8e2a6d6 100644
--- a/containers/xos/Dockerfile.synchronizer-base
+++ b/containers/xos/Dockerfile.synchronizer-base
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-synchronizer-base
-FROM xosproject/xos-client:2.1.54
+FROM xosproject/xos-client:2.1.55
 
 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 9373d54..18e769b 100644
--- a/containers/xos/Dockerfile.xos-core
+++ b/containers/xos/Dockerfile.xos-core
@@ -13,7 +13,7 @@
 # limitations under the License.
 
 # xosproject/xos-core
-FROM xosproject/xos-libraries:2.1.54
+FROM xosproject/xos-libraries:2.1.55
 
 # Install XOS
 ADD xos /opt/xos
diff --git a/lib/xos-migrate/xosmigrate/main.py b/lib/xos-migrate/xosmigrate/main.py
index 6e0ca77..312477d 100644
--- a/lib/xos-migrate/xosmigrate/main.py
+++ b/lib/xos-migrate/xosmigrate/main.py
@@ -20,7 +20,6 @@
 # eg: xos-migrate -r ~/Sites/cord -s core -s fabric
 
 # TODO
-# - add support for services that are in the cord/orchestration/profiles folders
 # - add support to specify a name to be given to the generated migration (--name parameter in django makemigrations)
 # - add support to generate empty migrations (needed for data-only migrations)
 
@@ -31,7 +30,6 @@
 import shutil
 from xosgenx.generator import XOSProcessor, XOSProcessorArgs
 from xosconfig import Config
-import subprocess
 from multistructlog import create_logger
 
 
@@ -303,7 +301,6 @@
     help="Check if the migrations are generated for a given service. Does not apply any change."
 )
 
-# FIXME this is not working with multistructlog
 parser.add_argument(
     "-v",
     "--verbose",
@@ -334,7 +331,7 @@
 
     log.info("Services: %s" % ", ".join(args.service_names))
 
-    django_cli_args = ["makemigrations"]
+    django_cli_args = ['xos-migrate.py', "makemigrations"]
 
     # generate the code for each service and create a list of parameters to pass to django
     app_list = []
@@ -361,16 +358,20 @@
         django_cli_args.append("--check")
         django_cli_args.append("--dry-run")
 
-    cmd = "python %s %s" % (django_path, " ".join(django_cli_args))
-    result = subprocess.Popen(cmd, shell=True)
-    result.wait()
-    returncode = result.returncode
+    from django.core.management import execute_from_command_line
+
+    try:
+        log.debug("Django CLI Args", args=django_cli_args)
+        execute_from_command_line(django_cli_args)
+        returncode = 0
+    except SystemExit as e:
+        returncode = e.message
 
     if returncode != 0:
         if args.check:
             log.error("Migrations are not up to date with the service changes!")
         else:
-            log.error(result.communicate()[0])
+            log.error("An error occurred")
         sys.exit(returncode)
 
     # copying migrations back to the service