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
Communicator

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
Communicator

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

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...