backend/server
by Jan Pazdziora
backend/server/importlib/packageImport.py | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit a7e2877841f4ac5bc47c28ba0320deb496f3408a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue May 24 13:56:56 2011 +0200
We need to specifically check for None when calling decode.
Addressing
File "/usr/lib/python2.6/site-packages/spacewalk/server/importlib/importLib.py", line 623, in run
self.preprocess()
File "/usr/lib/python2.6/site-packages/spacewalk/server/importlib/packageImport.py", line 58, in preprocess
self._processPackage(package)
File "/usr/lib/python2.6/site-packages/spacewalk/server/importlib/packageImport.py", line 275, in _processPackage
package['description'] = self._fix_encoding(package['description'])
File "/usr/lib/python2.6/site-packages/spacewalk/server/importlib/packageImport.py", line 506, in _fix_encoding
return text.decode('utf8')
AttributeError: 'NoneType' object has no attribute 'decode'
diff --git a/backend/server/importlib/packageImport.py b/backend/server/importlib/packageImport.py
index 7432d1d..d01cf86 100644
--- a/backend/server/importlib/packageImport.py
+++ b/backend/server/importlib/packageImport.py
@@ -502,6 +502,8 @@ class PackageImport(ChannelPackageSubscription):
package['checksum_type'], package['checksum'])
def _fix_encoding(self, text):
+ if text is None:
+ return None
try:
return text.decode('utf8')
except UnicodeDecodeError:
12 years, 11 months
Changes to 'refs/tags/rhn-client-tools-1.5.8-1'
by Miroslav Suchý
Tag 'rhn-client-tools-1.5.8-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2011-05-23 15:59 +0000
Tagging package [rhn-client-tools] version [1.5.8-1] in directory [client/rhel/rhn-client-tools/].
Changes since spacewalk-java-1.5.34-1:
Jan Blazek (1):
remove python-hwdata from comps
Julian Einwag (1):
replaced (+) with ANSI left join
Miroslav Suchý (3):
683200 - if I want url in unicode, I must us decode - remember that
683200 - u'foo'.decode('utf-8') does not work, while unicode(u'foo') works and is idempotent
Automatic commit of package [rhn-client-tools] release [1.5.8-1].
Tomas Lestach (1):
703273 - check, whether subscription is possible
---
client/rhel/rhn-client-tools/rhn-client-tools.spec | 8 ++++-
client/rhel/rhn-client-tools/src/up2date_client/config.py | 2 -
java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java | 12 +++++++
rel-eng/comps/comps-spacewalk-client-fedora13.xml | 1
rel-eng/comps/comps-spacewalk-client-fedora14.xml | 1
rel-eng/comps/comps-spacewalk-client-rhel5.xml | 1
rel-eng/comps/comps-spacewalk-client-rhel6.xml | 1
rel-eng/packages/rhn-client-tools | 2 -
web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml | 14 ++++----
web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml | 16 +++++-----
10 files changed, 36 insertions(+), 22 deletions(-)
---
12 years, 11 months
3 commits - client/rhel rel-eng/packages
by Miroslav Suchý
client/rhel/rhn-client-tools/rhn-client-tools.spec | 8 +++++++-
client/rhel/rhn-client-tools/src/up2date_client/config.py | 2 +-
rel-eng/packages/rhn-client-tools | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
New commits:
commit bd91a9e57025185f04130540b01e45426a198631
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon May 23 17:59:41 2011 +0200
Automatic commit of package [rhn-client-tools] release [1.5.8-1].
diff --git a/client/rhel/rhn-client-tools/rhn-client-tools.spec b/client/rhel/rhn-client-tools/rhn-client-tools.spec
index c881ced..2da946f 100644
--- a/client/rhel/rhn-client-tools/rhn-client-tools.spec
+++ b/client/rhel/rhn-client-tools/rhn-client-tools.spec
@@ -4,7 +4,7 @@ Group: System Environment/Base
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
URL: https://fedorahosted.org/spacewalk
Name: rhn-client-tools
-Version: 1.5.7
+Version: 1.5.8
Release: 1%{?dist}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@@ -341,6 +341,12 @@ make -f Makefile.rhn-client-tools test
%endif
%changelog
+* Mon May 23 2011 Miroslav Suchý 1.5.8-1
+- 683200 - u'foo'.decode('utf-8') does not work, while unicode(u'foo') works
+ and is idempotent (msuchy(a)redhat.com)
+- 683200 - if I want url in unicode, I must us decode - remember that
+ (msuchy(a)redhat.com)
+
* Thu Apr 28 2011 Simon Lukasik <slukasik(a)redhat.com> 1.5.7-1
- The Debian client on x86_64 should send amd64-debian-linux
(slukasik(a)redhat.com)
diff --git a/rel-eng/packages/rhn-client-tools b/rel-eng/packages/rhn-client-tools
index eab29fd..a5889a3 100644
--- a/rel-eng/packages/rhn-client-tools
+++ b/rel-eng/packages/rhn-client-tools
@@ -1 +1 @@
-1.5.7-1 client/rhel/rhn-client-tools/
+1.5.8-1 client/rhel/rhn-client-tools/
commit 1e04949035cac72489ed757017418cb990fb2110
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon May 23 17:03:53 2011 +0200
683200 - u'foo'.decode('utf-8') does not work, while unicode(u'foo') works and is idempotent
addressing:
Traceback (most recent call last):
File "/usr/sbin/rhn_register", line 76, in ?
app.run()
File "/usr/share/rhn/up2date_client/rhncli.py", line 74, in run
sys.exit(self.main() or 0)
File "/usr/sbin/rhn_register", line 58, in main
ui.main()
File "/usr/share/rhn/up2date_client/tui.py", line 1263, in main
tui.run()
File "/usr/share/rhn/up2date_client/tui.py", line 1211, in run
win = self.windows[index](self.screen, self)
File "/usr/share/rhn/up2date_client/tui.py", line 126, in __init__
(SYSTEM_ALREADY_REGISTERED + "\n\n"
File "/usr/share/rhn/up2date_client/config.py", line 299, in convert_url_from_pune
return urlunsplit((s[0], idn_pune_to_unicode(s[1]), s[2], s[3], s[4])).decode('utf-8')
File "/usr/lib/python2.4/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
exceptions.UnicodeEncodeError: 'ascii' codec can't encode character u'\u017e' in position 8: ordinal not in range(128)
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/config.py b/client/rhel/rhn-client-tools/src/up2date_client/config.py
index 7bbd239..f51e8e5 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/config.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/config.py
@@ -296,7 +296,7 @@ def convert_url_to_pune(url):
def convert_url_from_pune(url):
""" returns url where hostname is converted from Pune encoding. Returns unicode string. """
s = urlsplit(url)
- return urlunsplit((s[0], idn_pune_to_unicode(s[1]), s[2], s[3], s[4])).decode('utf-8')
+ return unicode(urlunsplit((s[0], idn_pune_to_unicode(s[1]), s[2], s[3], s[4])))
def getServerlURL():
""" return list of serverURL from config
commit 9f25ce2ddd44b068b5f3e464fcfdc97f3d83f957
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon May 23 16:55:59 2011 +0200
683200 - if I want url in unicode, I must us decode - remember that
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/config.py b/client/rhel/rhn-client-tools/src/up2date_client/config.py
index 8efe530..7bbd239 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/config.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/config.py
@@ -296,7 +296,7 @@ def convert_url_to_pune(url):
def convert_url_from_pune(url):
""" returns url where hostname is converted from Pune encoding. Returns unicode string. """
s = urlsplit(url)
- return urlunsplit((s[0], idn_pune_to_unicode(s[1]), s[2], s[3], s[4])).encode('utf-8')
+ return urlunsplit((s[0], idn_pune_to_unicode(s[1]), s[2], s[3], s[4])).decode('utf-8')
def getServerlURL():
""" return list of serverURL from config
12 years, 11 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java | 12 ++++++++++
1 file changed, 12 insertions(+)
New commits:
commit de86594b87ed8877707594356845ef44e4aa08e7
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon May 23 13:50:07 2011 +0200
703273 - check, whether subscription is possible
and report troubles instead of ISE
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java
index c19845b..5ec2953 100755
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/TargetSystemsConfirmAction.java
@@ -31,6 +31,7 @@ import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -69,8 +70,19 @@ public class TargetSystemsConfirmAction extends RhnAction implements Listable {
request.setAttribute("cid", chan.getId());
if (helper.isDispatched()) {
RhnSet set = TargetSystemsAction.getSetDecl(chan).get(user);
+ List<Server> servers = new ArrayList<Server>();
for (Long id : set.getElementValues()) {
Server s = SystemManager.lookupByIdAndUser(id, user);
+ if (!SystemManager.canServerSubscribeToChannel(user.getOrg(), s, chan)) {
+ createErrorMessage(request, "api.channel.software.channelsubscription",
+ s.getHostname());
+ // even if it's not success, the redirect is what we need
+ return getStrutsDelegate().forwardParams(mapping.findForward("success"),
+ request.getParameterMap());
+ }
+ servers.add(s);
+ }
+ for (Server s : servers) {
SystemManager.subscribeServerToChannel(user, s, chan);
}
Map params = new HashMap();
12 years, 11 months
web/modules
by Michael Mraka
web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml | 14 ++++++------
web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml | 16 +++++++-------
2 files changed, 15 insertions(+), 15 deletions(-)
New commits:
commit a33862b1ef130e322f46a1018a6d37f997e79774
Author: Julian Einwag <je(a)rockenstein.de>
Date: Fri May 20 14:28:37 2011 +0200
replaced (+) with ANSI left join
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml
index 7df3ca8..de68eb0 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/Action_queries.xml
@@ -9,8 +9,9 @@ SELECT SA.action_id AS ID,
AType.name AS history_type_name
FROM rhnActionType AType,
rhnActionStatus AStat,
- rhnUser U,
- rhnAction A,
+ rhnAction A
+ LEFT JOIN rhnUser U
+ ON A.scheduler = U.id,
rhnServerAction SA,
rhnSet ST
WHERE ST.user_id = :user_id
@@ -20,7 +21,6 @@ SELECT SA.action_id AS ID,
AND SA.action_id = A.id
AND AType.id = A.action_type
AND AStat.id = SA.status
- AND A.scheduler = U.id (+)
AND AStat.id = 0
</query>
</mode>
@@ -112,15 +112,15 @@ SELECT EVENT_ID, TO_CHAR(CREATED, 'YYYY-MM-DD HH24:MI:SS') CREATED, SUMMARY
SA.created
FROM rhnActionType AType,
rhnActionStatus AStat,
- rhnUser U,
- rhnAction A,
+ rhnAction A
+ LEFT JOIN rhnUser U
+ ON U.id = A.scheduler,
rhnServerAction SA
WHERE SA.server_id = :support_sid
AND SA.action_id = A.id
AND ATYPE.id = A.action_type
AND AStat.id = SA.status
- AND U.id(+) = A.scheduler
- )
+ ) X
ORDER BY CREATED DESC, EVENT_ID DESC
</query>
</mode>
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
index 59863f3..17d4adb 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/Package_queries.xml
@@ -590,9 +590,11 @@ SELECT P2.id AS ID, PN.name || '-' || evr_t_as_vre_simple(PE.evr) || '-' ||
rhnPackageName PN,
rhnPackageEVR PE,
rhnPackageEVR PE2,
- rhnErrata E,
- rhnErrataPackage EP,
- rhnPackage P2,
+ rhnPackage P2
+ LEFT JOIN rhnErrataPackage EP
+ ON P2.id = EP.package_id
+ LEFT JOIN rhnErrata E
+ ON E.id = EP.errata_id,
rhnAvailableChannels AC,
rhnChannelPackage CP2,
rhnChannelPackage CP1,
@@ -605,10 +607,8 @@ SELECT P2.id AS ID, PN.name || '-' || evr_t_as_vre_simple(PE.evr) || '-' ||
and ac.channel_id = cp2.channel_id
and p1.name_id = p2.name_id
AND cp2.package_id = P2.id
- AND P2.id = EP.package_id(+)
AND p2.evr_id = PE.id
AND PE2.id = P1.evr_id
- AND E.id(+) = EP.errata_id
and pe.id != pe2.id
AND PE.evr >= PE2.evr
-- after here is just for output
@@ -1421,11 +1421,12 @@ SELECT P.id AS ID,
E.advisory,
E.id AS ADVISORY_ID,
COUNT(DISTINCT SNPC.server_id) NUM_SYSTEMS
- FROM rhnErrata E,
+ FROM rhnServerNeededPackageCache SNPC
+ LEFT JOIN rhnErrata E
+ ON SNPC.errata_id = E.id,
rhnPackageEVR PE,
rhnPackageName PN,
rhnPackage P,
- rhnServerNeededPackageCache SNPC,
rhnSet S
WHERE S.user_id = :user_id
AND S.label = 'system_list'
@@ -1433,7 +1434,6 @@ SELECT P.id AS ID,
AND SNPC.package_id = P.id
AND P.name_id = PN.id
AND P.evr_id = PE.id
- AND SNPC.errata_id = E.id (+)
AND NOT EXISTS (SELECT 1 FROM rhnSolarisPatch SP WHERE
SP.package_id = P.id)
AND NOT EXISTS (SELECT 1 FROM rhnSolarisPatchSet SPS WHERE
12 years, 11 months
rel-eng/comps
by jblazek
rel-eng/comps/comps-spacewalk-client-fedora13.xml | 1 -
rel-eng/comps/comps-spacewalk-client-fedora14.xml | 1 -
rel-eng/comps/comps-spacewalk-client-rhel5.xml | 1 -
rel-eng/comps/comps-spacewalk-client-rhel6.xml | 1 -
4 files changed, 4 deletions(-)
New commits:
commit a791409e92570468eaf753cb1b680906f7223257
Author: Jan Blazek <jblazek(a)redhat.com>
Date: Mon May 23 08:46:53 2011 +0200
remove python-hwdata from comps
diff --git a/rel-eng/comps/comps-spacewalk-client-fedora13.xml b/rel-eng/comps/comps-spacewalk-client-fedora13.xml
index 2e3f9c4..d8b5c4c 100644
--- a/rel-eng/comps/comps-spacewalk-client-fedora13.xml
+++ b/rel-eng/comps/comps-spacewalk-client-fedora13.xml
@@ -31,7 +31,6 @@
<packagereq type="default">spacewalk-certs-tools</packagereq>
<packagereq type="default">spacewalk-client-repo</packagereq>
<packagereq type="default">spacewalk-backend-libs</packagereq>
- <packagereq type="default">python-hwdata</packagereq>
</packagelist>
</group>
</comps>
diff --git a/rel-eng/comps/comps-spacewalk-client-fedora14.xml b/rel-eng/comps/comps-spacewalk-client-fedora14.xml
index 2e3f9c4..d8b5c4c 100644
--- a/rel-eng/comps/comps-spacewalk-client-fedora14.xml
+++ b/rel-eng/comps/comps-spacewalk-client-fedora14.xml
@@ -31,7 +31,6 @@
<packagereq type="default">spacewalk-certs-tools</packagereq>
<packagereq type="default">spacewalk-client-repo</packagereq>
<packagereq type="default">spacewalk-backend-libs</packagereq>
- <packagereq type="default">python-hwdata</packagereq>
</packagelist>
</group>
</comps>
diff --git a/rel-eng/comps/comps-spacewalk-client-rhel5.xml b/rel-eng/comps/comps-spacewalk-client-rhel5.xml
index 2e3f9c4..d8b5c4c 100644
--- a/rel-eng/comps/comps-spacewalk-client-rhel5.xml
+++ b/rel-eng/comps/comps-spacewalk-client-rhel5.xml
@@ -31,7 +31,6 @@
<packagereq type="default">spacewalk-certs-tools</packagereq>
<packagereq type="default">spacewalk-client-repo</packagereq>
<packagereq type="default">spacewalk-backend-libs</packagereq>
- <packagereq type="default">python-hwdata</packagereq>
</packagelist>
</group>
</comps>
diff --git a/rel-eng/comps/comps-spacewalk-client-rhel6.xml b/rel-eng/comps/comps-spacewalk-client-rhel6.xml
index 4a238c1..1979d03 100644
--- a/rel-eng/comps/comps-spacewalk-client-rhel6.xml
+++ b/rel-eng/comps/comps-spacewalk-client-rhel6.xml
@@ -32,7 +32,6 @@
<packagereq type="default">spacewalk-client-repo</packagereq>
<packagereq type="default">spacewalk-backend-libs</packagereq>
<packagereq type="default">python-ethtool</packagereq>
- <packagereq type="default">python-hwdata</packagereq>
</packagelist>
</group>
</comps>
12 years, 11 months
Changes to 'refs/tags/spacewalk-java-1.5.34-1'
by Tomas Lestach
Tag 'spacewalk-java-1.5.34-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2011-05-20 18:09 +0000
Tagging package [spacewalk-java] version [1.5.34-1] in directory [java/].
Changes since spacewalk-backend-1.5.27-1:
Milan Zazrivec (1):
679333 - update rhnPushClient when deleting server
Tomas Lestach (4):
706399 - "<" is not the best thing in xml
659138 - do not forward parameter map in case of success
659138 - extend schedule creation error handling
Automatic commit of package [spacewalk-java] release [1.5.34-1].
---
java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | 6
java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java | 2
java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java | 58 +-
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 18
java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java | 16
java/spacewalk-java.spec | 8
rel-eng/packages/spacewalk-java | 2
schema/spacewalk/oracle/procs/delete_server.sql | 2
schema/spacewalk/postgres/procs/delete_server.sql | 2
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle | 238 +++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql | 240 ++++++++++
11 files changed, 572 insertions(+), 20 deletions(-)
---
12 years, 11 months
java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/spacewalk-java.spec | 8 +++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit 922037c8d2d8da3b78e02d76fd622c7267643c20
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri May 20 20:09:21 2011 +0200
Automatic commit of package [spacewalk-java] release [1.5.34-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 79b2163..a633e18 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.5.33
+Version: 1.5.34
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -540,6 +540,12 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Fri May 20 2011 Tomas Lestach <tlestach(a)redhat.com> 1.5.34-1
+- 659138 - extend schedule creation error handling (tlestach(a)redhat.com)
+- 659138 - do not forward parameter map in case of success
+ (tlestach(a)redhat.com)
+- 706399 - "<" is not the best thing in xml (tlestach(a)redhat.com)
+
* Fri May 20 2011 Jan Pazdziora 1.5.33-1
- 706399 - replacing rhnServerNeededView with custom subselect
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index eb22bf3..b523448 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.5.33-1 java/
+1.5.34-1 java/
12 years, 11 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java | 58 +++++++---
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 18 +++
java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java | 16 ++
3 files changed, 78 insertions(+), 14 deletions(-)
New commits:
commit 8cfa182beb513179efd62338c4202d30c55004cd
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri May 20 16:21:06 2011 +0200
659138 - extend schedule creation error handling
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java b/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
index db7c810..f7bfbe9 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/ScheduleDetailAction.java
@@ -32,6 +32,7 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -43,6 +44,8 @@ import javax.servlet.http.HttpServletResponse;
*/
public class ScheduleDetailAction extends RhnAction {
+ static final String SCHEDULE_NAME_REGEX = "^[a-z\\d][a-z\\d\\-\\.\\_]*$";
+
/** {@inheritDoc} */
public ActionForward execute(ActionMapping mapping,
ActionForm formIn,
@@ -100,40 +103,67 @@ public class ScheduleDetailAction extends RhnAction {
mapping.findForward("disable"), params);
}
- String scheduleName = form.getString("schedulename");
String bunchName = form.getString("bunch");
+ String scheduleName = form.getString("schedulename");
+ if (!Pattern.compile(SCHEDULE_NAME_REGEX).matcher(scheduleName).find()) {
+ createErrorMessage(request, "schedule.jsp.schedulenameregex", null);
+
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"), params);
+ }
try {
TaskomaticApi tapi = new TaskomaticApi();
+ // check, whether there's not already a schedule of this name
+ if (scheduleId == null && tapi.satScheduleActive(scheduleName, loggedInUser)) {
+ createErrorMessage(request,
+ "schedule.jsp.schedulenameinuse", scheduleName);
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"), params);
+ }
+ // set the schedule
tapi.scheduleSatBunch(loggedInUser,
scheduleName,
bunchName,
picker.getCronEntry()
);
- if (ctx.hasParam("create_button")) {
- createSuccessMessage(request, "message.schedulecreated", scheduleName);
- }
- else {
- createSuccessMessage(request, "message.scheduleupdated", scheduleName);
- }
+ // check, whether it was created
Map schedule = tapi.lookupScheduleByBunchAndLabel(loggedInUser, bunchName,
scheduleName);
- params.put("schid", schedule.get("id"));
- return getStrutsDelegate().forwardParams(
- mapping.findForward("success"), params);
+ if (schedule != null) {
+ if (ctx.hasParam("create_button")) {
+ createSuccessMessage(request, "message.schedulecreated", scheduleName);
+ }
+ else {
+ createSuccessMessage(request, "message.scheduleupdated", scheduleName);
+ }
+ params.put("schid", schedule.get("id"));
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("success"), params);
+ }
+ // something went wrong
+ tapi.unscheduleSatTask(scheduleName, loggedInUser);
+ createErrorMessage(request,
+ "schedule.jsp.schedulefailed", scheduleName);
}
catch (TaskomaticApiException e) {
if (e.getMessage().contains("InvalidParamException")) {
- createErrorMessage(request,
- "repos.jsp.message.invalidcron", picker.getCronEntry());
+ if (e.getMessage().contains("Cron trigger")) {
+ createErrorMessage(request,
+ "repos.jsp.message.invalidcron", picker.getCronEntry());
+ }
+ else {
+ createErrorMessage(request,
+ "schedule.jsp.schedulefailed", scheduleName);
+ }
}
else {
createErrorMessage(request,
"repos.jsp.message.taskomaticdown", null);
}
- return getStrutsDelegate().forwardParams(
- mapping.findForward("default"), params);
}
+ return getStrutsDelegate().forwardParams(
+ mapping.findForward("default"), params);
}
private Boolean isActive(Map schedule) {
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 14f72b9..1cf501e 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
@@ -22843,6 +22843,24 @@ given channel.</source>
<context context-type="sourcefile">/rhn/admin/DeleteSchedule.do</context>
</context-group>
</trans-unit>
+ <trans-unit id="schedule.jsp.schedulenameinuse">
+ <source>Schedule name {0} is already in use. Please choose another one.</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.jsp.schedulenameregex">
+ <source>Schedule name must begin with a letter and may contain only lowercase letters, hyphens ('-'), periods ('.'), underscores ('_'), and numerals.</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
+ <trans-unit id="schedule.jsp.schedulefailed">
+ <source>Setting of {0} schedule failed.</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/ScheduleDetail.do</context>
+ </context-group>
+ </trans-unit>
<trans-unit id="schedule.edit.jsp.toolbar">
<source>Schedule {0}</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java b/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
index 838d7fd..5345f0c 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskomaticApi.java
@@ -226,6 +226,22 @@ public class TaskomaticApi {
}
/**
+ * Check whether there's an active schedule of given job label
+ * @param jobLabel job label
+ * @param user the user
+ * @return true, if schedule exists
+ */
+ public boolean satScheduleActive(String jobLabel, User user) {
+ List<Map> schedules = (List<Map>) invoke("tasko.listActiveSatSchedules");
+ for (Map schedule : schedules) {
+ if (schedule.get("job_label").equals(jobLabel)) {
+ return Boolean.TRUE;
+ }
+ }
+ return Boolean.FALSE;
+ }
+
+ /**
* Get the cron format for a single channel
* @param chan the channel
* @param user the user
12 years, 11 months
2 commits - java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | 6 +++---
java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
New commits:
commit 669cd9890f5717e72fe8f76b56906c58b55f0b46
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri May 20 15:26:46 2011 +0200
659138 - do not forward parameter map in case of success
(we would forward also submitted param, that confuses csfr token check
diff --git a/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java b/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
index 9c4af32..923063b 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/tasko/DeleteScheduleAction.java
@@ -79,7 +79,7 @@ public class DeleteScheduleAction extends RhnAction {
}
return getStrutsDelegate().forwardParams(
mapping.findForward("success"),
- request.getParameterMap());
+ new HashMap());
}
catch (TaskomaticApiException e) {
createErrorMessage(request,
commit 210dbc4a9669ea5b381787791a90d5f26408a254
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Fri May 20 18:50:50 2011 +0200
706399 - "<" is not the best thing in xml
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
index caf9ddf..e038aa1 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
@@ -165,7 +165,7 @@ where rhnChannelErrata.errata_id = rhnErrataPackage.errata_id
where cp.channel_id = csc.channel_id
and rhnChannelNewestPackage.package_id = cp.package_id
and rhnServerChannel.server_id = csc.server_id
- and cp.channel_id < rhnChannelNewestPackage.channel_id
+ and cp.channel_id < rhnChannelNewestPackage.channel_id
)
and not exists (
-- rule out records where the server has the same package name with higher evr
@@ -173,7 +173,7 @@ where rhnChannelErrata.errata_id = rhnErrataPackage.errata_id
where rhnServerPackage.server_id = sp.server_id
and rhnServerPackage.name_id = sp.name_id
and sp.evr_id = sevr.id
- and rhnPackageEVR.evr <= sevr.evr
+ and rhnPackageEVR.evr <= sevr.evr
and rhnServerPackage.package_arch_id = puac.package_arch_id
and puac.package_upgrade_arch_id = sp.package_arch_id
)
@@ -184,7 +184,7 @@ where rhnChannelErrata.errata_id = rhnErrataPackage.errata_id
and csc.channel_id = ocnp.channel_id
and rhnServerPackage.name_id = ocnp.name_id
and ocnp.evr_id = oevr.id
- and rhnPackageEVR.evr < oevr.evr
+ and rhnPackageEVR.evr < oevr.evr
and rhnServerPackage.package_arch_id = puac.package_arch_id
and puac.package_upgrade_arch_id = ocnp.package_arch_id
)
12 years, 11 months