Move 'launchpad' directory to 'RIFT_VAR_ROOT' from 'RIFT_ARTIFACTS' 42/1742/1
authorAnurag Dwivedi <anurag.dwivedi@riftio.com>
Wed, 3 May 2017 06:28:44 +0000 (02:28 -0400)
committerAnurag Dwivedi <anurag.dwivedi@riftio.com>
Wed, 3 May 2017 06:28:44 +0000 (02:28 -0400)
RIFT-16393, RIFT-15616

Signed-off-by: Anurag Dwivedi <anurag.dwivedi@riftio.com>
24 files changed:
common/python/rift/mano/config_data/config.py
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/RiftCA.py
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/RiftCM_rpc.py
rwcm/plugins/rwconman/rift/tasklets/rwconmantasklet/jujuconf.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/charm.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/config.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/package/store.py
rwlaunchpad/plugins/rwlaunchpadtasklet/rift/tasklets/rwlaunchpad/uploader.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_export.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_onboard.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_package.py
rwlaunchpad/plugins/rwlaunchpadtasklet/test/utest_uploader_app_dts.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/openmano_nsm.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
rwlaunchpad/plugins/rwpkgmgr/test/utest_filesystem_proxy_dts.py
rwlaunchpad/plugins/rwpkgmgr/test/utest_publisher_dts.py
rwlaunchpad/plugins/rwpkgmgr/test/utest_subscriber_dts.py
rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/server/handler.py
rwlaunchpad/plugins/rwstagingmgr/rift/tasklets/rwstagingmgr/store/file_store.py
rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py
rwlaunchpad/test/mano_ut.py
rwlaunchpad/test/tosca_ut.py
rwlaunchpad/test/utest_ro_account.py
rwlaunchpad/test/utest_rwnsm.py

index 63a2e48..e1a20c9 100644 (file)
@@ -352,7 +352,7 @@ class ConfigPrimitiveConvertor(object):
 
 class ConfigStore(object):
     """Convenience class that fetches all the instance related data from the
-    $RIFT_ARTIFACTS/launchpad/libs directory.
+    $RIFT_VAR_ROOT/launchpad/libs directory.
     """
 
     def __init__(self, log):
@@ -372,7 +372,7 @@ class ConfigStore(object):
                        the member index ref.
         """
         nsd_archive = os.path.join(
-            os.getenv('RIFT_ARTIFACTS'),
+            os.getenv('RIFT_VAR_ROOT'),
             "launchpad/libs",
             nsd_id,
             "config")
@@ -406,7 +406,7 @@ class ConfigStore(object):
 
     def merge_nsd_config(self, nsd):
         nsd_archive = os.path.join(
-            os.getenv('RIFT_ARTIFACTS'),
+            os.getenv('RIFT_VAR_ROOT'),
             "launchpad/libs",
             nsd.id,
             "config")
index 267d6df..3b4270c 100644 (file)
@@ -37,7 +37,7 @@ class RiftCAConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
         self._name = account.name
         self._type = riftcm_config_plugin.DEFAULT_CAP_TYPE
         self._rift_install_dir = os.environ['RIFT_INSTALL']
-        self._rift_artif_dir = os.environ['RIFT_ARTIFACTS']
+        self._rift_var_root_dir = os.environ['RIFT_VAR_ROOT']
         self._rift_vnfs = {}
         self._tasks = {}
 
@@ -247,7 +247,7 @@ class RiftCAConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
             # The script has full path, use as is
             script = rpc_ip.user_defined_script
         else:
-            script = os.path.join(self._rift_artif_dir, 'launchpad/libs', agent_nsr.nsd_id, 'scripts',
+            script = os.path.join(self._rift_var_root_dir, 'launchpad/libs', agent_nsr.nsd_id, 'scripts',
                                   rpc_ip.user_defined_script)
             self._log.debug("Rift config agent: Checking for script in %s", script)
             if not os.path.exists(script):
index 4a8dab8..3b28fba 100644 (file)
@@ -55,7 +55,7 @@ class RiftCMRPCHandler(object):
         self.job_manager = rift.mano.config_agent.ConfigAgentJobManager(dts, log, loop, nsm)
 
         self._rift_install_dir = os.environ['RIFT_INSTALL']
-        self._rift_artif_dir = os.environ['RIFT_ARTIFACTS']
+        self._rift_var_root_dir = os.environ['RIFT_VAR_ROOT']
 
     @property
     def reghs(self):
@@ -240,7 +240,7 @@ class RiftCMRPCHandler(object):
             # The script has full path, use as is
             script = rpc_ip.user_defined_script
         else:
-            script = os.path.join(self._rift_artif_dir, 'launchpad/packages/nsd',
+            script = os.path.join(self._rift_var_root_dir, 'launchpad/packages/nsd',
                                   agent_nsr.id, 'scripts',
                                   rpc_ip.user_defined_script)
             self._log.debug("CA-RPC: Checking for script in %s", script)
index add6a29..65b5ece 100644 (file)
@@ -51,7 +51,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
         self._user = account.juju.user
         self._secret = account.juju.secret
         self._rift_install_dir = os.environ['RIFT_INSTALL']
-        self._rift_artif_dir = os.environ['RIFT_ARTIFACTS']
+        self._rift_var_root_dir = os.environ['RIFT_VAR_ROOT']
 
         ############################################################
         # This is wrongfully overloaded with 'juju' private data.  #
@@ -180,7 +180,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
 
         # Find the charm directory
         try:
-            path = os.path.join(self._rift_artif_dir,
+            path = os.path.join(self._rift_var_root_dir,
                                 'launchpad/libs',
                                 agent_vnfr.vnfr_msg.vnfd.id,
                                 'charms/trusty',
@@ -477,7 +477,7 @@ class JujuConfigPlugin(riftcm_config_plugin.RiftCMConfigPluginBase):
             # The script has full path, use as is
             script = rpc_ip.user_defined_script
         else:
-            script = os.path.join(self._rift_artif_dir, 'launchpad/libs', agent_nsr.id, 'scripts',
+            script = os.path.join(self._rift_var_root_dir, 'launchpad/libs', agent_nsr.id, 'scripts',
                                   rpc_ip.user_defined_script)
             self.log.debug("jujuCA: Checking for script in %s", script)
             if not os.path.exists(script):
index d907731..4b1a13c 100644 (file)
@@ -32,7 +32,7 @@ class PackageCharmExtractor(object):
     to a known location (RIFT-13282)
     """
     DEFAULT_INSTALL_DIR = os.path.join(
-            os.environ["RIFT_ARTIFACTS"],
+            os.environ["RIFT_VAR_ROOT"],
             "launchpad"
             )
 
index 9a06116..619e924 100644 (file)
@@ -32,7 +32,7 @@ class PackageConfigExtractor(object):
     to a known location (RIFT-13282)
     """
     DEFAULT_INSTALL_DIR = os.path.join(
-            os.environ["RIFT_ARTIFACTS"],
+            os.environ["RIFT_VAR_ROOT"],
             "launchpad"
             )
 
index 9ebd03c..7b53e72 100644 (file)
@@ -199,7 +199,7 @@ class PackageFilesystemStore(object):
 
 class NsdPackageFilesystemStore(PackageFilesystemStore):
     DEFAULT_ROOT_DIR = os.path.join(
-            os.environ["RIFT_ARTIFACTS"],
+            os.environ["RIFT_VAR_ROOT"],
             "launchpad", "packages", "nsd"
             )
 
@@ -209,7 +209,7 @@ class NsdPackageFilesystemStore(PackageFilesystemStore):
 
 class VnfdPackageFilesystemStore(PackageFilesystemStore):
     DEFAULT_ROOT_DIR = os.path.join(
-            os.environ["RIFT_ARTIFACTS"],
+            os.environ["RIFT_VAR_ROOT"],
             "launchpad", "packages", "vnfd"
             )
 
index c908bb3..3c83a5f 100644 (file)
@@ -675,7 +675,7 @@ class UploaderApplication(tornado.web.Application):
 
         self.accounts = []
         self.messages = collections.defaultdict(list)
-        self.export_dir = os.path.join(os.environ['RIFT_ARTIFACTS'], 'launchpad/exports')
+        self.export_dir = os.path.join(os.environ['RIFT_VAR_ROOT'], 'launchpad/exports')
 
         self.uploader = image.ImageUploader(self.log, self.loop, self.dts)
         self.onboarder = onboard.DescriptorOnboarder(
index 7a787c7..b035e44 100755 (executable)
@@ -29,6 +29,10 @@ import unittest
 import uuid
 import xmlrunner
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import rift.package.archive
 import rift.package.charm
 import rift.package.checksums
index 871132f..1af9563 100755 (executable)
@@ -31,6 +31,10 @@ import unittest
 import uuid
 import xmlrunner
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 from rift.package import convert
 from rift.tasklets.rwlaunchpad import onboard
 import rift.test.dts
index 1efd2df..e00af70 100755 (executable)
@@ -29,6 +29,10 @@ import unittest
 import xmlrunner
 import yaml
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import rift.package.archive
 import rift.package.package
 import rift.package.charm
index fdc2e22..d318e83 100755 (executable)
@@ -33,6 +33,10 @@ import tornado.ioloop
 import tornado.web
 import tornado.httputil
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import gi
 import requests
 from tornado.platform.asyncio import AsyncIOMainLoop
@@ -97,7 +101,7 @@ class TestCase(rift.test.dts.AbstractDTSTest):
     def create_mock_package(self):
         uid = str(uuid.uuid4())
         path = os.path.join(
-                os.getenv('RIFT_ARTIFACTS'),
+                os.getenv('RIFT_VAR_ROOT'),
                 "launchpad/packages/vnfd",
                 uid)
 
@@ -200,7 +204,7 @@ class TestCase(rift.test.dts.AbstractDTSTest):
         data = data[-1]
         assert type(data) is export.ExportSuccess
         path = os.path.join(
-                os.getenv("RIFT_ARTIFACTS"),
+                os.getenv("RIFT_VAR_ROOT"),
                 "launchpad/exports",
                 filename)
 
index 0ad877e..179aab8 100644 (file)
@@ -42,7 +42,7 @@ if sys.version_info < (3, 4, 4):
 
 
 DUMP_OPENMANO_DIR = os.path.join(
-        os.environ["RIFT_ARTIFACTS"],
+        os.environ["RIFT_VAR_ROOT"],
         "openmano_descriptors"
         )
 
index 7572fe9..0a4d1ff 100755 (executable)
@@ -2796,10 +2796,10 @@ class NsdDtsHandler(object):
 
         @asyncio.coroutine
         def delete_nsd_libs(nsd_id):
-            """ Remove any files uploaded with NSD and stored under $RIFT_ARTIFACTS/libs/<id> """
+            """ Remove any files uploaded with NSD and stored under $RIFT_VAR_ROOT/libs/<id> """
             try:
-                rift_artifacts_dir = os.environ['RIFT_ARTIFACTS']
-                nsd_dir = os.path.join(rift_artifacts_dir, 'launchpad/libs', nsd_id)
+                rift_var_root_dir = os.environ['RIFT_VAR_ROOT']
+                nsd_dir = os.path.join(rift_var_root_dir, 'launchpad/libs', nsd_id)
 
                 if os.path.exists (nsd_dir):
                     shutil.rmtree(nsd_dir, ignore_errors=True)
index 75b310a..063779c 100755 (executable)
@@ -62,7 +62,7 @@ class TestCase(rift.test.dts.AbstractDTSTest):
     def create_mock_package(self):
         uid = str(uuid.uuid4())
         path = os.path.join(
-                os.getenv('RIFT_ARTIFACTS'),
+                os.getenv('RIFT_VAR_ROOT'),
                 "launchpad/packages/vnfd",
                 uid)
 
index 518b927..b5ea480 100755 (executable)
@@ -26,6 +26,10 @@ import unittest
 import uuid
 import xmlrunner
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import gi
 gi.require_version('RwDts', '1.0')
 gi.require_version('RwPkgMgmtYang', '1.0')
index 4281e11..9c70dea 100755 (executable)
@@ -20,6 +20,10 @@ import sys
 import unittest
 import uuid
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import gi
 gi.require_version('RwDtsYang', '1.0')
 gi.require_version('RwPkgMgmtYang', '1.0')
@@ -135,4 +139,4 @@ def main(argv=sys.argv[1:]):
             )
 
 if __name__ == '__main__':
-    main()
\ No newline at end of file
+    main()
index ce26e06..3027731 100644 (file)
@@ -48,7 +48,7 @@ class RequestHandler(tornado.web.RequestHandler):
 class StoreStreamerPart(multipart_streamer.MultiPartStreamer):
     """
     Create a Part streamer with a custom temp directory. Using the default
-    tmp directory and trying to move the file to $RIFT_ARTIFACTS occasionally
+    tmp directory and trying to move the file to $RIFT_VAR_ROOT occasionally
     causes link errors. So create a temp directory within the staging area.
     """
     def __init__(self, store, *args, **kwargs):
index aec4180..04e37d0 100644 (file)
@@ -55,7 +55,7 @@ class StagingFileStore(StagingStorePublisherProtocol):
 
     def __init__(self, log=None, root_dir=None):
         default_path = os.path.join(
-            os.getenv('RIFT_ARTIFACTS'),
+            os.getenv('RIFT_VAR_ROOT'),
             "launchpad/staging")
 
         self.root_dir = root_dir or default_path
index 9a7e77a..d378c92 100755 (executable)
@@ -2713,10 +2713,10 @@ class VnfManager(object):
 
             del self._vnfds_to_vnfr[vnfd_id]
 
-        # Remove any files uploaded with VNFD and stored under $RIFT_ARTIFACTS/libs/<id>
+        # Remove any files uploaded with VNFD and stored under $RIFT_VAR_ROOT/libs/<id>
         try:
-            rift_artifacts_dir = os.environ['RIFT_ARTIFACTS']
-            vnfd_dir = os.path.join(rift_artifacts_dir, 'launchpad/libs', vnfd_id)
+            rift_var_root_dir = os.environ['RIFT_VAR_ROOT']
+            vnfd_dir = os.path.join(rift_var_root_dir, 'launchpad/libs', vnfd_id)
             if os.path.exists(vnfd_dir):
                 shutil.rmtree(vnfd_dir, ignore_errors=True)
         except Exception as e:
index 69a0d40..390d38a 100755 (executable)
@@ -646,7 +646,7 @@ class PingPongDescriptorPublisher(object):
                         use_mon_params=False,
                         )
 
-        self.config_dir = os.path.join(os.getenv('RIFT_ARTIFACTS'),
+        self.config_dir = os.path.join(os.getenv('RIFT_VAR_ROOT'),
                                        "launchpad/libs",
                                        self.ping_pong_nsd.id,
                                        "config")
index 40efe41..31a9276 100755 (executable)
@@ -26,6 +26,10 @@ import tempfile
 import unittest
 import xmlrunner
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 import rift.mano.examples.ping_pong_nsd as ping_pong_nsd
 
 from rift.mano.utils.compare_desc import CompareDescShell
index aa485ef..83100d5 100755 (executable)
@@ -20,6 +20,11 @@ import sys
 import types
 import unittest
 import uuid
+import os
+
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
 
 import rift.test.dts
 import rift.tasklets.rwnsmtasklet.cloud as cloud
@@ -170,4 +175,4 @@ def main(argv=sys.argv[1:]):
             )
 
 if __name__ == '__main__':
-    main()
\ No newline at end of file
+    main()
index e125739..48aa03c 100755 (executable)
@@ -25,6 +25,10 @@ import unittest
 import uuid
 import xmlrunner
 
+#Setting RIFT_VAR_ROOT if not already set for unit test execution
+if "RIFT_VAR_ROOT" not in os.environ:
+    os.environ['RIFT_VAR_ROOT'] = os.path.join(os.environ['RIFT_INSTALL'], 'var/rift/unittest')
+
 from gi.repository import (
         NsdYang,
         NsrYang,