Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Commit

Permalink
MGMT-1818 Customize HTTP behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
empovit committed Aug 13, 2020
1 parent b7c1107 commit bd3b0c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions render_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ def upload_to_aws(s3_client, local_file, bucket, s3_file):
return False


def update_bmh_files(ignition_file, cluster_id, inventory_endpoint, token):
def update_bmh_files(ignition_file, cluster_id, inventory_endpoint, token,
skip_cert_verification=False, ca_cert_path=None):
try:
if inventory_endpoint:
hosts_list = utils.get_inventory_hosts(inventory_endpoint, cluster_id, token)
hosts_list = utils.get_inventory_hosts(inventory_endpoint, cluster_id, token,
skip_cert_verification, ca_cert_path)
else:
logging.info("Using test data to get hosts list")
hosts_list = test_utils.get_test_list_hosts(cluster_id)
Expand Down Expand Up @@ -177,6 +179,8 @@ def main():
aws_access_key_id = os.environ.get("aws_access_key_id", "accessKey1")
aws_secret_access_key = os.environ.get("aws_secret_access_key", "verySecretKey1")
# openshift_release_image = os.environ.get("OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE")
skip_cert_verification = os.environ.get('SKIP_CERT_VERIFICATION', False)
ca_cert_path = os.environ.get('CA_CERT_PATH')

if not work_dir:
raise Exception("working directory was not defined")
Expand All @@ -196,7 +200,8 @@ def main():
# create_services_config(work_dir, config_dir, openshift_release_image)

# update BMH configuration in boostrap ignition
update_bmh_files("%s/bootstrap.ign" % config_dir, cluster_id, inventory_endpoint, openshift_token(config_dir))
update_bmh_files("%s/bootstrap.ign" % config_dir, cluster_id, inventory_endpoint, openshift_token(config_dir),
skip_cert_verification, ca_cert_path)

if s3_endpoint_url:
upload_to_s3(s3_endpoint_url, bucket, aws_access_key_id, aws_secret_access_key, config_dir, cluster_id)
Expand Down
4 changes: 3 additions & 1 deletion utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ def _get_network_interface_ip(self, interface):
return " "


def get_inventory_hosts(inventory_endpoint, cluster_id, token):
def get_inventory_hosts(inventory_endpoint, cluster_id, token, skip_cert_verification=False, ca_cert_path=None):
configs = Configuration()
configs.host = inventory_endpoint
configs.api_key["X-Secret-Key"] = token
configs.verify_ssl = not skip_cert_verification
configs.ssl_ca_cert = ca_cert_path
apiClient = ApiClient(configuration=configs)
client = api.InstallerApi(api_client=apiClient)
hosts_list = client.list_hosts(cluster_id=cluster_id)
Expand Down

0 comments on commit bd3b0c8

Please sign in to comment.