added the ability to specify what machine we want to edit files on (probably should be removed)
This commit is contained in:
parent
ba9b5875f2
commit
35cdb1fe13
1 changed files with 20 additions and 7 deletions
|
|
@ -4,7 +4,7 @@ import os
|
|||
import sys
|
||||
|
||||
import utils
|
||||
from utils import executize, virtualenv
|
||||
from utils import executize, virtualenv, loggify
|
||||
|
||||
|
||||
def command(program=None, cmd=None, extra_param=None):
|
||||
|
|
@ -65,21 +65,31 @@ def command(program=None, cmd=None, extra_param=None):
|
|||
_execute(_command)
|
||||
|
||||
|
||||
def edit(remote_path):
|
||||
def edit(remote_path, host_string=None):
|
||||
"""
|
||||
calls up mvim or vim on the file
|
||||
|
||||
remote_path - path to file we want to edit
|
||||
host_string - what machine the file is located on
|
||||
|
||||
host_string is necessary b/c in the case where I want to edit
|
||||
configuration files, it is essential to do so only on the localhost
|
||||
|
||||
that is, whether I'm editing staging, development or production project
|
||||
yml files, the place to do that editing is ALWAYS on localhost, this is
|
||||
because all fabric commands are executed from localhost and will check for
|
||||
the necessary configuration files on local (I'm not running fabric from an
|
||||
ssh command line on the aws server, I'm running it on my laptop)
|
||||
"""
|
||||
|
||||
# logger = loggify('maintenance', 'edit')
|
||||
logger = loggify('maintenance', 'edit')
|
||||
|
||||
# configuration = env.config
|
||||
|
||||
if env.debug:
|
||||
# logger.debug("remote_path : %s" % remote_path)
|
||||
# logger.debug("env.host_string : %s" % env.host_string)
|
||||
# logger.debug("sys.platform : %s" % sys.platform)
|
||||
logger.debug("remote_path : %s" % remote_path)
|
||||
logger.debug("env.host_string : %s" % env.host_string)
|
||||
logger.debug("sys.platform : %s" % sys.platform)
|
||||
pass
|
||||
else:
|
||||
|
||||
|
|
@ -88,10 +98,13 @@ def edit(remote_path):
|
|||
else:
|
||||
editor = "vim"
|
||||
|
||||
if not host_string:
|
||||
host_string = env.host_string
|
||||
|
||||
cmd_edit = "{editor} sftp://{user}@{host_string}/{remote_path}".format(
|
||||
editor=editor,
|
||||
user=env.user,
|
||||
host_string=env.host_string,
|
||||
host_string=host_string,
|
||||
remote_path=remote_path)
|
||||
|
||||
local(cmd_edit)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue