update deploy option

This commit is contained in:
Adrien Beudin 2017-05-05 17:03:51 +02:00
parent 18f5f3d36e
commit 5822e770da
2 changed files with 8 additions and 5 deletions

View File

@ -195,6 +195,7 @@ If you wanna configure the deployement of your website by rsync::
settings:
deploy:
ssh: true (optional need for ssh)
username: beudbeud (optional need for ssh)
hostname: beudibox.fr (optional need for ssh)
dest: /var/www/surleschemins/build/

View File

@ -545,17 +545,19 @@ def main():
error(os.system("which rsync > /dev/null") == 0, "I can't locate the rsync, "
"please install the 'rsync' package.\n")
error(Path("build").exists(), "Please build the website before launch deployment")
r_username = settings["settings"]["deploy"]["username"]
r_hostname = settings["settings"]["deploy"]["hostname"]
r_dest = settings["settings"]["deploy"]["dest"]
if settings["settings"]["deploy"]["others"]:
r_others = settings["settings"]["deploy"]["others"]
else:
r_others = ''
if settings["settings"]["deploy"]["ssh"]:
r_username = settings["settings"]["deploy"]["username"]
r_hostname = settings["settings"]["deploy"]["hostname"]
r_cmd = "rsync -avz --progress %s build/* %s@%s:%s" % (r_others, r_username, r_hostname, r_dest)
print r_cmd
else:
r_cmd = "rsync -avz --progress %s build/* %s" % (r_others, r_dest)
error(os.system(r_cmd) == 0, "deployment failed")
#proc = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, preexec_fn=os.setsid)
return
Path("build").makedirs_p()