java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
| 3
java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidScriptNameException.java
| 45 ++++++++++
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
| 23 ++++-
java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
| 8 -
java/spacewalk-java.spec
| 8 +
rel-eng/packages/spacewalk-java
| 2
6 files changed, 78 insertions(+), 11 deletions(-)
New commits:
commit 337123745a4241b5aa4ec0fbfbe97b936652892f
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Jun 24 21:39:03 2013 +0200
Automatic commit of package [spacewalk-java] release [1.10.103-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 6129b52..773e878 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.102
+Version: 1.10.103
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -751,6 +751,12 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Mon Jun 24 2013 Jan Dobes 1.10.103-1
+- correcting ProfileHandlerTest to changed API
+- 976722 - kickstart script name is required
+- 976722 - creating exception for script name
+- 976722 - adding eng resources
+
* Mon Jun 24 2013 Tomas Lestach <tlestach(a)redhat.com> 1.10.102-1
- 855845 - escaping system name for message.syncpackages message
- 855845 - escaping system name for
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index e59b546..499fcf3 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.10.102-1 java/
+1.10.103-1 java/
commit cd1257e92e8e329e7dd78d28c8a747cc04a3da4a
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Jun 24 21:25:42 2013 +0200
correcting ProfileHandlerTest to changed API
diff --git
a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
index df53dd2..bda9ff8 100644
---
a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
+++
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/test/ProfileHandlerTest.java
@@ -155,8 +155,8 @@ public class ProfileHandlerTest extends BaseHandlerTestCase {
public void testListScript() throws Exception {
KickstartData ks =
KickstartDataTest.createKickstartWithChannel(admin.getOrg());
- int id = handler.addScript(adminKey, ks.getLabel(), "This is a script",
"",
- "post", true);
+ int id = handler.addScript(adminKey, ks.getLabel(), "sample",
+ "This is a script", "", "post", true);
ks = (KickstartData) HibernateFactory.reload(ks);
boolean found = false;
@@ -171,8 +171,8 @@ public class ProfileHandlerTest extends BaseHandlerTestCase {
public void testAddScript() throws Exception {
KickstartData ks =
KickstartDataTest.createKickstartWithChannel(admin.getOrg());
- int id = handler.addScript(adminKey, ks.getLabel(), "This is a script",
"",
- "post", true);
+ int id = handler.addScript(adminKey, ks.getLabel(), "sample",
+ "This is a script", "", "post", true);
ks = (KickstartData) HibernateFactory.reload(ks);
boolean found = false;
for (KickstartScript script : ks.getScripts()) {
commit e02e31a0588b144a752f468494bd120fef841318
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Jun 24 20:42:58 2013 +0200
976722 - kickstart script name is required
diff --git
a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
index 7ea035f..c45e547 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/kickstart/profile/ProfileHandler.java
@@ -40,6 +40,7 @@ import com.redhat.rhn.frontend.dto.kickstart.KickstartOptionValue;
import com.redhat.rhn.frontend.xmlrpc.BaseHandler;
import com.redhat.rhn.frontend.xmlrpc.InvalidChannelLabelException;
import com.redhat.rhn.frontend.xmlrpc.InvalidKickstartScriptException;
+import com.redhat.rhn.frontend.xmlrpc.InvalidScriptNameException;
import com.redhat.rhn.frontend.xmlrpc.InvalidScriptTypeException;
import com.redhat.rhn.frontend.xmlrpc.IpRangeConflictException;
import com.redhat.rhn.frontend.xmlrpc.PermissionCheckFailureException;
@@ -58,6 +59,7 @@ import com.redhat.rhn.manager.kickstart.KickstartManager;
import com.redhat.rhn.manager.kickstart.KickstartOptionsCommand;
import org.apache.commons.lang.BooleanUtils;
+import org.apache.commons.lang.StringUtils;
import org.cobbler.Profile;
import java.util.ArrayList;
@@ -412,6 +414,7 @@ public class ProfileHandler extends BaseHandler {
* Add a script to a kickstart profile
* @param sessionKey key
* @param ksLabel the kickstart label
+ * @param name name of the script
* @param contents the contents
* @param interpreter the script interpreter to use
* @param type "pre" or "post"
@@ -422,6 +425,7 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "ksLabel", "The
kickstart label to
* add the script to.")
+ * @xmlrpc.param #param_desc("string", "name", "The
kickstart script name.")
* @xmlrpc.param #param_desc("string", "contents", "The full
script to
* add.")
* @xmlrpc.param #param_desc("string", "interpreter", "The
path to the
@@ -434,9 +438,9 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.returntype int id - the id of the added script
*
*/
- public int addScript(String sessionKey, String ksLabel, String contents,
+ public int addScript(String sessionKey, String ksLabel, String name, String
contents,
String interpreter, String type, boolean chroot) {
- return addScript(sessionKey, ksLabel, contents, interpreter, type,
+ return addScript(sessionKey, ksLabel, name, contents, interpreter, type,
chroot, false);
}
@@ -444,6 +448,7 @@ public class ProfileHandler extends BaseHandler {
* Add a script to a kickstart profile
* @param sessionKey key
* @param ksLabel the kickstart label
+ * @param name name of the script
* @param contents the contents
* @param interpreter the script interpreter to use
* @param type "pre" or "post"
@@ -455,6 +460,7 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "ksLabel", "The
kickstart label to
* add the script to.")
+ * @xmlrpc.param #param_desc("string", "name", "The
kickstart script name.")
* @xmlrpc.param #param_desc("string", "contents", "The full
script to
* add.")
* @xmlrpc.param #param_desc("string", "interpreter", "The
path to the
@@ -468,9 +474,9 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.returntype int id - the id of the added script
*
*/
- public int addScript(String sessionKey, String ksLabel, String contents,
+ public int addScript(String sessionKey, String ksLabel, String name, String
contents,
String interpreter, String type, boolean chroot, boolean template) {
- return addScript(sessionKey, ksLabel, contents, interpreter, type, chroot,
+ return addScript(sessionKey, ksLabel, name, contents, interpreter, type, chroot,
template, false);
}
@@ -478,6 +484,7 @@ public class ProfileHandler extends BaseHandler {
* Add a script to a kickstart profile
* @param sessionKey key
* @param ksLabel the kickstart label
+ * @param name name of the script
* @param contents the contents
* @param interpreter the script interpreter to use
* @param type "pre" or "post"
@@ -490,6 +497,7 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "ksLabel", "The
kickstart label to
* add the script to.")
+ * @xmlrpc.param #param_desc("string", "name", "The
kickstart script name.")
* @xmlrpc.param #param_desc("string", "contents", "The full
script to
* add.")
* @xmlrpc.param #param_desc("string", "interpreter", "The
path to the
@@ -505,7 +513,7 @@ public class ProfileHandler extends BaseHandler {
* @xmlrpc.returntype int id - the id of the added script
*
*/
- public int addScript(String sessionKey, String ksLabel, String contents,
+ public int addScript(String sessionKey, String ksLabel, String name, String
contents,
String interpreter, String type, boolean chroot, boolean template,
boolean erroronfail) {
User loggedInUser = getLoggedInUser(sessionKey);
@@ -516,7 +524,12 @@ public class ProfileHandler extends BaseHandler {
throw new InvalidScriptTypeException();
}
+ if (StringUtils.isBlank(name)) {
+ throw new InvalidScriptNameException();
+ }
+
KickstartScript script = new KickstartScript();
+ script.setScriptName(name);
script.setData(contents.getBytes());
script.setInterpreter(interpreter.equals("") ? null : interpreter);
script.setScriptType(type);
commit c3cb9fc1cbbec652f326ad2e5842c65f48eb25f2
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Jun 24 21:00:47 2013 +0200
976722 - creating exception for script name
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidScriptNameException.java
b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidScriptNameException.java
new file mode 100755
index 0000000..099cf88
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/InvalidScriptNameException.java
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2009--2013 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.
+ */
+package com.redhat.rhn.frontend.xmlrpc;
+
+import com.redhat.rhn.FaultException;
+import com.redhat.rhn.common.localization.LocalizationService;
+
+
+/**
+ * InvalidScriptNameException
+ * @version $Rev$
+ */
+public class InvalidScriptNameException extends FaultException {
+
+ /**
+ * Constructor
+ */
+ public InvalidScriptNameException() {
+ super(2762, "invalidScriptName", LocalizationService.getInstance().
+ getMessage("api.kickstart.invalidscriptname"));
+ }
+
+ /**
+ * Constructor
+ * @param cause the cause (which is saved for later retrieval by the
+ * Throwable.getCause() method). (A null value is permitted, and indicates
+ * that the cause is nonexistent or unknown.)
+ */
+ public InvalidScriptNameException(Throwable cause) {
+ super(2762, "invalidScriptName", LocalizationService.getInstance().
+ getMessage("api.kickstart.invalidscriptname"), cause);
+ }
+}
commit 5fe492d4dbf23b366665035f8b139f25dee66615
Author: Jan Dobes <jdobes(a)redhat.com>
Date: Mon Jun 24 21:05:17 2013 +0200
976722 - adding eng resources
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 508f225..e7b4566 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7344,6 +7344,9 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="api.kickstart.invalidscripttype">
<source>Only script types of "pre" and "post" are
allowed for kickstarts.</source>
</trans-unit>
+ <trans-unit id="api.kickstart.invalidscriptname">
+ <source>Script Name is required.</source>
+ </trans-unit>
<trans-unit id="api.kickstart.invalidscript">
<source>You have specified an invalid kickstart script.</source>
</trans-unit>