aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/mirror-repos9
1 files changed, 6 insertions, 3 deletions
diff --git a/scripts/mirror-repos b/scripts/mirror-repos
index 728ee15..483f17f 100644
--- a/scripts/mirror-repos
+++ b/scripts/mirror-repos
@@ -142,6 +142,7 @@ def mirror_repos(file, dest, user=None):
# Skip if repository is already there.
if os.path.exists(os.path.join(full_path, base_dir)):
+ logger.debug("Repository '%s' already present." % base_dir)
continue
# We need to do so, to create the directory as the RhodeCode user
# for our installation.
@@ -154,7 +155,8 @@ def mirror_repos(file, dest, user=None):
cmd_args = ["git", "clone", "--mirror", full_repo]
logger.info("Cloning repository %s..." % full_repo)
- if user == DEFAULT_USER or not user:
+ actual_user = pwd.getpwuid(os.getuid())[0]
+ if actual_user == DEFAULT_USER or not user:
execute_command(cmd_args, work_dir=full_path)
else:
execute_command(cmd_args,
@@ -176,18 +178,19 @@ def rescan_git_directory(api_key, api_host, user=None):
:param user: The user to run the command as.
:type str
"""
+ actual_user = pwd.getpwuid(os.getuid())[0]
if user:
bin_dir = LOCAL_BIN_DIR % user
else:
# Try to gess a user.
- bin_dir = LOCAL_BIN_DIR % pwd.getpwuid(os.getuid())[0]
+ bin_dir = LOCAL_BIN_DIR % actual_user
api_key_cmd = "--apikey=%s" % api_key
api_host_cmd = "--apihost=%s" % api_host
api_cmd = os.path.join(bin_dir, "rhodecode-api")
cmd_args = [api_cmd, api_key_cmd, api_host_cmd, "rescan_repos"]
- if user == DEFAULT_USER or not user:
+ if actual_user == DEFAULT_USER or not user:
execute_command(cmd_args)
else:
execute_command(cmd_args, as_sudo=True, user=user)