summaryrefslogtreecommitdiff
path: root/plugins/module_utils
diff options
context:
space:
mode:
authoromnom62 <75066712+omnom62@users.noreply.github.com>2026-09-26 07:52:47 +1000
committerGitHub <noreply@github.com>2026-09-26 07:52:47 +1000
commitfb96f1eda32948dfbb0000266fbc487810c2724a (patch)
tree463daa3bf4cd1179d3cfeb9c7c0a89e6c3aa3d57 /plugins/module_utils
parentde7d67b687b03bfb1ff27ccb049f220e2a711ba7 (diff)
parent51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb (diff)
downloadrest.vyos-T8989_l3_interfaces_dict_op_refactor.tar.gz
rest.vyos-T8989_l3_interfaces_dict_op_refactor.zip
Merge branch 'main' into T8989_l3_interfaces_dict_op_refactorT8989_l3_interfaces_dict_op_refactor
Diffstat (limited to 'plugins/module_utils')
-rw-r--r--plugins/module_utils/vyos.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/plugins/module_utils/vyos.py b/plugins/module_utils/vyos.py
index 92549d6..f7c17f9 100644
--- a/plugins/module_utils/vyos.py
+++ b/plugins/module_utils/vyos.py
@@ -304,6 +304,24 @@ class VyOSModule:
except VyOSRestError:
return {}
+ def get_value(self, path):
+ """Retrieve a single scalar leaf value at *path*.
+
+ Uses VyOS's dedicated "returnValue" retrieve operation --
+ genuinely distinct from get_config's "showConfig" operation,
+ which returns a config subtree rather than a single value.
+ Appropriate for a plain leafNode (e.g. "system host-name"),
+ not a container.
+
+ Errors genuinely propagate rather than being swallowed into a
+ misleading "absent" result: a transient failure here must not
+ be indistinguishable from the value legitimately being unset,
+ since a module could otherwise decide to overwrite a value
+ that's actually already correct.
+ """
+ result = self._client.retrieve_return_value(path)
+ return result.get("data") or ""
+
def apply_commands(self, commands):
if not commands:
return []