def encrypt_model_dictionary(self, model_dict): """ Encrypt the model dictionary (and referenced variables, if provided) using the specified passphrase. :param model_dict: the model dictionary :return: the number of model elements encrypted, and the number of variables encrypted :raises EncryptionException if an error occurs """ if model.get_model_domain_info_key() in model_dict: domain_info_dict = model_dict[model.get_model_domain_info_key()] self._encrypt_info_nodes(domain_info_dict) if model.get_model_topology_key() in model_dict: top_folder_names = self.alias_helper.get_model_topology_top_level_folder_names() topology_nodes = model_dict[model.get_model_topology_key()] location = LocationContext() self._encrypt_nodes(location, topology_nodes, top_folder_names) if model.get_model_resources_key() in model_dict: top_folder_names = self.alias_helper.get_model_resources_top_level_folder_names() resources_nodes = model_dict[model.get_model_resources_key()] location = LocationContext() self._encrypt_nodes(location, resources_nodes, top_folder_names) if model.get_model_deployments_key() in model_dict: top_folder_names = self.alias_helper.get_model_app_deployments_top_level_folder_names() deployments_nodes = model_dict[model.get_model_deployments_key()] location = LocationContext() self._encrypt_nodes(location, deployments_nodes, top_folder_names) return self.model_changes, self.variable_changes
def __init__(self): self._validation_result_dict = { '%s Section' % model.get_model_domain_info_key(): None, '%s Section' % model.get_model_topology_key(): None, '%s Section' % model.get_model_deployments_key(): None, '%s Section' % model.get_model_resources_key(): None }
def __init__(self): self._validation_result_dict = { '%s Section' % model.get_model_domain_info_key(): None, '%s Section' % model.get_model_topology_key(): None, '%s Section' % model.get_model_deployments_key(): None, '%s Section' % model.get_model_resources_key(): None, '%s Section' % model_constants.GLOBAL_VARIABLE_SUBSTITUTION: None }
def encrypt_model_dictionary(passphrase, model_dict, variables=None): """ Encrypt the model dictionary (and referenced variables, if provided) using the specified passphrase. :param passphrase: the passphrase used to encrypt/decrypt the passwords :param model_dict: the model dictionary :param variables: the variables property object :raises EncryptionException if an error occurs """ _initialize_password_field_names() model_changes = 0 variable_changes = 0 if model.get_model_domain_info_key() in model_dict: domain_info_dict = model_dict[model.get_model_domain_info_key()] _model_changes, _variable_changes = \ _search_and_replace_passwords(passphrase, model.get_model_domain_info_key(), domain_info_dict, variables) model_changes += _model_changes variable_changes += _variable_changes if model.get_model_topology_key() in model_dict: topology_dict = model_dict[model.get_model_topology_key()] _model_changes, _variable_changes = \ _search_and_replace_passwords(passphrase, model.get_model_topology_key(), topology_dict, variables) model_changes += _model_changes variable_changes += _variable_changes if model.get_model_resources_key() in model_dict: resources_dict = model_dict[model.get_model_resources_key()] _model_changes, _variable_changes = \ _search_and_replace_passwords(passphrase, model.get_model_resources_key(), resources_dict, variables) model_changes += _model_changes variable_changes += _variable_changes if model.get_model_deployments_key() in model_dict: deployments_dict = model_dict[model.get_model_deployments_key()] _model_changes, _variable_changes = \ _search_and_replace_passwords(passphrase, model.get_model_deployments_key(), deployments_dict, variables) model_changes += _model_changes variable_changes += _variable_changes return model_changes, variable_changes