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/22 05:31:22 UTC
[4/8] 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/dd649946
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/dd649946
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/dd649946
Branch: refs/heads/master
Commit: dd6499463c6e1576a2a6f2c3a7e9865595efbe3a
Parents: 9a6f8dc
Author: Isuru Haththotuwa <is...@apache.org>
Authored: Tue Dec 1 17:07:23 2015 +0530
Committer: Isuru Haththotuwa <is...@apache.org>
Committed: Mon Dec 21 22:36:29 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/dd649946/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 39543b9..14b76f3 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/dd649946/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):