Skip to content

Commit

Permalink
Add info URL to autoinstallation to cleanup the cobbler profile once …
Browse files Browse the repository at this point in the history
…done (#9116)
  • Loading branch information
cbosdo authored Jul 29, 2024
1 parent fb1ad7d commit 1628cac
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ private Map<String, Object> virtDomainActionToPillar(VirtualizationCreateGuestAc
// Prepare the salt FS with kernel / initrd and pass params to kernel
String cobblerSystemName = action.getDetails().getCobblerSystem();
Map<String, String> bootParams = cobblerSystemName != null ?
prepareCobblerBoot(action.getDetails().getKickstartHost(), cobblerSystemName) :
prepareCobblerBoot(action.getDetails().getKickstartHost(), cobblerSystemName, false) :
null;

// Some of these pillar data will be useless for update-vm, but they will just be ignored.
Expand Down Expand Up @@ -1956,7 +1956,8 @@ private Map<LocalCall<?>, List<MinionSummary>> virtCreateAction(List<MinionSumma
}

private Map<String, String> prepareCobblerBoot(String kickstartHost,
String cobblerSystem) {
String cobblerSystem,
boolean autoinstall) {
CobblerConnection con = CobblerXMLRPCHelper.getAutomatedConnection();
SystemRecord system = SystemRecord.lookupByName(con, cobblerSystem);
Profile profile = system.getProfile();
Expand All @@ -1970,7 +1971,9 @@ private Map<String, String> prepareCobblerBoot(String kickstartHost,
KickstartableTree tree = KickstartFactory.lookupKickstartTreeByLabel(nameParts.get(0),
OrgFactory.lookupById(Long.valueOf(nameParts.get(1))));
tree.createOrUpdateSaltFS();
String kOpts = buildKernelOptions(system, kickstartHost);
String kOpts = buildKernelOptions(system, kickstartHost, autoinstall);


Map<String, String> pillar = new HashMap<>();
pillar.put("kernel", saltFSKernel);
pillar.put("initrd", saltFSInitrd);
Expand All @@ -1986,7 +1989,7 @@ private Map<LocalCall<?>, List<MinionSummary>> autoinstallInitAction(List<Minion
KickstartActionDetails ksActionDetails = autoInitAction.getKickstartActionDetails();
String cobblerSystem = ksActionDetails.getCobblerSystemName();
String host = ksActionDetails.getKickstartHost();
Map<String, String> bootParams = prepareCobblerBoot(host, cobblerSystem);
Map<String, String> bootParams = prepareCobblerBoot(host, cobblerSystem, true);
Map<String, Object> pillar = new HashMap<>(bootParams);
pillar.put("uyuni-reinstall-name", "reinstall-system");
String kOpts = bootParams.get("kopts");
Expand All @@ -2008,7 +2011,7 @@ private Map<LocalCall<?>, List<MinionSummary>> virtPoolRefreshAction(
);
}

private String buildKernelOptions(SystemRecord sys, String host) {
private String buildKernelOptions(SystemRecord sys, String host, boolean autoinstall) {
String breed = sys.getProfile().getDistro().getBreed();
Map<String, Object> kopts = sys.getResolvedKernelOptions();
if (LOG.isDebugEnabled()) {
Expand Down Expand Up @@ -2043,6 +2046,11 @@ else if (breed.equals("suse")) {
else if (breed.equals("debian") || breed.equals("ubuntu")) {
kernelOptions += "auto-install/enable=true priority=critical netcfg/choose_interface=auto url=" + autoinst;
}

if (autoinstall) {
String infoUrl = "http://" + host + "/cblr/svc/op/nopxe/system/" + sys.getName();
kernelOptions += " info=" + infoUrl;
}
return kernelOptions;
}

Expand Down
2 changes: 2 additions & 0 deletions java/spacewalk-java.changes.cbosdo.ks-cancel
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add info URL for cobbler to clean the system profile
(bsc#1219645)

0 comments on commit 1628cac

Please sign in to comment.