diff --git a/sushy_tools/emulator/main.py b/sushy_tools/emulator/main.py index e05890c8..cd2b58ea 100755 --- a/sushy_tools/emulator/main.py +++ b/sushy_tools/emulator/main.py @@ -178,7 +178,11 @@ def system_reset_action(identity): def parse_args(): parser = argparse.ArgumentParser('sushy-emulator') - parser.add_argument('--port', + parser.add_argument('-i', '--interface', + type=str, + default='', + help='Local interface to listen at') + parser.add_argument('-p', '--port', type=int, default=8000, help='The port to bind the server to') @@ -232,7 +236,7 @@ def main(): ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) ssl_context.load_cert_chain(args.ssl_certificate, args.ssl_key) - app.run(port=args.port, ssl_context=ssl_context) + app.run(host=args.interface, port=args.port, ssl_context=ssl_context) return 0 diff --git a/sushy_tools/static/main.py b/sushy_tools/static/main.py index c06a70f7..c6a33bd2 100755 --- a/sushy_tools/static/main.py +++ b/sushy_tools/static/main.py @@ -72,6 +72,10 @@ class RequestHandler(http_server.BaseHTTPRequestHandler): def parse_args(): parser = argparse.ArgumentParser('sushy-static') + parser.add_argument('-i', '--interface', + type=str, + default='', + help='Local interface to listen at') parser.add_argument('-p', '--port', type=int, default=8000, @@ -99,7 +103,8 @@ def main(): return 1 REDFISH_MOCKUP_FILES = os.path.realpath(args.mockup_files) - httpd = http_server.HTTPServer(('', args.port), RequestHandler) + httpd = http_server.HTTPServer((args.interface, args.port), + RequestHandler) if args.ssl_certificate and args.ssl_key: httpd.socket = ssl.wrap_socket(