ported tools/*.py scripts to python3

Change-Id: Ib8dcc8b0c77515f8a302ed5bf03dc8283f36414b
This commit is contained in:
Chandan Kumar 2017-06-11 20:50:43 +05:30
parent c0e31f1c32
commit 0601be1bfd
3 changed files with 4 additions and 5 deletions

View File

@ -25,7 +25,6 @@ import six
import six.moves.urllib.request as urlreq
import yaml
# DEVSTACK_GATE_GRENADE is either unset if grenade is not running
# or a string describing what type of grenade run to perform.
is_grenade = os.environ.get('DEVSTACK_GATE_GRENADE') is not None
@ -137,7 +136,7 @@ def main(opts):
with open(WHITELIST_FILE) as stream:
loaded = yaml.safe_load(stream)
if loaded:
for (name, l) in loaded.iteritems():
for (name, l) in six.iteritems(loaded):
for w in l:
assert 'module' in w, 'no module in %s' % name
assert 'message' in w, 'no message in %s' % name

View File

@ -126,8 +126,8 @@ they are found.
def print_stats(items, fname, verbose=False):
errors = len(filter(lambda x: x.level == "ERROR", items))
traces = len(filter(lambda x: x.level == "TRACE", items))
errors = len([x for x in items if x.level == "ERROR"])
traces = len([x for x in items if x.level == "TRACE"])
print("%d ERRORS found in %s" % (errors, fname))
print("%d TRACES found in %s" % (traces, fname))

View File

@ -65,7 +65,7 @@ r = requests.get(url)
# json library won't choke.
projects = sorted(filter(is_in_openstack_namespace, json.loads(r.text[4:])))
found_plugins = filter(has_tempest_plugin, projects)
found_plugins = list(filter(has_tempest_plugin, projects))
# Every element of the found_plugins list begins with "openstack/".
# We drop those initial 10 octets when printing the list.