sysinv: avoid exception when checking for certificate file presence
The "certificate_file" attribute is optional but the API controller for certificates assumes that it is present and uses it to check the validity of the absolute path expected. This leads to an exception when installing a certificate from a remote location without specifying a local absolute path. As per the comments in the bug report this is only a partial fix. The "certificate_file" attribute should be deprecated and the ability to check and delete the file when done should be moved into the client and not be included as part of the tasks done by the API (server-side). Change-Id: I9ed5082c4118014b11062539410bacea9a28577d Partial-Bug: #1827208 Signed-off-by: Allain Legacy <allain.legacy@windriver.com>
This commit is contained in:
@@ -279,7 +279,7 @@ class CertificateController(rest.RestController):
|
||||
|
||||
certificate_file = pecan.request.POST.get('certificate_file')
|
||||
# Ensure that the certificate_file is a valid file path
|
||||
if os.path.isabs(certificate_file):
|
||||
if certificate_file and os.path.isabs(certificate_file):
|
||||
if not os.path.isfile(certificate_file):
|
||||
msg = "'certificate_file' is not a valid file path"
|
||||
LOG.info(msg)
|
||||
|
Reference in New Issue
Block a user