Skip to content

Commit

Permalink
More debuggin around syncing.
Browse files Browse the repository at this point in the history
  • Loading branch information
ericholscher committed Oct 24, 2012
1 parent ad3b315 commit c1a589d
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions readthedocs/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@ def copy_to_app_servers(full_build_path, target, mkdir=True):
"""
log.info("Copying %s to %s" % (full_build_path, target))
for server in settings.MULTIPLE_APP_SERVERS:
ret = os.system("ssh %s@%s mkdir -p %s" % (getpass.getuser(), server, target))
mkdir_cmd = ("ssh %s@%s mkdir -p %s" % (getpass.getuser(), server, target))
ret = os.system(mkdir_cmd)
if ret != 0:
log.error("COPY ERROR to app servers.")
ret = os.system("rsync -e 'ssh -T' -av --delete %s/ %s@%s:%s" %
log.error("COPY ERROR to app servers:")
log.error(mkdir_cmd)

sync_cmd = ("rsync -e 'ssh -T' -av --delete %s/ %s@%s:%s" %
(full_build_path, getpass.getuser(), server, target))
ret = os.system(sync_cmd)
if ret != 0:
log.error("COPY ERROR to app servers.")
log.error(sync_cmd)


def copy_file_to_app_servers(from_file, to_file):
Expand All @@ -27,10 +32,17 @@ def copy_file_to_app_servers(from_file, to_file):
log.info("Copying %s to %s" % (from_file, to_file))
to_path = os.path.dirname(to_file)
for server in settings.MULTIPLE_APP_SERVERS:
os.system("ssh %s@%s mkdir -p %s" % (getpass.getuser(), server, to_path))
ret = os.system("rsync -e 'ssh -T' -av --delete %s %s@%s:%s" % (from_file, getpass.getuser(), server, to_file))
mkdir_cmd = ("ssh %s@%s mkdir -p %s" % (getpass.getuser(), server, to_path))
ret = os.system(mkdir_cmd)
if ret != 0:
log.error("COPY ERROR to app servers.")
log.error(sync_cmd)

sync_cmd = (rsync -e 'ssh -T' -av --delete %s %s@%s:%s" % (from_file, getpass.getuser(), server, to_file))
ret = os.system(sync_cmd)
if ret != 0:
log.error("COPY ERROR to app servers.")
log.error(sync_cmd)


def run_on_app_servers(command):
Expand Down

0 comments on commit c1a589d

Please sign in to comment.