mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-26 21:33:12 +00:00
yum_versionlock: remove to_native() around command output (#11093)
* yum_versionlock: remove redundant use of to_native() around command output * reformat * add changelog frag
This commit is contained in:
2
changelogs/fragments/11093-yum-versionlock-to-native.yml
Normal file
2
changelogs/fragments/11093-yum-versionlock-to-native.yml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- yum_versionlock - remove redundant conversion to unicode in command output (https://github.com/ansible-collections/community.general/pull/11093).
|
||||||
@@ -88,7 +88,6 @@ state:
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from ansible.module_utils.basic import AnsibleModule
|
from ansible.module_utils.basic import AnsibleModule
|
||||||
from ansible.module_utils.common.text.converters import to_native
|
|
||||||
from fnmatch import fnmatch
|
from fnmatch import fnmatch
|
||||||
|
|
||||||
# on DNF-based distros, yum is a symlink to dnf, so we try to handle their different entry formats.
|
# on DNF-based distros, yum is a symlink to dnf, so we try to handle their different entry formats.
|
||||||
@@ -114,10 +113,8 @@ class YumVersionLock:
|
|||||||
if rc == 0:
|
if rc == 0:
|
||||||
return out
|
return out
|
||||||
elif rc == 1 and "o such command:" in err:
|
elif rc == 1 and "o such command:" in err:
|
||||||
self.module.fail_json(
|
self.module.fail_json(msg=f"Error: Please install rpm package yum-plugin-versionlock : {err}{out}")
|
||||||
msg=f"Error: Please install rpm package yum-plugin-versionlock : {to_native(err)}{to_native(out)}"
|
self.module.fail_json(msg=f"Error: {err}{out}")
|
||||||
)
|
|
||||||
self.module.fail_json(msg=f"Error: {to_native(err)}{to_native(out)}")
|
|
||||||
|
|
||||||
def ensure_state(self, packages, command):
|
def ensure_state(self, packages, command):
|
||||||
"""Ensure packages state"""
|
"""Ensure packages state"""
|
||||||
@@ -127,7 +124,7 @@ class YumVersionLock:
|
|||||||
self.module.fail_json(msg=out)
|
self.module.fail_json(msg=out)
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
return True
|
return True
|
||||||
self.module.fail_json(msg=f"Error: {to_native(err)}{to_native(out)}")
|
self.module.fail_json(msg=f"Error: {err}{out}")
|
||||||
|
|
||||||
|
|
||||||
def match(entry, name):
|
def match(entry, name):
|
||||||
|
|||||||
Reference in New Issue
Block a user