java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java | 45 +++++ java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 20 ++ java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf | 1 java/code/webapp/WEB-INF/pages/kickstart/ssm/schedule.jsp | 3 java/code/webapp/WEB-INF/pages/kickstart/wizard/schedule/fifth.jsp | 90 ++++++++++ java/code/webapp/WEB-INF/struts-config.xml | 3 java/spacewalk-java.spec | 5 rel-eng/packages/spacewalk-java | 2 8 files changed, 167 insertions(+), 2 deletions(-)
New commits: commit f614af41fac5e4b2941664b248b39c731bc43d4b Author: Stephen Herr sherr@redhat.com Date: Thu Mar 21 17:14:51 2013 -0400
Automatic commit of package [spacewalk-java] release [1.10.24-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec index f3e47ff..8dc6edd 100644 --- a/java/spacewalk-java.spec +++ b/java/spacewalk-java.spec @@ -28,7 +28,7 @@ Name: spacewalk-java Summary: Spacewalk Java site packages Group: Applications/Internet License: GPLv2 -Version: 1.10.23 +Version: 1.10.24 Release: 1%{?dist} URL: https://fedorahosted.org/spacewalk Source0: https://fedorahosted.org/releases/s/p/spacewalk/%%7Bname%7D-%%7Bversion%7D.t... @@ -677,6 +677,9 @@ fi %{jardir}/postgresql-jdbc.jar
%changelog +* Thu Mar 21 2013 Stephen Herr sherr@redhat.com 1.10.24-1 +- 924487 - Display warning if user might clobber their LUN with kickstart + * Thu Mar 21 2013 Milan Zazrivec mzazrivec@redhat.com 1.10.23-1 - abrt: software crash overview, grouped by uuid
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java index cd93036..1fe2e47 100644 --- a/rel-eng/packages/spacewalk-java +++ b/rel-eng/packages/spacewalk-java @@ -1 +1 @@ -1.10.23-1 java/ +1.10.24-1 java/
commit 47fc553c15b5f48da5ed3751d00566fb89a00547 Author: Stephen Herr sherr@redhat.com Date: Thu Mar 21 17:12:51 2013 -0400
924487 - Display warning if user might clobber their LUN with kickstart
diff --git a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java index 2f9579e..a0b4efc 100644 --- a/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java +++ b/java/code/src/com/redhat/rhn/frontend/action/kickstart/ScheduleKickstartWizardAction.java @@ -21,6 +21,7 @@ import com.redhat.rhn.common.localization.LocalizationService; import com.redhat.rhn.common.util.DatePicker; import com.redhat.rhn.common.validator.ValidatorError; import com.redhat.rhn.domain.action.ActionFactory; +import com.redhat.rhn.domain.kickstart.KickstartCommand; import com.redhat.rhn.domain.kickstart.KickstartData; import com.redhat.rhn.domain.kickstart.KickstartFactory; import com.redhat.rhn.domain.rhnpackage.profile.Profile; @@ -64,6 +65,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -121,6 +123,8 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction { public static final String CREATE_BOND_VALUE = "bonding"; public static final String STATIC_BOND_VALUE = "true"; public static final String DONT_CREATE_BOND_VALUE = "none"; + public static final String DESTROY_DISKS = "destroyDisks"; + public static final String NEXT_ACTION = "wizardStep"; /** * {@inheritDoc} */ @@ -147,6 +151,9 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction { else if (stepName.equals("fourth")) { wizStep.setPrevious("first"); } + else if (stepName.equals("fifth")) { + wizStep.setPrevious("first"); + } wizardSteps.put(stepName, wizStep); } } @@ -561,6 +568,10 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction { KickstartScheduleCommand cmd = getScheduleCommand(form, ctx, scheduleTime, helper.getKickstartHost());
+ if (showDiskWarning(cmd.getKsdata(), form)) { + form.set(NEXT_ACTION, "third"); + return mapping.findForward("fifth"); + } cmd.setNetworkDevice(form.getString(NETWORK_TYPE), form.getString(NETWORK_INTERFACE));
@@ -683,6 +694,11 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction { KickstartData data = KickstartFactory.lookupKickstartDataByCobblerIdAndOrg( user.getOrg(), profile.getUid());
+ if (showDiskWarning(data, form)) { + form.set(NEXT_ACTION, "fourth"); + return mapping.findForward("fifth"); + } + CobblerSystemCreateCommand cmd = new CobblerSystemCreateCommand(server, profile.getName(), data); cmd.store(); @@ -834,6 +850,35 @@ public class ScheduleKickstartWizardAction extends RhnWizardAction { return retval; }
+ /* + * If the user is going to clear all partitions from all drives we need to ask + * him if he's sure first. + */ + protected boolean showDiskWarning(KickstartData data, DynaActionForm form) { + Set<KickstartCommand> commands = data.getOptions(); + boolean containsClearpartCommand = false; + for (KickstartCommand command : commands) { + if (command.getCommandName() != null && + command.getCommandName().getName() != null && + command.getCommandName().getName().equals("clearpart")) { + if (command.getArguments() != null && + command.getArguments().contains("--drives")) { + return false; + } + containsClearpartCommand = true; + break; + } + continue; + } + + String diskOption = form.getString(DESTROY_DISKS); + if (!containsClearpartCommand || (diskOption != null && + diskOption.equals("true"))) { + return false; + } + return true; + } + private void checkForKickstart(DynaActionForm form, KickstartScheduleCommand cmd, RequestContext ctx) { if (ActionFactory.doesServerHaveKickstartScheduled((Long) form 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 9750937..94ecced 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 @@ -8163,6 +8163,26 @@ Please note that some manual configuration of these scripts may still be require </trans-unit> </group> <!-- Kickstart --> + <trans-unit id="kickstarts.jsp.diskwarning"> + <source><strong>Warning:</strong> The Kickstart Profile selected is set to destroy all + partitions on all disks, including logical disks on attached SANs. + If you do not want to loose data on one or + more disks you should remove the disk from the server before + kickstarting or edit the "clearpart" option for this Kickstart Profile.</source> + <context-group name="ctx"> + <context context-type="sourcefile">/rhn/kickstart/</context> + </context-group> + </trans-unit> + <trans-unit id="kickstarts.jsp.diskwarningssm"> + <source><strong>Warning:</strong> The Kickstart Profile(s) used may destroy all + partitions on all disks of the kickstarted machines, including logical disks on attached SANs. + If you do not want to loose data on one or more disks you should remove the disks from the + servers before kickstarting or ensure that the Kickstart Profile(s) used will not destroy the + partitions by editing the "clearpart" option.</source> + <context-group name="ctx"> + <context context-type="sourcefile">/rhn/systems/ssm/kickstart/</context> + </context-group> + </trans-unit> <trans-unit id="partitions"> <source>partitions</source> <context-group name="ctx"> diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf index c364eac..3a603b7 100644 --- a/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf +++ b/java/code/webapp/WEB-INF/pages/common/fragments/kickstart/schedule/ks-wizard.jspf @@ -28,6 +28,7 @@ <input type="hidden" name="wizardStep" value="first" id="wizard-step" /> <input type="hidden" name="cobbler_id" value="${form.cobbler_id}" id="cobbler_id" /> <input type="hidden" name="sid" value="${form.sid}" /> + <input type="hidden" name="destroyDisks" value="false" id="destroyDisks" />
<c:if test="${empty regularKS}"> <!-- Store guest provisioning info --> diff --git a/java/code/webapp/WEB-INF/pages/kickstart/ssm/schedule.jsp b/java/code/webapp/WEB-INF/pages/kickstart/ssm/schedule.jsp index 76ca1e6..b8e93db 100644 --- a/java/code/webapp/WEB-INF/pages/kickstart/ssm/schedule.jsp +++ b/java/code/webapp/WEB-INF/pages/kickstart/ssm/schedule.jsp @@ -112,6 +112,9 @@ </table>
<%@ include file="/WEB-INF/pages/common/fragments/kickstart/schedule/schedule-options.jspf" %> + <p> + <bean:message key="kickstarts.jsp.diskwarningssm" /> + </p> <div align="right"> <hr /> <input type="submit" name="dispatch" value="${rhn:localize('kickstart.schedule.button2.jsp')}"/> diff --git a/java/code/webapp/WEB-INF/pages/kickstart/wizard/schedule/fifth.jsp b/java/code/webapp/WEB-INF/pages/kickstart/wizard/schedule/fifth.jsp new file mode 100644 index 0000000..7322670 --- /dev/null +++ b/java/code/webapp/WEB-INF/pages/kickstart/wizard/schedule/fifth.jsp @@ -0,0 +1,90 @@ +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> +<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %> +<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %> +<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %> +<html:xhtml /> +<html> + +<head> + +<meta http-equiv="Pragma" content="no-cache" /> + + +<script language="javascript"> +function setStep(stepName) { + var field = document.getElementById("wizard-step"); + field.value = stepName; +} +function setContinue() { + var field = document.getElementById("destroyDisks"); + field.value = "true"; +} +</script> +</head> + +<body> +<%@ include file="/WEB-INF/pages/common/fragments/systems/system-header.jspf" %> +<br /> +<h2> + <img src="/img/icon_kickstart_session-medium.gif" + alt="<bean:message key='system.common.kickstartAlt' />" /> + <bean:message key="kickstart.schedule.heading1.jsp" /> +</h2> + +<c:set var="actionUrl" value="/systems/details/kickstart/ScheduleWizard.do" /> +<c:set var="form" value="${kickstartScheduleWizardForm.map}" /> +<c:set var="regularKS" value="true" /> +<html:form method="POST" action="${actionUrl}"> + <rhn:csrf /> + <rhn:submitted /> + <!-- Store form variables obtained from previous page --> + <%@ include file="/WEB-INF/pages/common/fragments/date-picker-hidden.jspf" %> + <input type="hidden" name="scheduleAsap" value="${form.scheduleAsap}" /> + <input type="hidden" name="cobbler_id" value="${form.cobbler_id}" /> + <input type="hidden" name="sid" value="${form.sid}" /> + <input type="hidden" name="guestName" value="${form.guestName}" /> + <input type="hidden" name="proxyHost" value="${form.proxyHost}" /> + <input type="hidden" name="targetProfileType" value="${form.targetProfileType}" /> + <input type="hidden" name="targetProfile" value="${form.targetProfile}" /> + <input type="hidden" name="targetServerProfile" value="${form.targetServerProfile}" /> + + <input type="hidden" name="postKernelParamsType" value="${form.postKernelParamsType}" /> + <input type="hidden" name="postKernelParams" value="${form.postKernelParams}" /> + <input type="hidden" name="kernelParamsType" value="${form.kernelParamsType}" /> + <input type="hidden" name="kernelParams" value="${form.kernelParams}" /> + + <input type="hidden" name="networkType" value="${form.networkType}" /> + <input type="hidden" name="networkInterface" value="${form.networkInterface}" /> + <input type="hidden" name="bondType" value="${form.bondType}" /> + <input type="hidden" name="bondInterface" value="${form.bondInterface}" /> + <input type="hidden" name="bondOptions" value="${form.bondOptions}" /> + <input type="hidden" name="hiddenBondSlaveInterfaces" value="${rhn:arrayToString(form.bondSlaveInterfaces)}" /> + <input type="hidden" name="bondStatic" value="${form.bondStatic}" /> + <input type="hidden" name="bondAddress" value="${form.bondAddress}" /> + <input type="hidden" name="bondNetmask" value="${form.bondNetmask}" /> + <input type="hidden" name="bondGateway" value="${form.bondGateway}" /> + + <!-- Store useful id fields --> + <input type="hidden" name="wizardStep" value="${form.wizardStep}" id="wizard-step" /> + + <c:if test="${empty regularKS}"> + <!-- Store guest provisioning info --> + <input type="hidden" name="memoryAllocation" value="${form.memoryAllocation}" /> + <input type="hidden" name="virtualCpus" value="${form.virtualCpus}" /> + <input type="hidden" name="localStorageGigabytes" value="${form.localStorageGigabytes}" /> + <input type="hidden" name="diskPath" value="${form.diskPath}" /> + <input type="hidden" name="macAddress" value="${form.macAddress}" /> + </c:if> + <input type="hidden" name="destroyDisks" value="${form.destoryDisks}" id="destroyDisks" /> + + <p> + <bean:message key="kickstarts.jsp.diskwarning" /> + </p> + + <input type="button" value="<bean:message key='sdc.channels.confirmNewBase.cancel' />" onclick="setStep('first');this.form.submit();" /> + <input type="button" value="<bean:message key='errata.publish.packagepush.continue' />" onclick="setContinue();this.form.submit();" /> +</html:form> +</body> +</html> \ No newline at end of file diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml index 1e9761f..f13217e 100644 --- a/java/code/webapp/WEB-INF/struts-config.xml +++ b/java/code/webapp/WEB-INF/struts-config.xml @@ -866,6 +866,7 @@ <form-property name="storageType" type="java.lang.String" /> <form-property name="localStorageGigabytes" type="java.lang.String" /> <form-property name="guestName" type="java.lang.String" /> + <form-property name="destroyDisks" type="java.lang.String" />
</form-bean> @@ -6409,6 +6410,8 @@ redirect="true" path="/systems/details/kickstart/SessionStatus.do"/> <forward name="cobbler-success" redirect="true" path="/systems/details/kickstart/ScheduleWizard.do"/> + <forward name="fifth" + path="/WEB-INF/pages/kickstart/wizard/schedule/fifth.jsp" /> </action>
<action path="/systems/details/virtualization/ProvisionVirtualizationWizard"
spacewalk-commits@lists.fedorahosted.org