Skip to content

Commit

Permalink
Merge pull request #167 from DMTF/cert-file-operation-fix
Browse files Browse the repository at this point in the history
Fixed file handling for certificate installation
  • Loading branch information
mraineri authored Aug 9, 2024
2 parents b146df8 + b920e4e commit 378d30f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions redfish_utilities/certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,8 @@ def install_certificate(context, destination, cert_file, key_file=None):
"""

# Read the certificate and determine its type
with open(cert_file, "r"):
cert_string = cert_file.read()
with open(cert_file, "r") as file_handle:
cert_string = file_handle.read()
cert_type = "PEM"
if "BEGIN PKCS7" in cert_string:
cert_type = "PKCS7"
Expand All @@ -248,8 +248,8 @@ def install_certificate(context, destination, cert_file, key_file=None):

# Read the key if needed, and prepend it to the certificate
if key_file is not None:
with open(cert_file, "r"):
key_string = key_file.read()
with open(key_file, "r") as file_handle:
key_string = file_handle.read()
cert_string = key_string + cert_string

# Build the payload
Expand Down

0 comments on commit 378d30f

Please sign in to comment.