From 65f11f1ad1c642e7dc7e1a800d641918bcec04e1 Mon Sep 17 00:00:00 2001
From: Peter Hormanns <peter.hormanns@hostsharing.net>
Date: Thu, 28 Jul 2011 19:45:17 +0200
Subject: [PATCH] delete pac

---
 hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
index 16a3be8..456f22e 100644
--- a/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
+++ b/hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -44,7 +44,7 @@
 		UnixUser unixUser = getPacAdminUser(pac);
 		String password = PwGenerator.generatePassword(7, flagBuilder.build(), 100, random);
 		Map<String, String> hiveValues = fillHiveValues(hive);
-		List<Map<String, String>> pacValuesList = fillPacValuesList(hive);
+		List<Map<String, String>> pacValuesList = fillPacValuesList(hive, null);
 		Map<String, String> emailVars = fillEMailValues(pacName, customerEMail, password);
 		Processor priProcessor = new CompoundProcessor(
 				createAddUserProc(pacName, unixUser, password), 
@@ -70,7 +70,7 @@
 		Pac pac = (Pac) entity;
 		Hive hive = pac.getHive();
 		Map<String, String> hiveValues = fillHiveValues(hive);
-		List<Map<String, String>> pacValuesList = fillPacValuesList(hive);
+		List<Map<String, String>> pacValuesList = fillPacValuesList(hive, pac);
 		WaitingTasksProcessor waitingProcessor = new WaitingTasksProcessor(new CompoundProcessor(
 				createEtcHostsProc(hiveValues, pacValuesList), 
 				createNetworkInterfacesProc(hiveValues, pacValuesList), 
@@ -163,14 +163,16 @@
 		return hiveValues;
 	}
 
-	private List<Map<String, String>> fillPacValuesList(Hive hive) {
+	private List<Map<String, String>> fillPacValuesList(Hive hive, Pac pac) {
 		List<Map<String, String>> pacValuesList = new ArrayList<Map<String, String>>();
 		Set<Pac> pacsSet = hive.getPacs();
 		for (Pac p : pacsSet) {
 			HashMap<String, String> pacValues = new HashMap<String, String>();
 			pacValues.put("PAC", p.getName());
 			pacValues.put("PAC_IP", p.getCurINetAddr().getInetAddr());
-			pacValuesList.add(pacValues);
+			if (pac == null || pac.getId() != p.getId()) {
+				pacValuesList.add(pacValues);
+			}
 		}
 		return pacValuesList;
 	}

--
Gitblit v1.9.3