java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java |
74 ++++------
java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeSubmit.java |
3
java/spacewalk-java.spec |
7
rel-eng/packages/spacewalk-java |
2
4 files changed, 41 insertions(+), 45 deletions(-)
New commits:
commit 9555352c43f19cbed7b098d03e6387376c9bc966
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Jan 9 17:20:49 2013 +0100
Automatic commit of package [spacewalk-java] release [1.9.39-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 34b06e2..31754d5 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.9.38
+Version: 1.9.39
Release: 1%{?dist}
URL:
https://fedorahosted.org/spacewalk
Source0:
https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -659,6 +659,11 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Wed Jan 09 2013 Tomas Lestach <tlestach(a)redhat.com> 1.9.39-1
+- 868884 - fix the 'Replace Existing Subscriptions' SSM config channel option
+- 868884 - subscribe only to selected config channels via SSM
+- 890897 - prevent NPE when package description might be null
+
* Tue Jan 08 2013 Michael Mraka <michael.mraka(a)redhat.com> 1.9.38-1
- 863123 - improved query
- 885760 - add virtualization guest info to the ServerSerializer
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 4c0b2f5..0b5553f 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.9.38-1 java/
+1.9.39-1 java/
commit 009cd32cca908c966ac36440f0de4b5fec7320d3
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Jan 9 15:50:05 2013 +0100
868884 - fix the 'Replace Existing Subscriptions' SSM config channel option
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
index 605b377..c3362d5 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
@@ -161,64 +161,53 @@ public class SubscribeConfirm extends RhnAction {
}
private boolean subscribeServer(User user, Server server,
- RhnSet channels, String position) {
- boolean retval = false; //whether subscriptions have changed
- List toCheck = server.getConfigChannels(); //so we don't add duplicates
+ RhnSet toSubsChs, String position) {
+ boolean retval = false; // whether subscriptions have changed
+ // save the currently subscribed channels
+ List currentChs = new ArrayList(server.getConfigChannels());
ConfigurationManager cm = ConfigurationManager.getInstance();
- if (position.equals(REPLACE)) {
- //clear the current subscriptions,
- toCheck.clear();
- }
- else if (position.equals(HIGHEST)) {
- //copy the current subscriptions, and clear them, so we
- //can add them back at the end.
- toCheck = new ArrayList(server.getConfigChannels());
+ // for LOWEST the current channel subscription stays preserved
+ if (!position.equals(LOWEST)) {
server.getConfigChannels().clear();
}
- //Order the channels in the order requested by user
- List setElements = new ArrayList(channels.getElements());
- Collections.sort(setElements, new ConfigChannelSetComparator());
- Iterator i = setElements.iterator();
+ // Order the new channels in the order requested by user
+ List rankElements = new ArrayList(
+ RhnSetDecl.CONFIG_CHANNELS_RANKING.get(user).getElements());
+ Collections.sort(rankElements, new ConfigChannelSetComparator());
+ Iterator i = rankElements.iterator();
- //subscribe to all the channels
+ // subscribe to the new channels
while (i.hasNext()) {
Long ccid = ((RhnSetElement)i.next()).getElement();
ConfigChannel channel = cm.lookupConfigChannel(user, ccid);
- /* Decision Point:
- * there are two ways to approach subscribing channels
- * when servers already are subscribed.
- * One: leave the current subscriptions as they were
- * if (!toCheck.contains(channel)) {
- * server.subscribe(channel);
- * retval = true;
- * }
- *
- * Two: resubscribe in the new position.
- *
- * We chose number two because the user gets what
- * they see and therefore is less surprised.
- *
- * We did not allow the user to choose which functionality
- * they wanted because that would have complicated an
- * already complex series of decisions.
- */
- if (toCheck.contains(channel)) {
- toCheck.remove(channel);
+
+ if (currentChs.contains(channel)) {
+ // for REPLACE we need to re-subscribe current channels
+ // in order requested by user
+ if (position.equals(REPLACE)) {
+ server.subscribe(channel);
+ }
+ }
+ else {
+ if (toSubsChs.contains(channel.getId())) {
+ // subscribe new channels
+ server.subscribe(channel);
+ retval = true;
+ }
}
- server.subscribe(channel);
- retval = true; //subscriptions have changed
}
if (position.equals(HIGHEST)) {
- //now we have to add back what they had before.
- Iterator j = toCheck.iterator();
+ // for HIGHEST we have to re-subscribe to the channels the system was
+ // originally subscribed to
+ Iterator j = currentChs.iterator();
while (j.hasNext()) {
server.subscribe((ConfigChannel)j.next());
}
}
- return retval; //whether subscriptions have changed
+ return retval;
}
private void checkPosition(HttpServletRequest request) {
commit 35d36f75d2a888675b0be048e46dd1b391798ea2
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Jan 8 16:13:39 2013 +0100
868884 - subscribe only to selected config channels via SSM
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
index f1e1c6f..605b377 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeConfirm.java
@@ -22,6 +22,7 @@ import com.redhat.rhn.domain.rhnset.RhnSetElement;
import com.redhat.rhn.domain.server.Server;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.action.common.BadParameterException;
+import com.redhat.rhn.frontend.action.configuration.ConfigActionHelper;
import com.redhat.rhn.frontend.action.configuration.ConfigChannelSetComparator;
import com.redhat.rhn.frontend.dto.ConfigSystemDto;
import com.redhat.rhn.frontend.struts.RequestContext;
@@ -143,6 +144,8 @@ public class SubscribeConfirm extends RhnAction {
}
}
+ ConfigActionHelper.clearRhnSets(user);
+
//Give the user a message about how many servers we have changed.
if (successes == 1) {
getStrutsDelegate().saveMessage("ssm.config.subscribeconfirm.jsp.onesuccess",
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeSubmit.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeSubmit.java
index 40f07cc..975332e 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeSubmit.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/ssm/SubscribeSubmit.java
@@ -54,7 +54,7 @@ public class SubscribeSubmit extends BaseSetOperateOnSelectedItemsAction
{
* {@inheritDoc}
*/
protected RhnSetDecl getSetDecl() {
- return RhnSetDecl.CONFIG_CHANNELS;
+ return RhnSetDecl.CONFIG_CHANNELS_RANKING;
}
/**
@@ -84,7 +84,6 @@ public class SubscribeSubmit extends BaseSetOperateOnSelectedItemsAction
{
ActionForm formIn,
HttpServletRequest request,
HttpServletResponse response) {
- //if they chose no probe suites, return to the same page with a message
RhnSet set = updateSet(request);
RequestContext context = new RequestContext(request);