ArielGlenn has submitted this change and it was merged.
Change subject: salt-misc: little bit of pep8/pylint
......................................................................
salt-misc: little bit of pep8/pylint
indentation, convert some comment styles, spaces around operators
also set up tox.ini for this directory for line-length.
80 characters, bah!
Change-Id: I1bed1aac4181724b8980c7e4a845b1b9a928f959
---
M salt-misc/do_ssh_commands.py
M salt-misc/parse-minion-output.py
M salt-misc/salt-fixups.py
A salt-misc/tox.ini
M tox.ini
5 files changed, 31 insertions(+), 20 deletions(-)
Approvals:
ArielGlenn: Looks good to me, approved
jenkins-bot: Verified
diff --git a/salt-misc/do_ssh_commands.py b/salt-misc/do_ssh_commands.py
index e620c09..92da6c4 100755
--- a/salt-misc/do_ssh_commands.py
+++ b/salt-misc/do_ssh_commands.py
@@ -104,8 +104,8 @@
entry[minion] == match_value):
minions_good.append(minion)
elif (match_start is not None and
- isinstance(entry[minion], basestring) and
- entry[minion].startswith(match_start)):
+ isinstance(entry[minion], basestring) and
+ entry[minion].startswith(match_start)):
minions_good.append(minion)
elif match_value is None and match_start is None:
minions_good.append(minion)
diff --git a/salt-misc/parse-minion-output.py b/salt-misc/parse-minion-output.py
index 2a68664..1b874a0 100644
--- a/salt-misc/parse-minion-output.py
+++ b/salt-misc/parse-minion-output.py
@@ -76,13 +76,11 @@
hostdata['salt_id'] = line[4:]
elif line.startswith("master:"):
if not line[8:]:
- '''
- master:
- - labs-puppetmaster-eqiad.wikimedia.org
- - labs-puppetmaster-codfw.wikimedia.org
- and this terminates as soon as we see a line with non
- whitespace first char.
- '''
+ # master:
+ # - labs-puppetmaster-eqiad.wikimedia.org
+ # - labs-puppetmaster-codfw.wikimedia.org
+ # and this terminates as soon as we see a line with non
+ # whitespace first char.
want_master = True
else:
hostdata['masters'].append(line[8:])
@@ -190,7 +188,7 @@
if summary['masters']:
for master in summary['masters']:
if (not master == 'labs-puppetmaster-eqiad.wikimedia.org' and
- not master == 'labs-puppetmaster-codfw.wikimedia.org' and
+ not master == 'labs-puppetmaster-codfw.wikimedia.org'
and
not master == 'labcontrol2001.wikimedia.org'):
print summary['hostname'], summary['masters']
break
diff --git a/salt-misc/salt-fixups.py b/salt-misc/salt-fixups.py
index 2c93d43..fd27d56 100644
--- a/salt-misc/salt-fixups.py
+++ b/salt-misc/salt-fixups.py
@@ -52,13 +52,11 @@
for line in lines:
if line.startswith("master:"):
if not line[8:]:
- '''
- master:
- - labs-puppetmaster-eqiad.wikimedia.org
- - labs-puppetmaster-codfw.wikimedia.org
- and this terminates as soon as we see a line with non
- whitespace first char.
- '''
+ # master:
+ # - labs-puppetmaster-eqiad.wikimedia.org
+ # - labs-puppetmaster-codfw.wikimedia.org
+ # and this terminates as soon as we see a line with non
+ # whitespace first char.
want_master = True
else:
masters.append(line[8:])
@@ -400,8 +398,8 @@
# remove old entry
if has_keysize:
- if len(lines) > index+1:
- rest = lines[index+1:]
+ if len(lines) > index + 1:
+ rest = lines[index + 1:]
else:
rest = []
lines = lines[0:index] + rest
diff --git a/salt-misc/tox.ini b/salt-misc/tox.ini
new file mode 100644
index 0000000..5d1bfe4
--- /dev/null
+++ b/salt-misc/tox.ini
@@ -0,0 +1,10 @@
+[tox]
+envlist = py27, flake8
+skipsdist = True
+
+[testenv:flake8]
+commands = flake8
+deps = flake8
+
+[flake8]
+max-line-length = 105
diff --git a/tox.ini b/tox.ini
index ef4d734..a767617 100644
--- a/tox.ini
+++ b/tox.ini
@@ -14,6 +14,11 @@
deps = flake8
commands = flake8 {posargs}
+[testenv:salt-misc]
+toxworkdir={toxinidir}/salt-misc
+deps = tox
+commands = tox -c {toxinidir}/salt-misc/tox.ini
+
[flake8]
exclude =
.git,
@@ -21,13 +26,13 @@
.tox,
# Directories with their own flake8 rules
./clouseau,
+ ./salt-misc,
# Legacy directories that doesn't yet comply with flake8
checkhosts/**,
compare-puppet-catalogs/**,
fwconfigtool/**,
geturls/**,
maintain-replicas/**,
- salt-misc/**,
swift-synctool/**,
swiftcleaner/**,
swiftrepl/**,
--
To view, visit https://gerrit.wikimedia.org/r/306653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1bed1aac4181724b8980c7e4a845b1b9a928f959
Gerrit-PatchSet: 7
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits