You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by is...@apache.org on 2015/12/01 14:58:50 UTC

[5/5] stratos git commit: adding comments

adding comments


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7fc829e1
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7fc829e1
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7fc829e1

Branch: refs/heads/singup_deletion_cleanup
Commit: 7fc829e1aa02de84fdb65220090e804a245aae83
Parents: 11a35ed
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Tue Dec 1 17:07:23 2015 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Tue Dec 1 17:07:23 2015 +0530

----------------------------------------------------------------------
 .../modules/artifactmgt/git/agentgithandler.py  | 21 ++++++++++----------
 .../plugins/DefaultArtifactCheckout.py          |  7 +++++++
 2 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7fc829e1/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py
index 224ca31..743bcd6 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/modules/artifactmgt/git/agentgithandler.py
@@ -214,15 +214,9 @@ class AgentGitHandler:
     @staticmethod
     def clear_repo(tenant_id):
         tenant_id = str(tenant_id)
-        AgentGitHandler.log.info ('########################## in clear_repo method...' + tenant_id)
         if tenant_id in AgentGitHandler.__git_repositories:
             del AgentGitHandler.__git_repositories[tenant_id]
-            AgentGitHandler.log.info('########################## cached repo object deleted for tenant ' +
-                  tenant_id)
-        if tenant_id in AgentGitHandler.__git_repositories:
-            AgentGitHandler.log.info('########################## cached repo object still exists for tenant ' + tenant_id)
-        else:
-            AgentGitHandler.log.info('########################## no cached obj found for ' + tenant_id)
+            AgentGitHandler.log.debug('Cached repo object deleted for tenant ' + tenant_id)
 
     @staticmethod
     def create_git_repo(repo_info):
@@ -338,13 +332,18 @@ class AgentGitHandler:
         return True
 
     @staticmethod
-    def restore_default_artifacts(default_dir):
+    def restore_default_artifacts(initial_artifact_dir):
+        """
+        Restores the initial artifacts from the previously taken backup, if the backup exists
+
+        :param initial_artifact_dir: path to local artifact directory
+        """
         try:
-            Utils.move_directory(Utils.strip_trailing_slash(default_dir) + constants.BACKUP_DIR_SUFFIX, default_dir)
-            AgentGitHandler.log.info('Restored contents from backup location ' +Utils.strip_trailing_slash(default_dir)
+            Utils.move_directory(Utils.strip_trailing_slash(initial_artifact_dir) + constants.BACKUP_DIR_SUFFIX, initial_artifact_dir)
+            AgentGitHandler.log.info('Restored contents from backup location ' + Utils.strip_trailing_slash(initial_artifact_dir)
                                      + constants.BACKUP_DIR_SUFFIX)
         except OSError as e:
-            AgentGitHandler.log.error('Contents of ' + default_dir + ' not restored. Error: %s' % e)
+            AgentGitHandler.log.error('Contents of ' + initial_artifact_dir + ' not restored. Error: %s' % e)
 
     @staticmethod
     def execute_git_command(command, repo_path):

http://git-wip-us.apache.org/repos/asf/stratos/blob/7fc829e1/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/plugins/DefaultArtifactCheckout.py
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/plugins/DefaultArtifactCheckout.py b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/plugins/DefaultArtifactCheckout.py
index 413090e..1b7baa0 100644
--- a/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/plugins/DefaultArtifactCheckout.py
+++ b/components/org.apache.stratos.python.cartridge.agent/src/main/python/cartridge.agent/cartridge.agent/plugins/DefaultArtifactCheckout.py
@@ -110,6 +110,13 @@ class DefaultArtifactCheckout(IArtifactCheckoutPlugin):
                 AgentGitHandler.add_repo(git_repo)
 
     def check_and_backup_initial_artifacts(self, initial_artifact_dir):
+        """
+        verifies if there are any default artifacts by checking the 'initial_artifact_dir' and
+        whether its empty, and takes a backup to a directory  initial_artifact_dir_backup in the
+        same location
+
+        :param initial_artifact_dir: path to local artifact directory
+        """
         # copy default artifacts (if any) to a a temp location
         # if directory name is dir, the backup directory name would be dir_backup
         if self.initial_artifacts_exists(initial_artifact_dir):