sfw: Optionally suppress insecure connection warnings
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/openbmc-sfw b/openbmc-sfw
index e184301..ec3be9f 100755
--- a/openbmc-sfw
+++ b/openbmc-sfw
@@ -6,9 +6,6 @@
import time
import json
-import urllib3
-urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
-
class BMC:
def __init__(self, server):
self.url = "https://{0}/".format(server)
@@ -198,6 +195,8 @@
parser = argparse.ArgumentParser()
parser.add_argument('--server', help='hostname or IP of BMC', type=str,
required=True)
+parser.add_argument('--suppress-insecure-warnings', '-I', action="store_true",
+ default=False)
subparsers = parser.add_subparsers()
list_events = subparsers.add_parser('list', help='List all software images on BMC')
@@ -247,6 +246,10 @@
args = parser.parse_args()
+if args.suppress_insecure_warnings:
+ import urllib3
+ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+
if 'func' in args:
args.func(args)
else: