openbmctool: certificates: do not use binary mode
When uploading certificate data, the json encoder will not implicitly
encode a bytestream as a json string, so don't open the file in binary
mode.
bf99c5864c enabled the simplejson module to make this work but this is a
simpler fix and we can drop an external dependency.
Change-Id: I7ddfcb2e42d8d8876775ad62e6ab3880ecc4ff5b
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/thalerj/openbmctool.py b/thalerj/openbmctool.py
index 4786f81..c2c8fe4 100755
--- a/thalerj/openbmctool.py
+++ b/thalerj/openbmctool.py
@@ -3050,7 +3050,7 @@
"""
httpHeader = {'Content-Type': 'application/octet-stream'}
httpHeader.update(xAuthHeader)
- data = open(args.fileloc, 'rb').read()
+ data = open(args.fileloc, 'r').read()
try:
if redfishSupportPresent(host, session):
if(args.type.lower() == 'server' and args.service.lower() != "https"):
@@ -3129,7 +3129,7 @@
replace sub command
@param session: the active session to use
"""
- cert = open(args.fileloc, 'rb').read()
+ cert = open(args.fileloc, 'r').read()
try:
if redfishSupportPresent(host, session):
httpHeader = {'Content-Type': 'application/json'}