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"): ...@@ -103,10 +103,12 @@ def pull(dir="~/circle/circle"):
@roles('portal') @roles('portal')
def update_portal(test=False): def update_portal(test=False, git=True):
"Update and restart portal+manager" "Update and restart portal+manager"
with _stopped("portal", "manager"): with _stopped("portal", "manager"):
if git:
pull() pull()
cleanup()
pip("circle", "~/circle/requirements.txt") pip("circle", "~/circle/requirements.txt")
migrate() migrate()
compile_things() compile_things()
...@@ -115,6 +117,12 @@ def update_portal(test=False): ...@@ -115,6 +117,12 @@ def update_portal(test=False):
@roles('portal') @roles('portal')
def build_portal():
"Update portal without pulling from git"
return update_portal(False, False)
@roles('portal')
def stop_portal(test=False): def stop_portal(test=False):
"Stop portal and manager" "Stop portal and manager"
_stop_services("portal", "manager") _stop_services("portal", "manager")
...@@ -126,10 +134,15 @@ def update_node(): ...@@ -126,10 +134,15 @@ def update_node():
with _stopped("node", "agentdriver", "monitor-client"): with _stopped("node", "agentdriver", "monitor-client"):
pull("~/vmdriver") pull("~/vmdriver")
pip("vmdriver", "~/vmdriver/requirements/production.txt") pip("vmdriver", "~/vmdriver/requirements/production.txt")
_cleanup("~/vmdriver")
pull("~/agentdriver") pull("~/agentdriver")
pip("agentdriver", "~/agentdriver/requirements.txt") pip("agentdriver", "~/agentdriver/requirements.txt")
_cleanup("~/agentdriver")
pull("~/monitor-client") pull("~/monitor-client")
pip("monitor-client", "~/monitor-client/requirements.txt") pip("monitor-client", "~/monitor-client/requirements.txt")
_cleanup("~/monitor-client")
@parallel @parallel
...@@ -151,6 +164,18 @@ def checkout(vmdriver="master", agent="master"): ...@@ -151,6 +164,18 @@ def checkout(vmdriver="master", agent="master"):
run("git checkout %s" % agent) 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): def _stop_services(*services):
"Stop given services (warn only if not running)" "Stop given services (warn only if not running)"
with settings(warn_only=True): with settings(warn_only=True):
...@@ -179,3 +204,12 @@ def _stopped(*services): ...@@ -179,3 +204,12 @@ def _stopped(*services):
def _workon(name): def _workon(name):
return prefix("source ~/.virtualenvs/%s/bin/activate && " return prefix("source ~/.virtualenvs/%s/bin/activate && "
"source ~/.virtualenvs/%s/bin/postactivate" % (name, name)) "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