mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-23 04:24:00 -07:00
update code to python3 (#10903)
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
Some checks are pending
EOL CI / EOL Sanity (Ⓐ2.17) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.10) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.12) (push) Waiting to run
EOL CI / EOL Units (Ⓐ2.17+py3.7) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+alpine319+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+fedora39+py:azp/posix/3/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/1/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/2/) (push) Waiting to run
EOL CI / EOL I (Ⓐ2.17+ubuntu2004+py:azp/posix/3/) (push) Waiting to run
nox / Run extra sanity tests (push) Waiting to run
* update code to python3 * add changelog frag * rollback adjustment for plugins/lookup/lmdb_kv.py * accept PR suggestion for plugins/module_utils/utm_utils.py * accept PR suggestion for plugins/module_utils/vexata.py * Apply suggestions from code review * Update changelogs/fragments/10903-2to3.yml * Update changelogs/fragments/10903-2to3.yml
This commit is contained in:
parent
056633efaa
commit
07cfd6c4b4
8 changed files with 18 additions and 24 deletions
8
changelogs/fragments/10903-2to3.yml
Normal file
8
changelogs/fragments/10903-2to3.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
minor_changes:
|
||||
- pickle cache plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- counter_enabled callback plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- wsl connection plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- cobbler inventory plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- linode inventory plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- utm_utils module_utils plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
||||
- vexata module_utils plugin - use Python 3 idioms (https://github.com/ansible-collections/community.general/pull/10903).
|
5
plugins/cache/pickle.py
vendored
5
plugins/cache/pickle.py
vendored
|
@ -42,10 +42,7 @@ options:
|
|||
type: float
|
||||
"""
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
import pickle
|
||||
|
||||
from ansible.plugins.cache import BaseFileCacheModule
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class CallbackModule(CallbackBase):
|
|||
def v2_playbook_on_play_start(self, play):
|
||||
name = play.get_name().strip()
|
||||
if not name:
|
||||
msg = u"play"
|
||||
msg = "play"
|
||||
else:
|
||||
msg = f"PLAY [{name}]"
|
||||
|
||||
|
|
|
@ -525,9 +525,9 @@ class Connection(ConnectionBase):
|
|||
raise AnsibleAuthenticationFailure(msg)
|
||||
except Exception as e:
|
||||
msg = to_text(e)
|
||||
if u'PID check failed' in msg:
|
||||
if 'PID check failed' in msg:
|
||||
raise AnsibleError('paramiko version issue, please upgrade paramiko on the machine running ansible')
|
||||
elif u'Private key file is encrypted' in msg:
|
||||
elif 'Private key file is encrypted' in msg:
|
||||
msg = (
|
||||
f'ssh {self.get_option("remote_user")}@{self.get_options("remote_addr")}:{port} : '
|
||||
f'{msg}\nTo connect as a different user, use -u <username>.'
|
||||
|
|
|
@ -139,14 +139,10 @@ from ansible_collections.community.general.plugins.plugin_utils.unsafe import ma
|
|||
|
||||
# xmlrpc
|
||||
try:
|
||||
import xmlrpclib as xmlrpc_client
|
||||
import xmlrpc.client as xmlrpc_client
|
||||
HAS_XMLRPC_CLIENT = True
|
||||
except ImportError:
|
||||
try:
|
||||
import xmlrpc.client as xmlrpc_client
|
||||
HAS_XMLRPC_CLIENT = True
|
||||
except ImportError:
|
||||
HAS_XMLRPC_CLIENT = False
|
||||
HAS_XMLRPC_CLIENT = False
|
||||
|
||||
|
||||
class TimeoutTransport (xmlrpc_client.SafeTransport):
|
||||
|
|
|
@ -167,13 +167,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
|||
|
||||
def _add_groups(self):
|
||||
"""Add Linode instance groups to the dynamic inventory."""
|
||||
self.linode_groups = set(
|
||||
filter(None, [
|
||||
instance.group
|
||||
for instance
|
||||
in self.instances
|
||||
])
|
||||
)
|
||||
self.linode_groups = {instance.group for instance in self.instances if instance.group}
|
||||
|
||||
for linode_group in self.linode_groups:
|
||||
self.inventory.add_group(linode_group)
|
||||
|
|
|
@ -183,7 +183,7 @@ class UTM:
|
|||
result = None
|
||||
if response is not None:
|
||||
results = json.loads(response.read())
|
||||
result = next(iter([d for d in results if d['name'] == module.params.get('name')]), None)
|
||||
result = next((d for d in results if d['name'] == module.params.get('name')), None)
|
||||
return info, result
|
||||
|
||||
def _clean_result(self, result):
|
||||
|
|
|
@ -20,10 +20,9 @@ VXOS_VERSION = None
|
|||
def get_version(iocs_json):
|
||||
if not iocs_json:
|
||||
raise Exception('Invalid IOC json')
|
||||
active = [x for x in iocs_json if x['mgmtRole']]
|
||||
if not active:
|
||||
active = next((x for x in iocs_json if x['mgmtRole']), None)
|
||||
if active is None:
|
||||
raise Exception('Unable to detect active IOC')
|
||||
active = active[0]
|
||||
ver = active['swVersion']
|
||||
if ver[0] != 'v':
|
||||
raise Exception('Illegal version string')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue