def validate_cert(namespace):
params = [namespace.cert_data, namespace.cert_password]
if all([not x for x in params]):
# no cert supplied -- use HTTP
if not namespace.frontend_port:
namespace.frontend_port = 80
else:
# cert supplied -- use HTTPS
if not all(params):
raise argparse.ArgumentError(
None, 'To use SSL certificate, you must specify both the filename and password')
# extract the certificate data from the provided file
namespace.cert_data = read_base_64_file(namespace.cert_data)
try:
# change default to frontend port 443 for https
if not namespace.frontend_port:
namespace.frontend_port = 443
except AttributeError:
# app-gateway ssl-cert create does not have these fields and that is okay
pass
评论列表
文章目录