1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-26 23:17:33 +00:00

[PR #3194/1fec1d0c backport][stable-3] Fix sanity failures (#3195) (#3196)

* Fix new devel sanity errors. (#3194)

(cherry picked from commit 1fec1d0c81)

* Add two more.

* Fix PR #.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 1a3c221995)

Co-authored-by: patchback[bot] <45432694+patchback[bot]@users.noreply.github.com>
This commit is contained in:
Felix Fontein 2021-08-12 14:17:01 +02:00 committed by GitHub
parent d85908da6e
commit bc02dc4c44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 45 additions and 30 deletions

View file

@ -141,14 +141,14 @@ class Plist:
self.__changed = False
self.__service = service
state, pid, dummy, dummy = LaunchCtlList(module, service).run()
state, pid, dummy, dummy = LaunchCtlList(module, self.__service).run()
# Check if readPlist is available or not
self.old_plistlib = hasattr(plistlib, 'readPlist')
self.__file = self.__find_service_plist(service)
self.__file = self.__find_service_plist(self.__service)
if self.__file is None:
msg = 'Unable to infer the path of %s service plist file' % service
msg = 'Unable to infer the path of %s service plist file' % self.__service
if pid is None and state == ServiceState.UNLOADED:
msg += ' and it was not found among active services'
module.fail_json(msg=msg)

View file

@ -526,8 +526,8 @@ def main():
lines = [(numbered_line_re.match(line), '(v6)' in line) for line in numbered_state.splitlines()]
lines = [(int(matcher.group(1)), ipv6) for (matcher, ipv6) in lines if matcher]
last_number = max([no for (no, ipv6) in lines]) if lines else 0
has_ipv4 = any([not ipv6 for (no, ipv6) in lines])
has_ipv6 = any([ipv6 for (no, ipv6) in lines])
has_ipv4 = any(not ipv6 for (no, ipv6) in lines)
has_ipv6 = any(ipv6 for (no, ipv6) in lines)
if relative_to_cmd == 'first-ipv4':
relative_to = 1
elif relative_to_cmd == 'last-ipv4':