def test_create_environment_file(self): json_file_path = "env.json" mock_open = mock.mock_open() with mock.patch('six.moves.builtins.open', mock_open): with mock.patch('json.dumps', return_value="JSON"): utils.create_environment_file(path=json_file_path) mock_open.assert_called_with('env.json', 'w+') mock_open().write.assert_called_with('JSON')
def _deploy_tripleo_heat_templates(self, stack, parsed_args): """Deploy the fixed templates in TripleO Heat Templates""" clients = self.app.client_manager network_client = clients.network parameters = self._update_paramaters( parsed_args, network_client, stack) tht_root = parsed_args.templates print("Deploying templates in the directory {0}".format( os.path.abspath(tht_root))) self.log.debug("Creating Environment file") env_path = utils.create_environment_file() if stack is None: self.log.debug("Creating Keystone certificates") keystone_pki.generate_certs_into_json(env_path, False) resource_registry_path = os.path.join(tht_root, RESOURCE_REGISTRY_NAME) environments = [resource_registry_path, env_path] if parsed_args.rhel_reg: reg_env = self._create_registration_env(parsed_args) environments.extend(reg_env) if parsed_args.environment_files: environments.extend(parsed_args.environment_files) overcloud_yaml = os.path.join(tht_root, OVERCLOUD_YAML_NAME) self._heat_deploy(stack, overcloud_yaml, parameters, environments, parsed_args.timeout)
def _deploy_tripleo_heat_templates(self, stack, parsed_args): """Deploy the fixed templates in TripleO Heat Templates""" clients = self.app.client_manager network_client = clients.network parameters = self._update_paramaters(parsed_args, network_client, stack) tht_root = parsed_args.templates print("Deploying templates in the directory {0}".format( os.path.abspath(tht_root))) self.log.debug("Creating Environment file") env_path = utils.create_environment_file() if stack is None: self.log.debug("Creating Keystone certificates") keystone_pki.generate_certs_into_json(env_path, False) resource_registry_path = os.path.join(tht_root, RESOURCE_REGISTRY_NAME) environments = [resource_registry_path, env_path] if parsed_args.rhel_reg: reg_env = self._create_registration_env(parsed_args) environments.extend(reg_env) if parsed_args.environment_files: environments.extend(parsed_args.environment_files) overcloud_yaml = os.path.join(tht_root, OVERCLOUD_YAML_NAME) self._heat_deploy(stack, overcloud_yaml, parameters, environments, parsed_args.timeout)