mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-03 07:41:30 -07:00
Fix undefined variables, basestring usage, and some associated python3 issues
This commit is contained in:
parent
9f7b0dfc30
commit
225fa5d092
84 changed files with 652 additions and 963 deletions
|
@ -137,7 +137,8 @@ EXAMPLES = '''
|
|||
import os.path
|
||||
import re
|
||||
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems, string_types
|
||||
|
||||
|
||||
# exceptions -------------------------------------------------------------- {{{
|
||||
|
@ -206,7 +207,7 @@ class Homebrew(object):
|
|||
- os.path.sep
|
||||
'''
|
||||
|
||||
if isinstance(path, basestring):
|
||||
if isinstance(path, string_types):
|
||||
return not cls.INVALID_PATH_REGEX.search(path)
|
||||
|
||||
try:
|
||||
|
@ -234,7 +235,7 @@ class Homebrew(object):
|
|||
return True
|
||||
|
||||
return (
|
||||
isinstance(brew_path, basestring)
|
||||
isinstance(brew_path, string_types)
|
||||
and not cls.INVALID_BREW_PATH_REGEX.search(brew_path)
|
||||
)
|
||||
|
||||
|
@ -246,7 +247,7 @@ class Homebrew(object):
|
|||
return True
|
||||
|
||||
return (
|
||||
isinstance(package, basestring)
|
||||
isinstance(package, string_types)
|
||||
and not cls.INVALID_PACKAGE_REGEX.search(package)
|
||||
)
|
||||
|
||||
|
@ -267,7 +268,7 @@ class Homebrew(object):
|
|||
return True
|
||||
else:
|
||||
return (
|
||||
isinstance(state, basestring)
|
||||
isinstance(state, string_types)
|
||||
and state.lower() in (
|
||||
'installed',
|
||||
'upgraded',
|
||||
|
@ -316,7 +317,7 @@ class Homebrew(object):
|
|||
raise HomebrewException(self.message)
|
||||
|
||||
else:
|
||||
if isinstance(path, basestring):
|
||||
if isinstance(path, string_types):
|
||||
self._path = path.split(':')
|
||||
else:
|
||||
self._path = path
|
||||
|
@ -515,7 +516,7 @@ class Homebrew(object):
|
|||
'update',
|
||||
])
|
||||
if rc == 0:
|
||||
if out and isinstance(out, basestring):
|
||||
if out and isinstance(out, string_types):
|
||||
already_updated = any(
|
||||
re.search(r'Already up-to-date.', s.strip(), re.IGNORECASE)
|
||||
for s in out.split('\n')
|
||||
|
@ -902,8 +903,6 @@ def main():
|
|||
else:
|
||||
module.exit_json(changed=changed, msg=message)
|
||||
|
||||
# this is magic, see lib/ansible/module_common.py
|
||||
from ansible.module_utils.basic import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue