Upgrade pep8 to 1.3.3.
This required a bunch of whitespace-poking of the scripts in bin, but that's all. Now every file in swift/ and bin/ is pep8-1.3.3-compliant, so hopefully we can be done with this pep8 stuff for a good long time. Change-Id: I44fdb41d219c57400a4c396ab7eb0ffa9dcd8db8
This commit is contained in:
parent
2ad23a25e8
commit
35f4d29ed6
@ -196,8 +196,7 @@ class Auditor(object):
|
||||
self.container_obj_mismatch += 1
|
||||
consistent = False
|
||||
print(" Different versions of %s/%s "
|
||||
"in container dbs." % \
|
||||
(name, obj['name']))
|
||||
"in container dbs." % (name, obj['name']))
|
||||
if (obj['last_modified'] >
|
||||
rec_d[obj_name]['last_modified']):
|
||||
rec_d[obj_name] = obj
|
||||
|
@ -65,6 +65,7 @@ if __name__ == '__main__':
|
||||
print ' Or: /v1/account/container/object_prefix'
|
||||
exit(1)
|
||||
sig = hmac.new(key, '%s\n%s\n%s\n%s\n%s' % (path, redirect, max_file_size,
|
||||
max_file_count, expires), sha1).hexdigest()
|
||||
max_file_count, expires),
|
||||
sha1).hexdigest()
|
||||
print ' Expires:', expires
|
||||
print 'Signature:', sig
|
||||
|
@ -13,7 +13,8 @@ if __name__ == '__main__':
|
||||
Lists old Swift processes.
|
||||
'''.strip())
|
||||
parser.add_option('-a', '--age', dest='hours', type='int', default=720,
|
||||
help='look for processes at least HOURS old; default: 720 (30 days)')
|
||||
help='look for processes at least HOURS old; '
|
||||
'default: 720 (30 days)')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
listing = []
|
||||
@ -27,8 +28,8 @@ Lists old Swift processes.
|
||||
etime, pid, args = line.split(None, 2)
|
||||
except ValueError:
|
||||
sys.exit('Could not process ps line %r' % line)
|
||||
if (not args.startswith('/usr/bin/python /usr/bin/swift-') and
|
||||
not args.startswith('/usr/bin/python /usr/local/bin/swift-')):
|
||||
if not args.startswith('/usr/bin/python /usr/bin/swift-') and \
|
||||
not args.startswith('/usr/bin/python /usr/local/bin/swift-'):
|
||||
continue
|
||||
args = args.split('-', 1)[1]
|
||||
etime = etime.split('-')
|
||||
|
@ -20,12 +20,14 @@ Example (sends SIGTERM to all orphaned Swift processes older than two hours):
|
||||
%prog -a 2 -k TERM
|
||||
'''.strip())
|
||||
parser.add_option('-a', '--age', dest='hours', type='int', default=24,
|
||||
help='look for processes at least HOURS old; default: 24')
|
||||
help="look for processes at least HOURS old; "
|
||||
"default: 24")
|
||||
parser.add_option('-k', '--kill', dest='signal',
|
||||
help='send SIGNAL to matched processes; default: just list process '
|
||||
'information')
|
||||
help='send SIGNAL to matched processes; default: just '
|
||||
'list process information')
|
||||
parser.add_option('-w', '--wide', dest='wide', default=False,
|
||||
action='store_true', help="don't clip the listing at 80 characters")
|
||||
action='store_true',
|
||||
help="don't clip the listing at 80 characters")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
pids = []
|
||||
@ -95,7 +97,8 @@ Example (sends SIGTERM to all orphaned Swift processes older than two hours):
|
||||
signum = int(options.signal)
|
||||
except ValueError:
|
||||
signum = getattr(signal, options.signal.upper(),
|
||||
getattr(signal, 'SIG' + options.signal.upper(), None))
|
||||
getattr(signal, 'SIG' + options.signal.upper(),
|
||||
None))
|
||||
if not signum:
|
||||
sys.exit('Could not translate %r to a signal number.' %
|
||||
options.signal)
|
||||
|
@ -132,8 +132,8 @@ class SwiftRecon(object):
|
||||
"""
|
||||
ring_data = Ring(swift_dir, ring_name=ring_name)
|
||||
if zone_filter:
|
||||
ips = set((n['ip'], n['port']) for n in ring_data.devs if n \
|
||||
if n['zone'] == zone_filter)
|
||||
ips = set((n['ip'], n['port']) for n in ring_data.devs
|
||||
if n and n['zone'] == zone_filter)
|
||||
else:
|
||||
ips = set((n['ip'], n['port']) for n in ring_data.devs if n)
|
||||
return ips
|
||||
@ -173,8 +173,8 @@ class SwiftRecon(object):
|
||||
print "-> %s matches." % url
|
||||
else:
|
||||
errors = errors + 1
|
||||
print "%s/%s hosts matched, %s error[s] while checking hosts." % \
|
||||
(matches, len(hosts), errors)
|
||||
print "%s/%s hosts matched, %s error[s] while checking hosts." \
|
||||
% (matches, len(hosts), errors)
|
||||
print "=" * 79
|
||||
|
||||
def async_check(self, hosts):
|
||||
@ -584,7 +584,7 @@ class SwiftRecon(object):
|
||||
print "Distribution Graph:"
|
||||
mul = 69.0 / max(percents.values())
|
||||
for percent in sorted(percents):
|
||||
print '% 3d%%%5d %s' % (percent, percents[percent], \
|
||||
print '% 3d%%%5d %s' % (percent, percents[percent],
|
||||
'*' * int(percents[percent] * mul))
|
||||
raw_used = sum(raw_total_used)
|
||||
raw_avail = sum(raw_total_avail)
|
||||
@ -636,15 +636,18 @@ class SwiftRecon(object):
|
||||
args.add_option('--quarantined', '-q', action="store_true",
|
||||
help="Get cluster quarantine stats")
|
||||
args.add_option('--md5', action="store_true",
|
||||
help="Get md5sum of servers ring and compare to local copy")
|
||||
help="Get md5sum of servers ring and compare to "
|
||||
"local copy")
|
||||
args.add_option('--sockstat', action="store_true",
|
||||
help="Get cluster socket usage stats")
|
||||
args.add_option('--all', action="store_true",
|
||||
help="Perform all checks. Equal to -arudlq --md5 --sockstat")
|
||||
help="Perform all checks. Equal to -arudlq --md5 "
|
||||
"--sockstat")
|
||||
args.add_option('--zone', '-z', type="int",
|
||||
help="Only query servers in specified zone")
|
||||
args.add_option('--timeout', '-t', type="int", metavar="SECONDS",
|
||||
help="Time to wait for a response from a server", default=5)
|
||||
help="Time to wait for a response from a server",
|
||||
default=5)
|
||||
args.add_option('--swiftdir', default="/etc/swift",
|
||||
help="Default = /etc/swift")
|
||||
options, arguments = args.parse_args()
|
||||
|
@ -3,6 +3,6 @@ nose
|
||||
nosexcover
|
||||
openstack.nose_plugin
|
||||
nosehtmloutput
|
||||
pep8==0.6.1
|
||||
pep8==1.3.3
|
||||
sphinx>=1.1.2
|
||||
mock>=0.8.0
|
||||
|
Loading…
Reference in New Issue
Block a user