Forum Discussion
Trying to check cert validity - Bigsuds Python
I am trying to retrieve the validity of the certs stored in my LTM. Here is the relevant code. targetltm creates the connection to the LTM.
def get_cert_list(obj):
try:
certlist = obj.Management.KeyCertificate.get_certificate_list("MANAGEMENT_MODE_DEFAULT")
certname = []
for a in (certlist):
certname.append(a["certificate"]["cert_info"]["id"])
return certname
except Exception, e:
print e
try:
host = targetltm(target)
localcert = get_cert_list(host)
validity = host.Management.KeyCertificate.certificate_check_validity("MANAGEMENT_MODE_DEFAULT", localcert, 8000)When it gets to the last line I get "'int' object is not iterable". However localcert is iterable and when I print it I get a list of cert IDs. Clearly I'm not doing something right but I'm at a loss as to what.
Note: I'm fairly new to Python so there may be some obvious style issues as well with the code.
3 Replies
- Brian_Gibson_30
Nimbostratus
OK. I figured out my problem. I didn't realize that the watermarks were iterable as well. Seems kinda silly to me but that's the way the API is set up.
- Kevin_Davies_40
Nacreous
I have had same issues in python, try [localcert] or [get_cert_list(host)]
- arjunnambiartc_
Nimbostratus
just to understand..what is the use of the watermark attribute while checking the cert validity ?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com