public void deleteEnvironment(Environment environment) throws IOException {
  String id=environment.getId();
  Environment local=existingEnvironments.remove(id);
  if (null != local) {
    Files.deleteIfExists(pathResolver.getEnvironmentFilePath(local));
    AgentMappings agentMappings=agentMappingsReference.get();
    if (checkEnvironments(agentMappings)) {
      try {
        saveAgentMappings(agentMappings,false);
      }
 catch (      Exception e) {
        log.error("Update of the agent mappings on the environment deletion failed.",e);
      }
    }
  }
}

public void deleteEnvironment ( Environment environment ) throws IOException { String id = environment . getId ( ) ; Environment local = existingEnvironments . remove ( id ) ; if ( null != local ) { Files . deleteIfExists ( pathResolver . getEnvironmentFilePath ( local ) ) ; AgentMappings agentMappings = agentMappingsReference . get ( ) ; if ( checkEnvironments ( agentMappings ) ) { try { saveAgentMappings ( agentMappings , false ) ; } catch ( Exception e ) { log . error ( "Update of the agent mappings on the environment deletion failed." , e ) ; } } } }
deletes the existing environment .
