sbin/sync/fabfile.py
changeset 166 e9cd38b7cfe0
parent 162 f014c1593ade
child 171 9b019ac3b791
--- a/sbin/sync/fabfile.py	Wed Aug 31 19:03:13 2016 +0200
+++ b/sbin/sync/fabfile.py	Thu Sep 01 14:08:20 2016 +0200
@@ -7,16 +7,18 @@
                     clean_export_folder, do_sync_comp, sync_install_build, do_create_virtualenv,
                     clean_rsync_folder, rsync_export, get_src_version, sync_build,
                     do_relaunch_server, install_build, do_create_virtualenv_requirement, build_src)
-from fabric.api import task, env
+from fabric.api import task, env, run, cd, put
 from fabric.colors import green
 
+env.use_ssh_config = True
+
 def build_source(version):
     print(green("build source with version %s" % version))
     export_path = export_version(iconolab=version)
     export_path_full = os.path.join(export_path, env.key, env.repos[env.key]['src_root'])
     build_src(export_path_full)
     (_,version_str) = get_src_version(env.key, export_path_full)
-    return os.path.join(src_path,"dist","%s-%s.tar.gz" % (env.key,version_str))
+    return os.path.join(export_path_full,"dist","%s-%s.tar.gz" % (env.key,version_str))
 
 @task
 def relaunch_server(do_collectstatic=True, do_migrate=True, do_check_folder_access=False):
@@ -27,9 +29,11 @@
 def sync_site(version):
     print(green("sync site with version %s" % version))
     build_path = build_source(version)
+    run('mkdir -p "%s"' % env.remote_path['build_export'])
     res_trans = sync_build(build_path)
     # untar build
-    run('tar zxf %s' % res_trans[0])
+    with cd(env.remote_path['build_export']):
+        run('tar zxf %s' % res_trans[0])
     # rebuild virtualenv
     requirements_path = os.path.join(res_trans[0][0:-7], env.repos[env.key]['requirements'])
     do_create_virtualenv_requirement(requirements_path, env.remote_path['virtualenv'], env.repos[env.key]['python_version'])