Merge "Update hacking for Python3"
This commit is contained in:
commit
fa49143f10
@ -96,10 +96,10 @@ EXAMPLES = '''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
JSON_REG = re.compile('^(?P<host>\w+) \| (?P<status>\w+)!? =>(?P<stdout>.*)$',
|
JSON_REG = re.compile(r'^(?P<host>\w+) \| (?P<status>\w+)!? =>(?P<stdout>.*)$',
|
||||||
re.MULTILINE | re.DOTALL)
|
re.MULTILINE | re.DOTALL)
|
||||||
NON_JSON_REG = re.compile(('^(?P<host>\w+) \| (?P<status>\w+)!? \| '
|
NON_JSON_REG = re.compile((r'^(?P<host>\w+) \| (?P<status>\w+)!? \| '
|
||||||
'rc=(?P<exit_code>\d+) >>\n(?P<stdout>.*)\n$'),
|
r'rc=(?P<exit_code>\d+) >>\n(?P<stdout>.*)\n$'),
|
||||||
re.MULTILINE | re.DOTALL)
|
re.MULTILINE | re.DOTALL)
|
||||||
|
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ def main():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
output = json.loads(json_output)
|
output = json.loads(json_output)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg='Can not parse the inner module output: %s' % json_output)
|
msg='Can not parse the inner module output: %s' % json_output)
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ def main():
|
|||||||
# }
|
# }
|
||||||
try:
|
try:
|
||||||
ret = output['plays'][0]['tasks'][0]['hosts']['localhost']
|
ret = output['plays'][0]['tasks'][0]['hosts']['localhost']
|
||||||
except (KeyError, IndexError) as e:
|
except (KeyError, IndexError):
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg='Ansible JSON output has unexpected format: %s' % output)
|
msg='Ansible JSON output has unexpected format: %s' % output)
|
||||||
|
|
||||||
|
@ -143,12 +143,12 @@ class TestKollaAddressFilter(unittest.TestCase):
|
|||||||
'prefix': 64,
|
'prefix': 64,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'address': addr+'1',
|
'address': addr + '1',
|
||||||
'scope': 'link',
|
'scope': 'link',
|
||||||
'prefix': 64,
|
'prefix': 64,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'address': addr+'2',
|
'address': addr + '2',
|
||||||
'scope': 'global',
|
'scope': 'global',
|
||||||
'prefix': 64,
|
'prefix': 64,
|
||||||
},
|
},
|
||||||
@ -175,7 +175,7 @@ class TestKollaAddressFilter(unittest.TestCase):
|
|||||||
'prefix': 64,
|
'prefix': 64,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'address': addr+'1',
|
'address': addr + '1',
|
||||||
'scope': 'link',
|
'scope': 'link',
|
||||||
'prefix': 64,
|
'prefix': 64,
|
||||||
},
|
},
|
||||||
|
@ -122,7 +122,7 @@ class TestFilters(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch.object(filters, 'service_enabled')
|
@mock.patch.object(filters, 'service_enabled')
|
||||||
@mock.patch.object(filters, 'service_mapped_to_host')
|
@mock.patch.object(filters, 'service_mapped_to_host')
|
||||||
def test_service_enabled_and_mapped_to_host(self, mock_mapped,
|
def test_service_enabled_and_mapped_to_host(self, mock_mapped,
|
||||||
mock_enabled):
|
mock_enabled):
|
||||||
service = {}
|
service = {}
|
||||||
mock_enabled.return_value = True
|
mock_enabled.return_value = True
|
||||||
@ -134,7 +134,7 @@ class TestFilters(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch.object(filters, 'service_enabled')
|
@mock.patch.object(filters, 'service_enabled')
|
||||||
@mock.patch.object(filters, 'service_mapped_to_host')
|
@mock.patch.object(filters, 'service_mapped_to_host')
|
||||||
def test_service_enabled_and_mapped_to_host_disabled(self, mock_mapped,
|
def test_service_enabled_and_mapped_to_host_disabled(self, mock_mapped,
|
||||||
mock_enabled):
|
mock_enabled):
|
||||||
service = {}
|
service = {}
|
||||||
mock_enabled.return_value = False
|
mock_enabled.return_value = False
|
||||||
@ -146,7 +146,7 @@ class TestFilters(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch.object(filters, 'service_enabled')
|
@mock.patch.object(filters, 'service_enabled')
|
||||||
@mock.patch.object(filters, 'service_mapped_to_host')
|
@mock.patch.object(filters, 'service_mapped_to_host')
|
||||||
def test_service_enabled_and_mapped_to_host_not_mapped(self, mock_mapped,
|
def test_service_enabled_and_mapped_to_host_not_mapped(self, mock_mapped,
|
||||||
mock_enabled):
|
mock_enabled):
|
||||||
service = {}
|
service = {}
|
||||||
mock_enabled.return_value = True
|
mock_enabled.return_value = True
|
||||||
|
@ -23,10 +23,8 @@ dogpile.cache==0.6.5
|
|||||||
dulwich==0.19.0
|
dulwich==0.19.0
|
||||||
extras==1.0.0
|
extras==1.0.0
|
||||||
fixtures==3.0.0
|
fixtures==3.0.0
|
||||||
flake8==2.5.5
|
|
||||||
gitdb2==2.0.3
|
gitdb2==2.0.3
|
||||||
GitPython==2.1.8
|
GitPython==2.1.8
|
||||||
hacking==1.1.0
|
|
||||||
idna==2.6
|
idna==2.6
|
||||||
imagesize==1.0.0
|
imagesize==1.0.0
|
||||||
iso8601==0.1.12
|
iso8601==0.1.12
|
||||||
@ -38,7 +36,6 @@ jsonschema==2.6.0
|
|||||||
keystoneauth1==3.4.0
|
keystoneauth1==3.4.0
|
||||||
linecache2==1.0.0
|
linecache2==1.0.0
|
||||||
MarkupSafe==1.0
|
MarkupSafe==1.0
|
||||||
mccabe==0.2.1
|
|
||||||
monotonic==1.4
|
monotonic==1.4
|
||||||
mox3==0.25.0
|
mox3==0.25.0
|
||||||
msgpack==0.5.6
|
msgpack==0.5.6
|
||||||
@ -61,7 +58,6 @@ packaging==17.1
|
|||||||
pbr==2.0.0
|
pbr==2.0.0
|
||||||
prettytable==0.7.1
|
prettytable==0.7.1
|
||||||
pycparser==2.18
|
pycparser==2.18
|
||||||
pyflakes==0.8.1
|
|
||||||
Pygments==2.2.0
|
Pygments==2.2.0
|
||||||
pyinotify==0.9.6
|
pyinotify==0.9.6
|
||||||
pyOpenSSL==17.5.0
|
pyOpenSSL==17.5.0
|
||||||
|
@ -7,7 +7,7 @@ beautifulsoup4>=4.6.0 # MIT
|
|||||||
coverage!=4.4,>=4.0 # Apache-2.0
|
coverage!=4.4,>=4.0 # Apache-2.0
|
||||||
doc8>=0.6.0 # Apache-2.0
|
doc8>=0.6.0 # Apache-2.0
|
||||||
extras>=1.0.0 # MIT
|
extras>=1.0.0 # MIT
|
||||||
hacking>=1.1.0,<1.2.0 # Apache-2.0
|
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||||
oslo.log>=3.36.0 # Apache-2.0
|
oslo.log>=3.36.0 # Apache-2.0
|
||||||
oslotest>=3.2.0 # Apache-2.0
|
oslotest>=3.2.0 # Apache-2.0
|
||||||
PrettyTable<0.8,>=0.7.1 # BSD
|
PrettyTable<0.8,>=0.7.1 # BSD
|
||||||
|
@ -96,7 +96,7 @@ class ModuleArgsTest(base.BaseTestCase):
|
|||||||
dimensions=dict(required=False, type='dict', default=dict()),
|
dimensions=dict(required=False, type='dict', default=dict()),
|
||||||
tty=dict(required=False, type='bool', default=False),
|
tty=dict(required=False, type='bool', default=False),
|
||||||
client_timeout=dict(required=False, type='int', default=120),
|
client_timeout=dict(required=False, type='int', default=120),
|
||||||
)
|
)
|
||||||
required_if = [
|
required_if = [
|
||||||
['action', 'pull_image', ['image']],
|
['action', 'pull_image', ['image']],
|
||||||
['action', 'start_container', ['image', 'name']],
|
['action', 'start_container', ['image', 'name']],
|
||||||
|
@ -196,5 +196,6 @@ def main():
|
|||||||
)
|
)
|
||||||
return sum([check() for check in checks])
|
return sum([check() for check in checks])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
sys.exit(main())
|
sys.exit(main())
|
||||||
|
@ -40,5 +40,6 @@ def main():
|
|||||||
|
|
||||||
sys.exit(res)
|
sys.exit(res)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
5
tox.ini
5
tox.ini
@ -98,6 +98,11 @@ commands =
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
show-source = True
|
show-source = True
|
||||||
|
# NOTE: Default ignore list is *not* empty!
|
||||||
|
# TODO: Enable either W503 or W504:
|
||||||
|
# W503 line break before binary operator
|
||||||
|
# W504 line break after binary operator
|
||||||
|
ignore = W503,W504
|
||||||
exclude=.eggs,.git,.tox,doc
|
exclude=.eggs,.git,.tox,doc
|
||||||
|
|
||||||
[testenv:lower-constraints]
|
[testenv:lower-constraints]
|
||||||
|
Loading…
Reference in New Issue
Block a user