added deploy.ssh method, also got rid of override

Changes to be committed:
	modified:   modules/deploy.py
	modified:   modules/initialize.py
This commit is contained in:
Ronny Abraham 2016-09-21 16:11:27 +03:00
parent 328de1596b
commit 9cb2341aaa
2 changed files with 29 additions and 30 deletions

View file

@ -1,5 +1,5 @@
from fabric.api import env, task
from fabric.operations import run
from fabric.operations import run, local
# from fabric.contrib.files import upload_template
# from utils import print_run
@ -226,7 +226,7 @@ def sync(full=True, extras=False):
command_mkdir_remote = "mkdir -p {remote}".format(remote=remote_dir)
excludeitems = (".git", "*.swp", "*.swo", ".DS_Store", "*.pyc", "*.bak",
"build/*")
"build/*", "/extras", "/opt")
if env.debug:
print "\n%s debug: %s" % (debug_prefix, env.debug)
@ -293,6 +293,11 @@ def sync(full=True, extras=False):
return
# print "remote_dir: %s" % remote_dir
# print "local_dir: %s" % local_dir
# import sys
# sys.exit()
run(command_mkdir_remote)
rsync_project(remote_dir=remote_dir, local_dir=local_dir,
@ -302,7 +307,7 @@ def sync(full=True, extras=False):
from pip import install as pip_install
pip_install('--all')
overrides()
# overrides()
#
#
@ -546,26 +551,18 @@ def remove(full=True):
run(command_rm_virtualenv)
def overrides():
"""
this is code for files that have no standard category
for example, I had to upload and override a static js file to modified with
the correct value for the deployment.
I'm keeping this code here so it will be a bit out of the way of the rest.
"""
@task
def ssh():
configuration = env.config
#
# load the module where the custom override code is located
if configuration.project.ssh:
cmd_ssh = "ssh {user}@{host} -i {sshkey}".format(
user=configuration.project.user,
host=configuration.project.host,
sshkey=configuration.project.ssh)
else:
cmd_ssh = "ssh {user}@{host}".format(
user=configuration.project.user,
host=configuration.project.host)
import sys
sys.path.append(configuration.paths.overrides.modules)
import override
#
# call the custom deploy code
override.deploy(env)
local(cmd_ssh)

View file

@ -3,7 +3,6 @@ import os
import fabric.utils
import maintenance
from fabric.api import env, task
from utils import check_debug
# from utils import loggify
@ -46,6 +45,8 @@ def environment(branchname):
env.host_string = env.hosts[0]
env.key_filename = env.config.project.ssh
# set database host to the docker_ip
host = env.config.server.database.host
@ -240,12 +241,13 @@ def get_config(branchname):
config['project']['paths']['root'],
project_home_dir)
# DEBUG REMOVE
if check_debug(env):
import utils
utils.printvar('project.branch', dataobject.project.branch)
utils.printvar('project.root', dataobject.paths.project.root)
utils.prompt_continue()
if 'ssh' in config['project']:
dataobject.project.ssh = os.path.join(
dataobject.paths.project.local,
layout['paths']['extras']['ssh'],
config['project']['ssh'])
else:
dataobject.project.ssh = None
#
# these are the locations of the scripts/conf file both remote and local