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!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...