Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri

Will_Gleich
Nimbostratus
Nimbostratus

I am working on automating SSL creation workflows with the python f5-sdk / iControl. I had the following set of code that was working last week, and as far as I know nothing changed since I'm the only one working on the big-ip. I've scoured the logs and support.f5.com but I can't find any further information about the error presented.

 

I am using the f5-sdk with the following code:

##This section of code works

mr.shared.file_transfer.uploads.upload_stringio(io.StringIO(request_obj['pkey']), '{0}.key'.format(domain))

mr.shared.file_transfer.uploads.upload_stringio(io.StringIO(request_obj['cert']), '{0}.crt'.format(domain))

 

I can then login to the Big-IP and `run /util bash`

>cd /var/config/rest/downloads

>ls

domain.example.com.crt domain.example.com.key tmp

 

However when I get to creating the certificate:

mr.tm.sys.file.ssl_certs.ssl_cert.create(name = "domain.example.com.crt", sourcePath="file:/var/config/rest/downloads/domain.example.com.crt")

 

This line in particular - I am presented with the attached StackTrace.

---------------------------------------------------------------------------

iControlUnexpectedHTTPError        Traceback (most recent call last)

<ipython-input-39-a8ff9ebc3cca> in <module>

----> 1 mr.tm.sys.file.ssl_certs.ssl_cert.create(name = "domain.example.com.crt", sourcePath="/var/config/rest/downloads/domain.example.com.crt")

 

~/pyenvs/py37/lib/python3.7/site-packages/f5/bigip/resource.py in create(self, **kwargs)

  1051         and state on the BIG-IP®.

  1052     """

-> 1053     return self._create(**kwargs)

  1054 

  1055   def _check_load_parameters(self, **kwargs):

 

~/pyenvs/py37/lib/python3.7/site-packages/f5/bigip/resource.py in _create(self, **kwargs)

  1013 

  1014     # Invoke the REST operation on the device.

-> 1015     response = session.post(_create_uri, json=kwargs, **requests_params)

  1016 

  1017     # Make new instance of self

 

~/pyenvs/py37/lib/python3.7/site-packages/icontrol/session.py in wrapper(self, RIC_base_uri, **kwargs)

  293               response.url,

  294               response.text)

--> 295       raise iControlUnexpectedHTTPError(error_message, response=response)

  296     return response

  297   return wrapper

 

iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri: https://10.71.46.65:443/mgmt/tm/sys/file/ssl-cert/

Text: '{"code":400,"message":"Failed! exit_code (3).\\n","errorStack":[],"apiError":26214401}'

------------------------------------

 

All of this code worked last week without issue. Any idea how to begin troubleshooting this error?

4 REPLIES 4

Hi Will,

 

Is there a previously installed certificate with name <domain.example.com.crt>?

I think, if you using same name, you may encounter this error.

Unfortunately, I am getting this error even when creating new certificates. However using the same file with tmsh I can run the command and it works:

 

create sys file ssl-key /Common/domain.example.com.key { source-path file:/var/config/rest/downloads/domain.example.com.key }

 

I wonder if I can clear the icrd cache.

I tried restarting the whole big-ip, to no avail.

Hey  , I am also facing the same issue. Can you share how were you able to solve the issue?

Will_Gleich
Nimbostratus
Nimbostratus

Thought I would come back and it appears that many of my iControl issues have disappeared since upgrading to 13.1.3.1 0.0.4