Splunk Dev

Retrieving wrong credentials in Python script after using Setup screen

ralphmct
Path Finder

Hi,

I've followed the example in the documentation for creating a setup screen. My setup.xml is basic: saving username, password and realm. If I go to the admin/passwords/ endpoint and the app.conf I can see the username and password saved but the following lines in my Python script just get the first set of credentials alphabetically as opposed to the newest:

# return first set of credentials
for i, c in entities.items():
    return c['username'], c['clear_password'], c['realm']

How do I go about retrieving the newest credentials? I want to be able to return to the setup screen, update my details and have my script use those instead of the previous ones. Perhaps an easier way might be to add the credentials with the setup screen in order of date if that's possible?

Thanks

0 Karma
1 Solution

ralphmct
Path Finder

For anyone who comes to this with the same problem. I didn't figure out how to change the order on the REST API but I did manage a workaround. The configuration files hold the sequential order, so I read through the local conf files, got to the most recent credentials entry and matched it with the REST API version to get the unencrypted credentials.

View solution in original post

ralphmct
Path Finder

For anyone who comes to this with the same problem. I didn't figure out how to change the order on the REST API but I did manage a workaround. The configuration files hold the sequential order, so I read through the local conf files, got to the most recent credentials entry and matched it with the REST API version to get the unencrypted credentials.

ralphmct
Path Finder

After looking at this further I think it may be more wise to create a defined entity using setup.xml and only have one entity that gets overwritten, rather than using "_new" to create a new object each time but I'm not sure how this is done.

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 ...