diff options
| author | omnom62 <75066712+omnom62@users.noreply.github.com> | 2026-09-26 07:47:54 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-26 07:47:54 +1000 |
| commit | 51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb (patch) | |
| tree | 2a4b8bf59c8d852e263d74a328e2f84a6dad379f /plugins/module_utils | |
| parent | 9fe93349225eb9b014e7a3e397da88fece40a0b2 (diff) | |
| parent | 7b4c77e8ee650314c8913e0565ffb93194007284 (diff) | |
| download | rest.vyos-51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb.tar.gz rest.vyos-51e6ddb410d0ec7cd0845cf8bb382c9d0d0144eb.zip | |
Merge pull request #28 from vyos/T8989_vyos_hostname_SIT_fix
T8989: vyos_hostname rework
Diffstat (limited to 'plugins/module_utils')
| -rw-r--r-- | plugins/module_utils/vyos.py | 18 |
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 [] |
