java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml |
1
java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChildChannelConfirmAction.java |
11 +++-
java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsAction.java |
21 --------
java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsEvent.java |
26 ++++++----
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml |
3 +
5 files changed, 33 insertions(+), 29 deletions(-)
New commits:
commit 09b0052b46bf78853cdf7fd8900b43a76a588fcb
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed May 26 15:14:02 2010 -0400
595473 525588 - fixing small query issue and moving the ssm operation creation to
before the
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index 9f85343..00cf97e 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -1196,6 +1196,7 @@ GROUP BY C.id, C.name
where
rset.label = :set_label and
rset.user_id = :uid and
+ rset.element = S.id and
C.parent_channel = SC.channel_id and
SCAC.server_arch_id = S.server_arch_id and
SCAC.channel_arch_id = C.channel_arch_id and
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChildChannelConfirmAction.java
b/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChildChannelConfirmAction.java
index edbdcfa..9056fd0 100644
---
a/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChildChannelConfirmAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/action/channel/ssm/ChildChannelConfirmAction.java
@@ -28,6 +28,7 @@ import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
import com.redhat.rhn.manager.channel.ChannelManager;
import com.redhat.rhn.manager.rhnset.RhnSetDecl;
import com.redhat.rhn.manager.ssm.SsmManager;
+import com.redhat.rhn.manager.ssm.SsmOperationManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -97,9 +98,17 @@ public class ChildChannelConfirmAction extends RhnAction implements
Listable {
ActionForward result;
if (isSubmitted(daForm)) {
+ long operationId = SsmOperationManager.createOperation(user,
+ "Channel Subscription Updates", null);
+
+ SsmOperationManager.associateServersWithOperation(operationId, user.getId(),
+ RhnSetDecl.SSM_CHANNEL_SUBSCRIBE.getLabel());
+ SsmOperationManager.associateServersWithOperation(operationId, user.getId(),
+ RhnSetDecl.SSM_CHANNEL_UNSUBSCRIBE.getLabel());
+
// Fire the request off asynchronously
SsmChangeChannelSubscriptionsEvent event =
- new SsmChangeChannelSubscriptionsEvent(user, subs.values());
+ new SsmChangeChannelSubscriptionsEvent(user, subs.values(),
operationId);
MessageQueue.publish(event);
result = mapping.findForward("success");
diff --git
a/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsAction.java
b/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsAction.java
index 979a05b..cd3341b 100644
---
a/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsAction.java
+++
b/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsAction.java
@@ -17,7 +17,6 @@ package com.redhat.rhn.frontend.events;
import com.redhat.rhn.common.messaging.EventMessage;
import com.redhat.rhn.domain.user.User;
import com.redhat.rhn.frontend.action.channel.ssm.ChannelActionDAO;
-import com.redhat.rhn.manager.rhnset.RhnSetDecl;
import com.redhat.rhn.manager.ssm.SsmManager;
import com.redhat.rhn.manager.ssm.SsmOperationManager;
@@ -38,24 +37,6 @@ public class SsmChangeChannelSubscriptionsAction extends
AbstractDatabaseAction
User user = event.getUser();
Collection<ChannelActionDAO> changes = event.getChanges();
- // Parse and store the changes into RhnSets
- SsmManager.populateSsmChannelServerSets(user, changes);
-
- // Log the change operation
-
- /* Since the servers are in two separate sets, make explicit associations from
- those sets to the operation.
- */
- long operationId = SsmOperationManager.createOperation(user,
- "Channel Subscription Updates", null);
-
- SsmOperationManager.associateServersWithOperation(operationId, user.getId(),
- RhnSetDecl.SSM_CHANNEL_SUBSCRIBE.getLabel());
- SsmOperationManager.associateServersWithOperation(operationId, user.getId(),
- RhnSetDecl.SSM_CHANNEL_UNSUBSCRIBE.getLabel());
-
- // Do the changes
-
/* Anything after the operation is created should be in a try..finally to
attempt to prevent a hanging, perpetually in progress operation. This is
an added safety once a taskomatic task is created to automatically time out
@@ -66,7 +47,7 @@ public class SsmChangeChannelSubscriptionsAction extends
AbstractDatabaseAction
}
finally {
// Complete the action
- SsmOperationManager.completeOperation(user, operationId);
+ SsmOperationManager.completeOperation(user, event.getOpId());
}
}
}
diff --git
a/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsEvent.java
b/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsEvent.java
index 34e64c9..3076dd5 100644
---
a/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsEvent.java
+++
b/java/code/src/com/redhat/rhn/frontend/events/SsmChangeChannelSubscriptionsEvent.java
@@ -21,26 +21,28 @@ import com.redhat.rhn.frontend.action.channel.ssm.ChannelActionDAO;
import java.util.Collection;
/**
- * Event fired to carry the information necessary to perform subscription changes
- * for servers in the SSM.
+ * Event fired to carry the information necessary to perform subscription
+ * changes for servers in the SSM.
*
- * @see com.redhat.rhn.frontend.events.SsmChangeChannelSubscriptionsAction
+ * @see com.redhat.rhn.frontend.events.SsmChangeChannelSubscriptionsAction
* @version $Revision$
*/
public class SsmChangeChannelSubscriptionsEvent implements EventMessage {
private User user;
private Collection<ChannelActionDAO> changes;
+ private Long opId;
/**
* Creates a new SSM channel change event to fire across the message bus.
*
- * @param userIn user making the changes; cannot be <code>null</code>
+ * @param userIn user making the changes; cannot be <code>null</code>
* @param changesIn changes to make; cannot be <code>null</code>
+ * @param operationId the operation id
*/
public SsmChangeChannelSubscriptionsEvent(User userIn,
- Collection<ChannelActionDAO>
changesIn) {
-
+ Collection<ChannelActionDAO> changesIn, Long operationId) {
+
if (userIn == null) {
throw new IllegalArgumentException("user cannot be null");
}
@@ -48,9 +50,10 @@ public class SsmChangeChannelSubscriptionsEvent implements EventMessage
{
if (changesIn == null) {
throw new IllegalArgumentException("changes cannot be null");
}
-
+
this.user = userIn;
this.changes = changesIn;
+ this.opId = operationId;
}
/**
@@ -67,6 +70,13 @@ public class SsmChangeChannelSubscriptionsEvent implements EventMessage
{
return changes;
}
+ /**
+ * @return the op id
+ */
+ public Long getOpId() {
+ return opId;
+ }
+
/** {@inheritDoc} */
public String toText() {
return toString();
@@ -75,6 +85,6 @@ public class SsmChangeChannelSubscriptionsEvent implements EventMessage
{
/** {@inheritDoc} */
public String toString() {
return "SsmChannelSubscriptionsEvent[User: " + user.getLogin() +
- ", Change Count: " + changes.size() + "]";
+ ", Change Count: " + changes.size() + "]";
}
}
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 9b1bea6..3ca1797 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
@@ -8492,6 +8492,9 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="error.config.revnum.invalid">
<source>Please specify a valid revision number.</source>
</trans-unit>
+ <trans-unit id="ssm.subscription.operation.label">
+ <source>Channel Subscription Updates</source>
+ </trans-unit>
<trans-unit id="kickstart.cobbler.distro.syncfail">
<source>
The following is a list of errors gathered while Spacewalk attempts to