java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
| 2
java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java
| 32 ++++++
java/code/src/com/redhat/rhn/frontend/action/kickstart/EditPackagesAction.java
| 33 ++++++-
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
| 14 ++
java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
| 9 +
java/code/webapp/WEB-INF/pages/kickstart/assignedpackages.jsp
| 47 +++++-----
java/code/webapp/WEB-INF/struts-config.xml
| 2
schema/spacewalk/common/tables/rhnKSData.sql
| 8 +
schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/052-rhnKSData-nobase.sql
| 25 +++++
9 files changed, 151 insertions(+), 21 deletions(-)
New commits:
commit dc7f5e71f0d96987a116749bc0f8e775cf390205
Author: Colin Coe <coec(a)war.coesta.com>
Date: Sat Aug 28 21:34:39 2010 +0800
529232 - add 'no base' and 'ignore missing' options to kickstart
A minimal @base installation installs around 370 packages, with nobase checked
around 150 packages are installed.
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
index 334d8cd..7eb69f2 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.hbm.xml
@@ -32,6 +32,8 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<property name="isOrgDefault" column="is_org_default"
not-null="true" type="yes_no" />
<property name="kernelParams" column="kernel_params"
type="string" length="128" />
<property name="nonChrootPost" column="nonchrootpost"
not-null="false" type="yes_no" />
+ <property name="noBase" column="no_base"
not-null="false" type="yes_no" />
+ <property name="ignoreMissing" column="ignore_missing"
not-null="false" type="yes_no" />
<property name="verboseUp2date" column="verboseup2date"
not-null="false" type="yes_no" />
<property name="partitionDataBinary" column="partition_data"
type="binary" />
<property name="cobblerId" column="cobbler_id"
type="string" length="64" />
diff --git a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java
b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java
index 06721d2..a5510da 100644
--- a/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java
+++ b/java/code/src/com/redhat/rhn/domain/kickstart/KickstartData.java
@@ -84,6 +84,8 @@ public class KickstartData {
private Set ips; // rhnKickstartIpRange
private Set<KickstartScript> scripts; // rhnKickstartScript
private KickstartDefaults kickstartDefaults;
+ private boolean noBase;
+ private boolean ignoreMissing;
private static final Pattern URL_REGEX =
Pattern.compile("--url\\s*(\\S+)", Pattern.CASE_INSENSITIVE);
@@ -120,6 +122,8 @@ public class KickstartData {
nonChrootPost = new Boolean(false);
childChannels = new HashSet();
kickstartType = TYPE_WIZARD;
+ noBase = new Boolean(false);
+ ignoreMissing = new Boolean(false);
}
/**
@@ -1411,6 +1415,34 @@ public class KickstartData {
}
/**
+ * @return Returns true if the base package group should be left off
+ */
+ public boolean getNoBase() {
+ return noBase;
+ }
+
+ /**
+ * @param noBaseIn the noBase to set
+ */
+ public void setNoBase(Boolean noBaseIn) {
+ this.noBase = noBaseIn;
+ }
+
+ /**
+ * @return Returns true if we should ignore missing packages
+ */
+ public boolean getIgnoreMissing() {
+ return ignoreMissing;
+ }
+
+ /**
+ * @param ignoreMissingIn the ignoreMissing to set
+ */
+ public void setIgnoreMissing(Boolean ignoreMissingIn) {
+ this.ignoreMissing = ignoreMissingIn;
+ }
+
+ /**
* Get the default virt bridge for this KickstartData object.
*
* @return String virt bridge (xenbr0, virbr0)
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/kickstart/EditPackagesAction.java
b/java/code/src/com/redhat/rhn/frontend/action/kickstart/EditPackagesAction.java
index b574384..e802c0f 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/EditPackagesAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/EditPackagesAction.java
@@ -44,6 +44,8 @@ import javax.servlet.http.HttpServletResponse;
public class EditPackagesAction extends RhnAction {
private static final String PACKAGE_LIST = "packageList";
+ private static final String NO_BASE = "noBase";
+ private static final String IGNORE_MISSING = "ignoreMissing";
/**
* {@inheritDoc}
@@ -128,28 +130,55 @@ public class EditPackagesAction extends RhnAction {
}
form.set(PACKAGE_LIST, buf.toString());
}
+
+ form.set(NO_BASE, ksdata.getNoBase());
+ form.set(IGNORE_MISSING, ksdata.getIgnoreMissing());
form.set("submitted", Boolean.TRUE);
}
private void transferEdits(KickstartData ksdata, DynaActionForm form,
RequestContext ctx) {
+ ksdata.setNoBase(Boolean.TRUE.equals(form.get(NO_BASE)));
+ ksdata.setIgnoreMissing(Boolean.TRUE.equals(form.get(IGNORE_MISSING)));
+
// first clear the kickstart packages set
ksdata.clearKsPackages();
Set ksPackages = ksdata.getKsPackages();
String newPackages = form.getString(PACKAGE_LIST);
if (newPackages != null && newPackages.length() > 0) {
+ Boolean first = new Boolean(true);
for (StringTokenizer strtok = new StringTokenizer(newPackages,
"\n");
strtok.hasMoreTokens();) {
- String pkg = strtok.nextToken();
+
+ // This is a hack but I can't think of a better way to do it
+ String pkg = null;
+ if (first && (!ksdata.getNoBase())) {
+ pkg = "@ Base";
+ PackageName pn = PackageFactory.lookupOrCreatePackageByName(pkg);
+ KickstartPackage kp = new KickstartPackage(ksdata, pn);
+ if (KickstartFactory.lookupKsPackageByKsDataAndPackageName(
+ ksdata, pn).isEmpty()) {
+ ksdata.addKsPackage(kp);
+ }
+ }
+ first = false;
+
+ pkg = strtok.nextToken();
pkg = pkg.trim();
if (pkg.length() == 0) {
continue;
}
+
+ // if noBase is checked and the current package is @base, ignore it
PackageName pn = PackageFactory.lookupOrCreatePackageByName(pkg);
- KickstartPackage kp = new KickstartPackage(ksdata, pn);
+ if ((pn.getName().toLowerCase().replaceAll("\\s",
"")
+ .equals("@base")) && (ksdata.getNoBase())) {
+ continue;
+ }
+ KickstartPackage kp = new KickstartPackage(ksdata, pn);
if (KickstartFactory.lookupKsPackageByKsDataAndPackageName(
ksdata, pn).isEmpty()) {
ksdata.addKsPackage(kp);
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 3df47f0..9403f52 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -11470,6 +11470,20 @@ the <strong>Red Hat Enterprise Linux System
Administration Guide.</stro
<context
context-type="sourcefile">/rhn/kickstart/KickstartPackagesEdit.do</context>
</context-group>
</trans-unit>
+
+ <trans-unit id="kickstart.edit.pkgs.jsp.nobase">
+ <source>Don't install @Base package group</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/kickstart/KickstartPackagesEdit.do</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="kickstart.edit.pkgs.jsp.ignoremissing">
+ <source>Ignore missing packages</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/kickstart/KickstartPackagesEdit.do</context>
+ </context-group>
+ </trans-unit>
<!-- Cobbler Snippet Entries -->
<group>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
index 01ff3f5..d1abb72 100644
--- a/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
+++ b/java/code/src/com/redhat/rhn/manager/kickstart/KickstartFormatter.java
@@ -69,6 +69,8 @@ public class KickstartFormatter {
private static final String NEWLINE = "\n";
private static final String SPACE = " ";
private static final String DEPS = "--resolvedeps";
+ private static final String NO_BASE = "--nobase";
+ private static final String IGNORE_MISSING = "--ignoremissing";
private static final String PACKAGES = "%packages";
private static final String INTERPRETER_OPT = "--interpreter";
private static final String NOCHROOT = "--nochroot";
@@ -403,6 +405,13 @@ public class KickstartFormatter {
private String getPackageOptions() {
// if kstree is > 2.1 then add the resolve deps, ignore other deps
String opts = this.ksdata.isRhel2() || this.ksdata.isRhel5OrGreater() ?
"" : DEPS;
+
+ if (this.ksdata.getIgnoreMissing()) {
+ opts = opts + SPACE + IGNORE_MISSING;
+ }
+ if (this.ksdata.getNoBase()) {
+ opts = opts + SPACE + NO_BASE;
+ }
return PACKAGES + SPACE + opts + NEWLINE;
}
diff --git a/java/code/webapp/WEB-INF/pages/kickstart/assignedpackages.jsp
b/java/code/webapp/WEB-INF/pages/kickstart/assignedpackages.jsp
index 4d7fadf..2521379 100644
--- a/java/code/webapp/WEB-INF/pages/kickstart/assignedpackages.jsp
+++ b/java/code/webapp/WEB-INF/pages/kickstart/assignedpackages.jsp
@@ -23,27 +23,36 @@
<html:form method="post"
action="/kickstart/KickstartPackagesEdit.do">
<html:hidden property="ksid" />
<html:hidden property="submitted" />
+ <table width="80%" class="details">
+ <tr>
+ <th><bean:message key="kickstart.edit.pkgs.jsp.nobase"
/>:</th>
+ <td><html:checkbox property="noBase" /></td>
+ </tr>
+ <tr>
+ <th width="40%"><bean:message
key="kickstart.edit.pkgs.jsp.ignoremissing" />:</th>
+ <td><html:checkbox property="ignoreMissing" /></td>
+ </tr>
+ </table>
<table width="80%">
- <tr>
- <td>
- <table width="100%">
- <tr>
- <td align="right">
- <html:textarea style="text-align: left"
property="packageList" rows="10" cols="80"
tabindex="0" />
- </td>
- </tr>
- <tr>
- <td align="right">
- <input type="submit" value="<bean:message
key="kickstart.edit.pkgs.submit.jsp.label" />" />
- </td>
- </tr>
- </table>
- </td>
- <td> </td>
- </tr>
- </table>
+ <tr>
+ <td>
+ <table width="100%">
+ <tr>
+ <td align="right">
+ <html:textarea style="text-align: left"
property="packageList" rows="10" cols="80"
tabindex="0" />
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <input type="submit" value="<bean:message
key="kickstart.edit.pkgs.submit.jsp.label" />" />
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td> </td>
+ </tr>
+ </table>
</html:form>
</div>
</body>
</html:html>
-
diff --git a/java/code/webapp/WEB-INF/struts-config.xml
b/java/code/webapp/WEB-INF/struts-config.xml
index eb2acd6..674b833 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -676,6 +676,8 @@
type="org.apache.struts.action.DynaActionForm">
<form-property name="ksid" type="java.lang.Long"
/>
<form-property name="packageList"
type="java.lang.String" />
+ <form-property name="noBase" type="java.lang.Boolean"
/>
+ <form-property name="ignoreMissing"
type="java.lang.Boolean" />
<form-property name="submitted"
type="java.lang.Boolean" />
</form-bean>
diff --git a/schema/spacewalk/common/tables/rhnKSData.sql
b/schema/spacewalk/common/tables/rhnKSData.sql
index b638b5a..d228baa 100644
--- a/schema/spacewalk/common/tables/rhnKSData.sql
+++ b/schema/spacewalk/common/tables/rhnKSData.sql
@@ -61,6 +61,14 @@ CREATE TABLE rhnKSData
DEFAULT ('N') NOT NULL
CONSTRAINT rhn_ks_nonchroot_post_ck
CHECK (nonchrootpost in ( 'Y' , 'N' )),
+ no_base CHAR(1)
+ DEFAULT ('N') NOT NULL
+ CONSTRAINT rhn_ks_nobase_ck
+ CHECK (no_base in ( 'Y' , 'N' )),
+ ignore_missing CHAR(1)
+ DEFAULT ('N') NOT NULL
+ CONSTRAINT rhn_ks_ignore_missing_ck
+ CHECK (ignore_missing in ( 'Y' , 'N' )),
created DATE
DEFAULT (sysdate) NOT NULL,
modified DATE
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/052-rhnKSData-nobase.sql
b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/052-rhnKSData-nobase.sql
new file mode 100644
index 0000000..f822104
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/052-rhnKSData-nobase.sql
@@ -0,0 +1,25 @@
+--
+-- Copyright (c) 2010 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+--
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+
+alter table rhnKsData add (
+ no_base CHAR(1)
+ DEFAULT ('N') NOT NULL
+ CONSTRAINT rhn_ks_nobase_ck
+ CHECK (no_base in ( 'Y' , 'N' )),
+ ignore_missing CHAR(1)
+ DEFAULT ('N') NOT NULL
+ CONSTRAINT rhn_ks_ignore_missing_ck
+ CHECK (ignore_missing in ( 'Y' , 'N' ))
+);