-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfabfile.py
38 lines (30 loc) · 905 Bytes
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from fabric.api import (sudo,
local,
cd,
run,
put,
env,)
import json
try:
with open('fabConfig.json', 'r') as f:
config = json.load(f)
except:
print 'Error loading fabConfig.json file. Aborting...'
exit(1)
env.roledefs = {}
for role in config['roles']:
host = config['roles'][role]
if type(env.roledefs.get(role, None)) is not dict:
env.roledefs[role] = []
env.roledefs[role].append(host)
env.user = config.get('user', None)
def release():
target_path = config.get('target_path', None)
if not target_path:
print 'Missing `target_path` in config. Aborting...'
exit(1)
with cd(target_path):
run('git clean -f')
run('git reset --hard')
run('git pull --rebase')
run('npm install')