in plugins/v1/repository_azure/plugin.py [0:0]
def configure_keystore(config_names, variables, **kwargs):
logger = logging.getLogger(LOGGER_NAME)
keystore_params = ["azure_account", "azure_key"]
client_name = variables.get("azure_client_name")
# skip keystore configuration entirely if any of the mandatory params is missing
if not (client_name and variables.get(keystore_params[0]) and variables.get(keystore_params[1])):
logger.warning("Skipping keystore configuration for repository-azure as mandatory plugin-params [%s,%s,%s] were not supplied",
"azure_client_name",
keystore_params[0],
keystore_params[1])
return False
keystore_binary_filename = "elasticsearch-keystore"
install_root = variables["install_root_path"]
keystore_binary = resolve_binary(install_root, keystore_binary_filename)
env = kwargs.get("env")
if not os.path.isfile(resolve_keystore_config(install_root)):
create_keystore(install_root, keystore_binary, env)
for property_name in keystore_params:
# the actual Elasticsearch secure settings for the azure plugin don't contain the azure_ prefix
es_property_name = property_name.replace("azure_", "")
property_value = variables.get(property_name)
# skip optional properties like session_token
if not property_value:
continue
add_property_to_keystore(keystore_binary, client_name, es_property_name, property_value, env)
# Success
return True