bugcy013
9/26/2016 - 3:28 AM

store_ops.py

__author__ = 'dhana013'

from fabric.contrib.project import rsync_project
from fabric.operations import sudo
from fabric.api import env, hosts


environments = {
        "dev": {
            "hosts": ["172.16.30.150:8953"], "user": "sysops"
        },
        }


def environment(name='dev'):
    print "Setting environment", name
    env.update(environments[name])
    env.environment = name


STORE_CODE_LOC = "/home/dhana013/test"
REMOTE_LOC = "/home/sysops/"


def deploy_project():
    rsync_project(local_dir=STORE_CODE_LOC, remote_dir=REMOTE_LOC, exclude=(".git", "*.pyc", ))


def web_server_restart():
    sudo('service apache2 start')


if __name__ == "__main__":
    environment('dev')
    print env