-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Description
Salt-api is very useful, but also in need of response normalization. This issue is partially tracked through a few different issues, and it would be helpful to keep progress in a single place. See: #20301 #18510 jenkinsci/saltstack-plugin#18 jenkinsci/saltstack-plugin#36
Here are some short examples demonstrating the problems:
Most state responses include a result key which contains the appropriate success status. So far so good
[{
"outputter": "highstate",
"data": {"pws-3.dev.mpl.ru": {
"file_|-/some/file": {
"comment": "No directory to create /some/file in",
"name": "/other/file",
"start_time": "16:21:10.068787",
"result": false,
"duration": "0.947 ms",
"__run_num__": 6,
"changes": {}
}
}}
}]Other times the API does not include the necessary info at all:
CLI
# salt 'web1' cmd.run 'false 1'
web1:
ERROR: Minions returned with non-zero exit code
API
{
"return": [
{
"web1": ""
}
]
}This same issue occurs with the service execution module. Here is an example of a service failing to restart:
{
"info": [
{
"Arguments": [
"klsdklsd"
],
"Function": "service.restart",
"Minions": [
"web1"
],
"Result": {
"web1": {
"return": false
}
},
"StartTime": "2016, May 27 14:08:28.970138",
"Target": "web1",
"Target-type": "glob",
"User": "jenkins",
"jid": "20160527140828970138"
}
],
"return": [
{
"web1": false
}
]
}
And some errors are in different structures
[{
"outputter": "highstate",
"data": {"minion-name": ["Rendering SLS 'base:hostname' failed: mapping values are not allowed here; line 40..."]}
}]Or
[{"infra01": "ERROR executing 'pillar.get': The following keyword arguments are not valid: output=raw"}]The problem isn't just errors either. Commands like the manage.present runner respond with successful, but again completely different output, making parsing difficult.
[["minion1","minion2","salt"]]Overall, the responses generated by salt-api are somewhat all over the board making for constant edge cases increasing complexity.