Hello all,
I am trying to upload some certs with the SOAP API and some python code and I don’t quite understand the result.
My code seems good (to me at least
), there’s no exception raised, but my certificate is not uploaded / installed…
Here’s the code :
import getpass
import pycontrol.pycontrol as pc
import time
cert = """PEM
CERT
HERE"""
hosts = [('HERE GOES THE IP','THE PARTITION')]
uname = 'your user name'
upass = getpass.getpass("Password : ")
def upload_files(name, pem_cert):
For each host in hosts
for elem in hosts:
host = elem[0]
part = elem[1]
print host
b = pc.BIGIP(
hostname = host,
username = uname,
password = upass,
fromurl = True,
wsdls = ['Management.KeyCertificate','Management.Partition']
)
v = b.Management.KeyCertificate
p = b.Management.Partition
p.set_active_partition(part)
mode = v.typefactory.create("Management.KeyCertificate.ManagementModeType")
print len(v.get_certificate_list(mode.MANAGEMENT_MODE_DEFAULT))
Upload
v.certificate_import_from_pem(mode=mode.MANAGEMENT_MODE_DEFAULT, cert_ids=name, pem_data=pem_cert, overwrite=False)
time.sleep(3)
Verification
print len(v.get_certificate_list(mode.MANAGEMENT_MODE_DEFAULT))
upload_files("Name of the cert (after upload)", cert)
I searched through others topics but…
So thank you in advance for your help and answers !