All Apps and Add-ons

Getting a status code 400 (Bad Request) when trying to restore a object of type dashboard. VersionControl For Splunk v1.0.5.

chris_barrett
SplunkTrust
SplunkTrust

We're experimenting with "v1.0.5 VersionControl For Splunk" https://splunkbase.splunk.com/app/4355 and experiencing an error when attempting to restore an object.

ERROR name=<dashboard> with URL=https://<splunkserver>:8089/servicesNS/<user>/<app>/data/ui/views/<dashboard> statuscode=400 reason=Bad Request, response="<?xml version="1.0" encoding="UTF-8"?>
<response>
<message>
<msg type="ERROR">Argument "version" is not supported by this handler.</msg>
</message>
</response>", in app=<app>, owner=<user>

The backup component works correctly, however the restore feature fails. Please help!

1 Solution

gjanders
SplunkTrust
SplunkTrust

Thanks for reporting this, I did a quick check in my environment and while the dashboard I tested did not have a "version" on it, another dashboard did have it.

So the way the app works is I pull all attributes via a GET command on the REST API, and then POST back the required data. Unfortunately there are various attributes which you cannot submit via a POST request.

In this particular case, line 582 of the splunkversioncontrol_backup_class.py had:

ignoreList = [ "disabled", "eai:appName", "eai:digest", "eai:userName", "isDashboard", "isVisible", "label", "rootNode", "description" ]

I will update that to:

ignoreList = [ "disabled", "eai:appName", "eai:digest", "eai:userName", "isDashboard", "isVisible", "label", "rootNode", "description", "version" ]

I've put a pull request here:
https://github.com/gjanders/SplunkVersionControl/pull/9/files

If you want to restore a dashboard that has been backed up before this fix you can delete the "version" attribute from within the xml dictionary...(or a temporary hack could be put into the restore code if required).
Future backups will not include the version attribute so this will not be an issue going forward...

Once I have tested the above further I will release a new version of the app on SplunkBase

View solution in original post

0 Karma

gjanders
SplunkTrust
SplunkTrust

Thanks for reporting this, I did a quick check in my environment and while the dashboard I tested did not have a "version" on it, another dashboard did have it.

So the way the app works is I pull all attributes via a GET command on the REST API, and then POST back the required data. Unfortunately there are various attributes which you cannot submit via a POST request.

In this particular case, line 582 of the splunkversioncontrol_backup_class.py had:

ignoreList = [ "disabled", "eai:appName", "eai:digest", "eai:userName", "isDashboard", "isVisible", "label", "rootNode", "description" ]

I will update that to:

ignoreList = [ "disabled", "eai:appName", "eai:digest", "eai:userName", "isDashboard", "isVisible", "label", "rootNode", "description", "version" ]

I've put a pull request here:
https://github.com/gjanders/SplunkVersionControl/pull/9/files

If you want to restore a dashboard that has been backed up before this fix you can delete the "version" attribute from within the xml dictionary...(or a temporary hack could be put into the restore code if required).
Future backups will not include the version attribute so this will not be an issue going forward...

Once I have tested the above further I will release a new version of the app on SplunkBase

0 Karma

gjanders
SplunkTrust
SplunkTrust

Tested locally and it worked if I deleted the .pyc file with the same name (could be a temporary/environment issue for me), I'll release a new version soon

0 Karma

gjanders
SplunkTrust
SplunkTrust
0 Karma

chris_barrett
SplunkTrust
SplunkTrust

Tested v1.0.6 and confirmed as working. Thank you for the quick response.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...