Commit eea981fb by Őry Máté

fabfile: fix things

parent ffa1d2cf
...@@ -2,6 +2,7 @@ import contextlib ...@@ -2,6 +2,7 @@ import contextlib
import datetime import datetime
from fabric.api import env, run, settings, sudo, prefix, cd, execute from fabric.api import env, run, settings, sudo, prefix, cd, execute
from fabric.context_managers import shell_env
from fabric.decorators import roles, parallel from fabric.decorators import roles, parallel
from vm.models import Node from vm.models import Node
...@@ -17,7 +18,7 @@ env.roledefs['storage'] = [DataStore.objects.get().hostname] ...@@ -17,7 +18,7 @@ env.roledefs['storage'] = [DataStore.objects.get().hostname]
def update_all(): def update_all():
"Update and restart portal+manager, nodes and storage" "Update and restart portal+manager, nodes and storage"
execute(stop_portal) execute(stop_portal)
execute(update_node) execute(parallel(update_node))
execute(update_storage) execute(update_storage)
execute(update_portal) execute(update_portal)
...@@ -84,8 +85,11 @@ def test(test=""): ...@@ -84,8 +85,11 @@ def test(test=""):
def pull(dir="~/circle/circle"): def pull(dir="~/circle/circle"):
"Pull from upstream branch (stash any changes)" "Pull from upstream branch (stash any changes)"
now = unicode(datetime.datetime.now()) now = unicode(datetime.datetime.now())
with cd(dir): with cd(dir), shell_env(GIT_AUTHOR_NAME="fabric",
run("git status || git stash save update %s" % now) GIT_AUTHOR_EMAIL="fabric@local",
GIT_COMMITTER_NAME="fabric",
GIT_COMMITTER_EMAIL="fabric@local"):
run("git stash save update %s" % now)
run("git pull --ff-only") run("git pull --ff-only")
...@@ -107,11 +111,10 @@ def stop_portal(test=False): ...@@ -107,11 +111,10 @@ def stop_portal(test=False):
_stop_services("portal", "mancelery") _stop_services("portal", "mancelery")
@parallel
@roles('node') @roles('node')
def update_node(): def update_node():
"Update and restart nodes" "Update and restart nodes"
with _stopped("node", "agent"): with _stopped("node", "agentdriver"):
pull("~/vmdriver") pull("~/vmdriver")
pip("vmdriver", "~/vmdriver/requirements/production.txt") pip("vmdriver", "~/vmdriver/requirements/production.txt")
pull("~/agentdriver") pull("~/agentdriver")
......
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