Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which supports Python 3. Fix problems found by updated hacking version. Remove hacking and friends from lower-constraints, they are not needed during installation. Change-Id: Ic63e432161dcebb62e0b510af03e03f7bebb3fd7
This commit is contained in:
parent
1db23c75fd
commit
d237a3ed06
|
@ -139,5 +139,6 @@ def main():
|
|||
setup_ansible_etc()
|
||||
setup_ansible_home()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -41,7 +41,7 @@ class GroupAdd(Command):
|
|||
CLIENT.group_add([groupname])
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -61,7 +61,7 @@ class GroupRemove(Command):
|
|||
CLIENT.group_remove([groupname])
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -85,7 +85,7 @@ class GroupAddhost(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ class GroupRemovehost(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -129,7 +129,7 @@ class GroupList(Lister):
|
|||
return ((u._('Group'), ), sorted(data))
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -149,7 +149,7 @@ class GroupListhosts(Lister):
|
|||
return ((u._('Group'), u._('Hosts')), sorted(data))
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -169,5 +169,5 @@ class GroupListservices(Lister):
|
|||
return ((u._('Group'), u._('Services')), sorted(data))
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
|
|
@ -51,7 +51,7 @@ class HostAdd(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ class HostDestroy(Command):
|
|||
handers_action_result(job, status, verbose_level)
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
def _is_ok_to_delete_data(self):
|
||||
|
@ -140,7 +140,7 @@ class HostRemove(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -180,7 +180,7 @@ class HostList(Lister):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -218,7 +218,7 @@ class HostCheck(Command):
|
|||
raise CommandError(u._('Host check failed.'))
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -276,7 +276,7 @@ class HostSetup(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
def _get_yml_data(self, yml_path):
|
||||
|
|
|
@ -51,7 +51,7 @@ class ServiceAddGroup(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -76,7 +76,7 @@ class ServiceRemoveGroup(Command):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -97,7 +97,7 @@ class ServiceListGroups(Lister):
|
|||
return (u._('Service'), u._('Groups')), sorted(data)
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
||||
|
||||
|
@ -119,5 +119,5 @@ class ServiceList(Lister):
|
|||
|
||||
except ClientException as e:
|
||||
raise CommandError(str(e))
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Exception(traceback.format_exc())
|
||||
|
|
|
@ -210,7 +210,7 @@ class AnsibleJob(object):
|
|||
u'/etc/kolla/config/aodh.conf'"}\n
|
||||
"""
|
||||
fail_key = '\nfailed: '
|
||||
hostnames = re.findall(fail_key + '\[(.+?)]', self._cmd_output)
|
||||
hostnames = re.findall(fail_key + r'\[(.+?)]', self._cmd_output)
|
||||
msgs = re.findall(fail_key + '.+ => (.+?)\n', self._cmd_output)
|
||||
|
||||
for i in range(0, min(len(hostnames), len(msgs))):
|
||||
|
|
|
@ -65,5 +65,6 @@ def main(argv=sys.argv[1:]):
|
|||
shell = KollaCli()
|
||||
return shell.run(argv)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main(sys.argv[1:]))
|
||||
|
|
|
@ -114,28 +114,28 @@ class KollaCliTest(testtools.TestCase):
|
|||
self._check_invalid_arg(method, new_args)
|
||||
|
||||
def _check_invalid_arg(self, method, args):
|
||||
assert(len(args) <= 5)
|
||||
try:
|
||||
if len(args) == 1:
|
||||
method(args[0])
|
||||
elif len(args) == 2:
|
||||
method(args[0], args[1])
|
||||
elif len(args) == 3:
|
||||
method(args[0], args[1], args[2])
|
||||
elif len(args) == 4:
|
||||
method(args[0], args[1], args[2], args[3])
|
||||
elif len(args) == 5:
|
||||
method(args[0], args[1], args[2], args[3], args[4])
|
||||
except InvalidArgument:
|
||||
# success
|
||||
return
|
||||
except Exception as e:
|
||||
self.assertTrue(False,
|
||||
'method: %s, arg: %s ' % (method, args) +
|
||||
'failed with the wrong exception: '
|
||||
'%s' % str(e))
|
||||
self.assertTrue(False, 'method: %s, arg: %s did not fail'
|
||||
% (method, args))
|
||||
assert(len(args) <= 5)
|
||||
try:
|
||||
if len(args) == 1:
|
||||
method(args[0])
|
||||
elif len(args) == 2:
|
||||
method(args[0], args[1])
|
||||
elif len(args) == 3:
|
||||
method(args[0], args[1], args[2])
|
||||
elif len(args) == 4:
|
||||
method(args[0], args[1], args[2], args[3])
|
||||
elif len(args) == 5:
|
||||
method(args[0], args[1], args[2], args[3], args[4])
|
||||
except InvalidArgument:
|
||||
# success
|
||||
return
|
||||
except Exception as e:
|
||||
self.assertTrue(False,
|
||||
'method: %s, arg: %s ' % (method, args) +
|
||||
'failed with the wrong exception: '
|
||||
'%s' % str(e))
|
||||
self.assertTrue(False, 'method: %s, arg: %s did not fail'
|
||||
% (method, args))
|
||||
|
||||
# PRIVATE FUNCTIONS ----------------------------------------------------
|
||||
def _save_config(self):
|
||||
|
|
|
@ -105,44 +105,44 @@ class TestFunctional(KollaCliTest):
|
|||
self._test_v2_upgrade()
|
||||
|
||||
def _test_v1_upgrade(self):
|
||||
# this is a v1 inventory
|
||||
# in v1 > v2, ceilometer was added, check that it's there
|
||||
# and verify that all ceilometer groups are in the same groups
|
||||
# as heat.
|
||||
ansible_inventory = AnsibleInventory()
|
||||
heat = CLIENT.service_get(['heat'])[0]
|
||||
expected_groups = sorted(heat.get_groups())
|
||||
ceilometer = ansible_inventory.services['ceilometer']
|
||||
expected_services = ceilometer.get_sub_servicenames()
|
||||
expected_services.append('ceilometer')
|
||||
expected_services = sorted(expected_services)
|
||||
services = CLIENT.service_get_all()
|
||||
services_found = []
|
||||
# this is a v1 inventory
|
||||
# in v1 > v2, ceilometer was added, check that it's there
|
||||
# and verify that all ceilometer groups are in the same groups
|
||||
# as heat.
|
||||
ansible_inventory = AnsibleInventory()
|
||||
heat = CLIENT.service_get(['heat'])[0]
|
||||
expected_groups = sorted(heat.get_groups())
|
||||
ceilometer = ansible_inventory.services['ceilometer']
|
||||
expected_services = ceilometer.get_sub_servicenames()
|
||||
expected_services.append('ceilometer')
|
||||
expected_services = sorted(expected_services)
|
||||
services = CLIENT.service_get_all()
|
||||
services_found = []
|
||||
|
||||
for service in services:
|
||||
servicename = service.get_name()
|
||||
if servicename.startswith('ceilometer'):
|
||||
groups = sorted(service.get_groups())
|
||||
if servicename == 'ceilometer':
|
||||
self.assertEqual(expected_groups, groups,
|
||||
'groups mismatch between '
|
||||
'ceilometer '
|
||||
'and %s' % servicename)
|
||||
elif servicename == 'ceilometer-compute':
|
||||
self.assertEqual(['compute'], groups,
|
||||
'groups mismatch between '
|
||||
'ceilometer-compute '
|
||||
'and %s' % servicename)
|
||||
else:
|
||||
# sub-services should have no groups (they inherit)
|
||||
self.assertEqual([], groups,
|
||||
'%s has unexpected groups'
|
||||
% servicename)
|
||||
services_found.append(servicename)
|
||||
for service in services:
|
||||
servicename = service.get_name()
|
||||
if servicename.startswith('ceilometer'):
|
||||
groups = sorted(service.get_groups())
|
||||
if servicename == 'ceilometer':
|
||||
self.assertEqual(expected_groups, groups,
|
||||
'groups mismatch between '
|
||||
'ceilometer '
|
||||
'and %s' % servicename)
|
||||
elif servicename == 'ceilometer-compute':
|
||||
self.assertEqual(['compute'], groups,
|
||||
'groups mismatch between '
|
||||
'ceilometer-compute '
|
||||
'and %s' % servicename)
|
||||
else:
|
||||
# sub-services should have no groups (they inherit)
|
||||
self.assertEqual([], groups,
|
||||
'%s has unexpected groups'
|
||||
% servicename)
|
||||
services_found.append(servicename)
|
||||
|
||||
services_found = sorted(services_found)
|
||||
self.assertEqual(expected_services, services_found,
|
||||
'ceilometer subservices mismatch')
|
||||
services_found = sorted(services_found)
|
||||
self.assertEqual(expected_services, services_found,
|
||||
'ceilometer subservices mismatch')
|
||||
|
||||
def _test_v2_upgrade(self):
|
||||
# this is a v2 inventory. In the v2 to v3 upgrade, all subservices were
|
||||
|
@ -169,5 +169,6 @@ class TestFunctional(KollaCliTest):
|
|||
self.assertIn('aodh', servicenames, 'aodh not in inventory')
|
||||
self.assertIn('ceph', servicenames, 'ceph not in inventory')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -144,5 +144,6 @@ class TestFunctional(KollaCliTest):
|
|||
|
||||
return True
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -92,5 +92,6 @@ class TestFunctional(KollaCliTest):
|
|||
'Job %s: No hosts, but got wrong error: %s'
|
||||
% (descr, output))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -191,5 +191,6 @@ class TestFunctional(KollaCliTest):
|
|||
home = os.path.expanduser('~')
|
||||
return os.path.join(home, TEST_YML_FNAME)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -131,5 +131,6 @@ class TestFunctional(KollaCliTest):
|
|||
return True
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -289,5 +289,6 @@ class TestFunctional(KollaCliTest):
|
|||
(key, value, prop['OVR'], ovr_string))
|
||||
return error_msg
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -45,5 +45,6 @@ class TestFunctional(KollaCliTest):
|
|||
'unexpected exception in reconfigure %s, %s'
|
||||
% (e.message, msg))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -74,5 +74,6 @@ class TestFunctional(KollaCliTest):
|
|||
self.assertEqual(1, status, 'Job %s ' % descr +
|
||||
'succeeded when it should have failed')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -71,8 +71,8 @@ class TestFunctional(KollaCliTest):
|
|||
raise Exception('get_logs command succeeded without physical '
|
||||
'hosts')
|
||||
except Exception as e:
|
||||
self.assertIn('UNREACHABLE', str(e),
|
||||
'unexpected failure in get_logs: %s' % str(e))
|
||||
self.assertIn('UNREACHABLE', str(e),
|
||||
'unexpected failure in get_logs: %s' % str(e))
|
||||
finally:
|
||||
if os.path.exists(LOGDIR):
|
||||
shutil.rmtree(LOGDIR)
|
||||
|
|
|
@ -25,10 +25,8 @@ dogpile.cache==0.6.5
|
|||
dulwich==0.19.0
|
||||
extras==1.0.0
|
||||
fixtures==3.0.0
|
||||
flake8==2.5.5
|
||||
gitdb2==2.0.3
|
||||
GitPython==2.1.8
|
||||
hacking==1.1.0
|
||||
idna==2.6
|
||||
imagesize==1.0.0
|
||||
iso8601==0.1.12
|
||||
|
@ -41,7 +39,6 @@ jsonschema==2.6.0
|
|||
keystoneauth1==3.4.0
|
||||
linecache2==1.0.0
|
||||
MarkupSafe==1.0
|
||||
mccabe==0.2.1
|
||||
monotonic==1.4
|
||||
mox3==0.25.0
|
||||
mypy==0.6
|
||||
|
@ -66,7 +63,6 @@ paramiko==2.6.0
|
|||
pbr==2.0.0
|
||||
prettytable==0.7.1
|
||||
pycparser==2.18
|
||||
pyflakes==0.8.1
|
||||
Pygments==2.2.0
|
||||
pyinotify==0.9.6
|
||||
pyOpenSSL==17.5.0
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# process, which may cause wedges in the gate later.
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
|
||||
hacking>=1.1.0,<1.2.0
|
||||
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||
|
||||
ansible>=2.5.0
|
||||
# security linter
|
||||
|
|
Loading…
Reference in New Issue