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!

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...