Adding files to pep8 tests

Change-Id: I96bfed7541aa96e243950b3bcc896e9fe17471ba
This commit is contained in:
Derek Higgins 2013-04-23 05:16:05 -04:00
parent 3a595e77bb
commit b3554a226c
3 changed files with 8 additions and 6 deletions

View File

@ -24,7 +24,7 @@ def get_localhost_ip():
nsrvs.append(match.group('ns_ip')) nsrvs.append(match.group('ns_ip'))
# try to connect to nameservers and return own IP address # try to connect to nameservers and return own IP address
nsrvs.append('8.8.8.8') # default to google dns nsrvs.append('8.8.8.8') # default to google dns
for i in nsrvs: for i in nsrvs:
try: try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

View File

@ -18,9 +18,9 @@ def execute(cmd, workdir=None, can_fail=False, mask_list=None,
code. Otherwise code. Otherwise
""" """
mask_list = mask_list or [] mask_list = mask_list or []
repl_list = [("'","'\\''")] repl_list = [("'", "'\\''")]
if type(cmd) is not types.StringType: if not isinstance(cmd, types.StringType):
import pipes import pipes
masked = ' '.join((pipes.quote(i) for i in cmd)) masked = ' '.join((pipes.quote(i) for i in cmd))
else: else:
@ -58,7 +58,7 @@ class ScriptRunner(object):
def execute(self, logerrors=True, maskList=None): def execute(self, logerrors=True, maskList=None):
maskList = maskList or [] maskList = maskList or []
script = "\n".join(self.script) script = "\n".join(self.script)
logging.debug("# ============ ssh : %r =========="%self.ip) logging.debug("# ============ ssh : %r ==========" % self.ip)
_PIPE = subprocess.PIPE # pylint: disable=E1101 _PIPE = subprocess.PIPE # pylint: disable=E1101
if self.ip: if self.ip:
@ -71,7 +71,7 @@ class ScriptRunner(object):
stderr=_PIPE, close_fds=True, stderr=_PIPE, close_fds=True,
shell=False) shell=False)
replace_list = [("'","'\\''")] replace_list = [("'", "'\\''")]
logging.debug(mask_string(script, maskList, replace_list)) logging.debug(mask_string(script, maskList, replace_list))
script = "function t(){ exit $? ; } \n trap t ERR \n" + script script = "function t(){ exit $? ; } \n trap t ERR \n" + script
stdoutdata, stderrdata = obj.communicate(script) stdoutdata, stderrdata = obj.communicate(script)

View File

@ -18,7 +18,9 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
deps=pep8==1.2 deps=pep8==1.2
commands = pep8 --exclude=*.pyc --repeat --show-source \ commands = pep8 --exclude=*.pyc --repeat --show-source \
packstack/modules tests setup.py packstack/modules tests setup.py packstack/installer/utils \
packstack/installer/processors.py
[testenv:cover] [testenv:cover]
setenv = NOSE_WITH_COVERAGE=1 setenv = NOSE_WITH_COVERAGE=1