From 8ab0591e8553be9ba9b7090d3ff65d517d390aae Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 12 May 2025 22:10:12 +0200 Subject: [PATCH] [PR #10121/de60ea1d backport][stable-10] Fix #10120. Split key=value where value may comprise = (#10125) Fix #10120. Split key=value where value may comprise = (#10121) * Fix #10120. Split key=value where value may comprise = * Added fragment. * Update plugins/modules/sysrc.py * Update changelogs/fragments/10121-sysrc-fix-split-first-separator.yml --------- (cherry picked from commit de60ea1da4d307c9ab16bd99c1d07ea54ccd19fb) Co-authored-by: Vladimir Botka Co-authored-by: Felix Fontein --- changelogs/fragments/10121-sysrc-fix-split-first-separator.yml | 2 ++ plugins/modules/sysrc.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/10121-sysrc-fix-split-first-separator.yml diff --git a/changelogs/fragments/10121-sysrc-fix-split-first-separator.yml b/changelogs/fragments/10121-sysrc-fix-split-first-separator.yml new file mode 100644 index 0000000000..9044edff0e --- /dev/null +++ b/changelogs/fragments/10121-sysrc-fix-split-first-separator.yml @@ -0,0 +1,2 @@ +bugfixes: + - "sysrc - split the output of ``sysrc -e -a`` on the first ``=`` only (https://github.com/ansible-collections/community.general/issues/10120, https://github.com/ansible-collections/community.general/pull/10121)." diff --git a/plugins/modules/sysrc.py b/plugins/modules/sysrc.py index 3387483e46..dad379d1c0 100644 --- a/plugins/modules/sysrc.py +++ b/plugins/modules/sysrc.py @@ -130,7 +130,7 @@ class Sysrc(object): Use this dictionary to preform the tests. """ (rc, out, err) = self.run_sysrc('-e', '-a') - conf = dict([i.split('=') for i in out.splitlines()]) + conf = dict([i.split('=', 1) for i in out.splitlines()]) if self.value is None: return self.name in conf else: