From 416a85516d9f45efd1a1247154efa14e26a492c1 Mon Sep 17 00:00:00 2001
From: Marek Czernek <marek.czernek@suse.com>
Date: Wed, 5 Mar 2025 10:08:50 +0100
Subject: [PATCH] Reduce num of Cobbler Sync (bsc#1233371)

---
 .../manager/kickstart/cobbler/CobblerDistroCreateCommand.java  | 3 +--
 .../manager/kickstart/cobbler/CobblerDistroDeleteCommand.java  | 3 +--
 .../manager/kickstart/cobbler/CobblerProfileDeleteCommand.java | 3 +--
 .../manager/kickstart/cobbler/CobblerSystemRemoveCommand.java  | 2 --
 java/spacewalk-java.changes.mczernek.cobbler-sync-actions      | 1 +
 5 files changed, 4 insertions(+), 8 deletions(-)
 create mode 100644 java/spacewalk-java.changes.mczernek.cobbler-sync-actions

diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroCreateCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroCreateCommand.java
index f275ecece12b..445cb8dd3f1e 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroCreateCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroCreateCommand.java
@@ -22,7 +22,6 @@
 import com.redhat.rhn.domain.kickstart.KickstartFactory;
 import com.redhat.rhn.domain.kickstart.KickstartableTree;
 import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.manager.satellite.CobblerSyncCommand;
 
 import java.util.List;
 
@@ -87,7 +86,7 @@ public ValidatorError store() {
                 createProfile(profile);
             }
         }
-        return new CobblerSyncCommand(user).store();
+        return null;
     }
 
     private void createProfile(KickstartData profile) {
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroDeleteCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroDeleteCommand.java
index e44cff64089d..e0220b6af854 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroDeleteCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerDistroDeleteCommand.java
@@ -17,7 +17,6 @@
 import com.redhat.rhn.common.validator.ValidatorError;
 import com.redhat.rhn.domain.kickstart.KickstartableTree;
 import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.manager.satellite.CobblerSyncCommand;
 
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
@@ -79,7 +78,7 @@ public ValidatorError store() {
             }
         }
 
-        return new CobblerSyncCommand(user).store();
+        return null;
 
     }
 
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileDeleteCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileDeleteCommand.java
index 4214d4cf1087..eab99077c442 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileDeleteCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerProfileDeleteCommand.java
@@ -17,7 +17,6 @@
 import com.redhat.rhn.common.validator.ValidatorError;
 import com.redhat.rhn.domain.kickstart.KickstartData;
 import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.manager.satellite.CobblerSyncCommand;
 
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -56,7 +55,7 @@ public ValidatorError store() {
         if (!profile.remove()) {
             return new ValidatorError("cobbler.profile.remove_failed");
         }
-        return new CobblerSyncCommand(user).store();
+        return null;
 
     }
 
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemRemoveCommand.java b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemRemoveCommand.java
index a84801fbe84c..ef9f92ff81b7 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemRemoveCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/cobbler/CobblerSystemRemoveCommand.java
@@ -17,7 +17,6 @@
 import com.redhat.rhn.common.validator.ValidatorError;
 import com.redhat.rhn.domain.server.Server;
 import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.manager.satellite.CobblerSyncCommand;
 
 import org.cobbler.SystemRecord;
 
@@ -47,7 +46,6 @@ public ValidatorError store() {
         SystemRecord sr = lookupExisting(server);
         if (sr != null) {
             sr.remove();
-            return new CobblerSyncCommand(user).store();
         }
         return null;
     }

