diff --git a/changelogs/fragments/10400-sysrc.yml b/changelogs/fragments/10400-sysrc.yml index 6eb21104fa..ac5d5a5f3f 100644 --- a/changelogs/fragments/10400-sysrc.yml +++ b/changelogs/fragments/10400-sysrc.yml @@ -1,2 +1,2 @@ bugfixes: - - "sysrc - use shlex to improve parsing of ``sysrc -e -a`` output (https://github.com/ansible-collections/community.general/issues/10394, https://github.com/ansible-collections/community.general/pull/10400)." + - "sysrc - use ``shlex`` to improve parsing of ``sysrc -e -a`` output (https://github.com/ansible-collections/community.general/issues/10394, https://github.com/ansible-collections/community.general/pull/10400)." diff --git a/plugins/modules/sysrc.py b/plugins/modules/sysrc.py index 5aa252d74c..1202883c23 100644 --- a/plugins/modules/sysrc.py +++ b/plugins/modules/sysrc.py @@ -136,7 +136,7 @@ class Sysrc(object): if self.value is None: return self.name in conf else: - return self.name in conf and conf[self.name] == self.value + return conf.get(self.name) == self.value def contains(self): (rc, out, err) = self.run_sysrc('-n', self.name)