-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfabfile.py
55 lines (42 loc) · 1.32 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os, inspect
import sys
import re
import math
import csv
import json
from ConfigParser import ConfigParser, NoOptionError
import logging
import shutil
import warnings
from cStringIO import StringIO
from collections import namedtuple
from boto.s3.connection import S3Connection
from boto.s3.key import Key
import psycopg2
import psycopg2.extras
import msgpack
from fabric.api import local, run, get, put, hosts, roles, cd, task, env
from fabric.tasks import Task
from fabric.colors import green, red, yellow
from fabric.contrib.console import confirm
#env.hosts = ['mitradevel']
env.roledefs['webservers'] = ['eu1.mrosa.org']
env.roledefs['dbservers'] = ['mitradevel']
env.user = 'baishi'
#warnings.simplefilter('ignore', Image.DecompressionBombWarning)
FORMAT = '%(asctime)s %(levelname)-5.5s [%(name)s] %(funcName)s:%(lineno)d %(message)s'
logging.basicConfig(format=FORMAT, level=logging.INFO)
logger = logging.getLogger(__name__)
#python_bin = '/opt/python/bin/python'
class DeployTask(Task):
def __init__(self, func, *args, **kwargs):
super(DeployTask, self).__init__(*args, **kwargs)
self.roles = ['webservers']
def __del__(self):
pass
def run(self, *arg, **kwargs):
with cd('git/marmoset_analysis'):
run('git pull')
@task(task_class=DeployTask)
def deploy():
pass