Commit 46d8e9f9 by Őry Máté

Merge branch 'feature-clean-pyc' into 'master'

Feature clean pyc

See merge request !268
parents 73c44add e3ca1c1b
......@@ -103,10 +103,12 @@ def pull(dir="~/circle/circle"):
@roles('portal')
def update_portal(test=False):
def update_portal(test=False, git=True):
"Update and restart portal+manager"
with _stopped("portal", "manager"):
if git:
pull()
cleanup()
pip("circle", "~/circle/requirements.txt")
migrate()
compile_things()
......@@ -115,6 +117,12 @@ def update_portal(test=False):
@roles('portal')
def build_portal():
"Update portal without pulling from git"
return update_portal(False, False)
@roles('portal')
def stop_portal(test=False):
"Stop portal and manager"
_stop_services("portal", "manager")
......@@ -126,10 +134,15 @@ def update_node():
with _stopped("node", "agentdriver", "monitor-client"):
pull("~/vmdriver")
pip("vmdriver", "~/vmdriver/requirements/production.txt")
_cleanup("~/vmdriver")
pull("~/agentdriver")
pip("agentdriver", "~/agentdriver/requirements.txt")
_cleanup("~/agentdriver")
pull("~/monitor-client")
pip("monitor-client", "~/monitor-client/requirements.txt")
_cleanup("~/monitor-client")
@parallel
......@@ -151,6 +164,18 @@ def checkout(vmdriver="master", agent="master"):
run("git checkout %s" % agent)
@roles('portal')
def cleanup():
"Clean pyc files of portal"
_cleanup()
def _cleanup(dir="~/circle/circle"):
"Clean pyc files"
with cd("~/circle/circle"):
run("find -name '*.py[co]' -exec rm -f {} +")
def _stop_services(*services):
"Stop given services (warn only if not running)"
with settings(warn_only=True):
......@@ -179,3 +204,12 @@ def _stopped(*services):
def _workon(name):
return prefix("source ~/.virtualenvs/%s/bin/activate && "
"source ~/.virtualenvs/%s/bin/postactivate" % (name, name))
@roles('portal')
def install_bash_completion_script():
sudo("wget https://raw.githubusercontent.com/marcelor/fabric-bash-"
"autocompletion/48baf5735bafbb2be5be8787d2c2c04a44b6cdb0/fab "
"-O /etc/bash_completion.d/fab")
print("To have bash completion instantly, run\n"
" source /etc/bash_completion.d/fab")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment