Backport #47219 fixes Python 3.7 bugs

* Resolve invalid-unary-operand-type.

* Resolve stop-iteration-return.

(cherry-picked from c24c19594e)
pull/51370/head
Matt Davis 6 years ago committed by Toshio Kuratomi
parent 7d52c07df2
commit f759b5463b

@ -0,0 +1,6 @@
bugfixes:
- consul_kv - minor error-handling bugfix under Python 3.7 (https://github.com/ansible/ansible/pull/47219)
- cnos_backup - fixed syntax error (https://github.com/ansible/ansible/pull/47219)
- cnos_image - fixed syntax error (https://github.com/ansible/ansible/pull/47219)
- apt_repository - fixed failure under Python 3.7 (https://github.com/ansible/ansible/pull/47219)
- netapp_e_storagepool - fixed failure under Python 3.7 (https://github.com/ansible/ansible/pull/47219)

@ -233,7 +233,7 @@ def set_value(module):
value = module.params.get('value')
if value is NOT_SET:
raise AssertionError('Cannot set value of "%s" to `NOT_SET`', (key, ))
raise AssertionError('Cannot set value of "%s" to `NOT_SET`' % key)
index, changed = _has_value_changed(consul_api, key, value)

@ -213,7 +213,7 @@ def doConfigBackUp(module, prompt, answer):
elif(protocol == "tftp"):
command = "copy " + configType + " " + protocol + " " + protocol
command = command + "://" + server + "/" + confPath
command = command + + " vrf management\n"
command = command + " vrf management\n"
# cnos.debugOutput(command)
tftp_cmd = [{'command': command, 'prompt': None, 'answer': None}]
cmd.extend(tftp_cmd)

@ -175,7 +175,7 @@ def doImageDownload(module, prompt, answer):
elif(protocol == "tftp"):
command = "copy " + protocol + " " + protocol + "://" + server
command = command + "/" + imgPath + " system-image " + imgType
command = command + + " vrf management"
command = command + " vrf management"
prompt = ['Confirm download operation',
'Do you want to change that to the standby image']
answer = ['y', 'y']

@ -184,7 +184,6 @@ class SourcesList(object):
for n, valid, enabled, source, comment in sources:
if valid:
yield file, n, enabled, source, comment
raise StopIteration
def _expand_path(self, filename):
if '/' in filename:

@ -145,7 +145,10 @@ class GroupBy(object):
def _grouper(self, tgtkey):
while self.currkey == tgtkey:
yield self.currvalue
self.currvalue = next(self.it) # Exit on StopIteration
try:
self.currvalue = next(self.it) # Exit on StopIteration
except StopIteration:
return
self.currkey = self.keyfunc(self.currvalue)

Loading…
Cancel
Save