You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] Spacewalk runner does not properly parse method namespaces #57442
Execution-ModuleMagnesiumMg release after Na prior to Albugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Description
The spacewalk runner does not properly parse the method namespaces. It assumes that a simple .split('.') will result in a two element list [ namespace, method ]. This works in simple cases such as 'system.listSystems' but fails for namespaces such as 'channel.software.listChildren' which results in three elements and causes the following exception:
Exception occurred in runner spacewalk.api: Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/salt/client/mixins.py", line 377, in low
data['return'] = func(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/salt/runners/spacewalk.py", line 175, in api
namespace, method = command.split('.')
ValueError: too many values to unpack (expected 2)
Setup
N/A
Steps to Reproduce the behavior
salt-run $spacewalkserver spacewalk.api channel.software.listChildren $basechannel
Expected behavior
Should not cause a stack trace
Screenshots
If applicable, add screenshots to help explain your problem.
Versions Report
Irrelevant. Bug has been present since runner was initially committed.
I'm running a 2019.2 branch and it's still present in Salt 3000.1
command.split(".", maxsplit=2) does not work, since maxsplit is the number of allowed splits. With 2 splits there would be 3 elements in the list. maxsplit=1 does not work either in this case since it starts on the left side and puts too many things on the right element in the resulting list:
Execution-ModuleMagnesiumMg release after Na prior to Albugbroken, incorrect, or confusing behaviorseverity-medium3rd level, incorrect or bad functionality, confusing and lacks a work around
Activity
Akm0d commentedon May 27, 2020
I wonder if
command.split(".", maxsplit=2)could also do the trick.@LinuxLeafFan Do you want to try opening a PR to fix this?
agraul commentedon May 28, 2020
command.split(".", maxsplit=2)does not work, sincemaxsplitis the number of allowed splits. With 2 splits there would be 3 elements in the list.maxsplit=1does not work either in this case since it starts on the left side and puts too many things on the right element in the resulting list:openSUSE-3000 spacewalk runner parse command (#247)
openSUSE-3000.3 spacewalk runner parse command (#250)
Backport: spacewalk runner parse command (#247)
openSUSE-3000 spacewalk runner parse command (#247)
Accept nested namespaces in spacewalk.api
Accept nested namespaces in spacewalk.api
openSUSE-3000.3 spacewalk runner parse command (saltstack#250)