mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Accept nested namespaces in spacewalk.api
salt-run $server spacewalk.api allows users to run arbitrary Spacewalk API functions through Salt. These are passed in a namespace.method notation and may use nested namespaces. Previously only methods in a top-level namespace were supported. Fixes https://github.com/saltstack/salt/issues/57442 Co-authored-by: Wayne Werner <wwerner@saltstack.com>
This commit is contained in:
parent
e52c9f5ea5
commit
a909ab8ad3
2 changed files with 6 additions and 1 deletions
1
changelog/57442.fixed
Normal file
1
changelog/57442.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Accept nested namespaces in spacewalk.api runner function.
|
|
@ -176,7 +176,11 @@ def api(server, command, *args, **kwargs):
|
|||
log.error(err_msg)
|
||||
return {call: err_msg}
|
||||
|
||||
namespace, method = command.split(".")
|
||||
namespace, _, method = command.rpartition(".")
|
||||
if not namespace:
|
||||
return {
|
||||
call: "Error: command must use the following format: 'namespace.method'"
|
||||
}
|
||||
endpoint = getattr(getattr(client, namespace), method)
|
||||
|
||||
try:
|
||||
|
|
Loading…
Add table
Reference in a new issue