# The passphrase to unlock the key - VERY SECRET!!! data["pass_phrase"] = sys.argv[2] # Make sure that this is the correct password... privkey = PrivateKey.read(sys.argv[1], sys.argv[2]) # The region for this tenancy data["region"] = "eu-frankfurt-1" secret_config["LOGIN"] = data ## Now create the bucket info so we know where the bucket is ## that will store all data related to logging into accounts data = {} data[ "compartment"] = "ocid1.compartment.oc1..aaaaaaaat33j7w74mdyjenwoinyeawztxe7ri6qkfbm5oihqb5zteamvbpzq" data["bucket"] = "acquire_compute" secret_config["BUCKET"] = data secret_config["PASSWORD"] = sys.argv[2] config_data = bytes_to_string( config_key.encrypt(json.dumps(secret_config).encode("utf-8"))) secret_key = json.dumps(config_key.to_data(sys.argv[3])) os.system("fn config app compute SECRET_CONFIG '%s'" % config_data) os.system("fn config app compute SECRET_KEY '%s'" % secret_key)
config["credentials"]["key"] = key config["credentials"]["fingerprint"] = fingerprint print("\n****\nPlease make sure you upload %s to OCI\n****\n" % pubkey) unique_salt = str(fingerprint) else: raise TypeError("Cannot recognise the type of service that " "is being configured. This should be either " "gcp or oci") # now save the configuration to disk d = {} d["key"] = service_key.to_data(passphrase=password) d["salt"] = service_salt d["config"] = bytes_to_string(service_key.encrypt(json.dumps(config))) with open(service_file, "w") as FILE: FILE.write(json.dumps(d)) # package all of the config data into a dictionary data = {} login = {} login["service_type"] = service_type login["bucket"] = bucket if provider == "gcp": login["credentials"] = key login["project"] = project login["unique_suffix"] = unique_suffix