3 commits - java/code scripts/channel-to-update-level web/html web/modules
by Justin Sherrill
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 53 +++
java/code/src/com/redhat/rhn/domain/channel/Channel.java | 17 +
java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java | 58 +--
java/code/src/com/redhat/rhn/domain/errata/test/ErrataFactoryTest.java | 10
java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataAction.java | 97 ++++++
java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataPackagesAction.java | 148 ++++++++++
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 25 +
java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml | 8
java/code/src/com/redhat/rhn/frontend/taglibs/list/helper/ListSetHelper.java | 33 ++
java/code/src/com/redhat/rhn/manager/channel/ChannelEditor.java | 37 --
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 91 ++++++
java/code/src/com/redhat/rhn/manager/channel/test/ChannelManagerTest.java | 62 ++++
java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java | 16 +
java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java | 7
java/code/webapp/WEB-INF/nav/manage_channel.xml | 4
java/code/webapp/WEB-INF/pages/channel/manage/erratapackagesync.jsp | 80 +++++
java/code/webapp/WEB-INF/pages/channel/manage/erratasync.jsp | 110 +++++++
java/code/webapp/WEB-INF/struts-config.xml | 21 +
scripts/channel-to-update-level/create-channel-update | 4
web/html/nav/manage_channel.xml | 4
web/modules/pxt/PXT/Request.pm | 4
21 files changed, 820 insertions(+), 69 deletions(-)
New commits:
commit 120c37f03e2fde78cb07e4f532b9eaffb9179ce2
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Tue Jun 2 14:35:58 2009 -0400
435043 - adding errata sync page for syncing out of date errata (that have been updated by red hat)
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 78a3e84..6ad0a82 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -1185,4 +1185,57 @@ SELECT E.id, E.advisory, E.synopsis
</query>
</mode>
+
+
+<mode name="list_errata_needing_sync" class="com.redhat.rhn.frontend.dto.ErrataOverview">
+ <query params="cid, ocid">
+ select distinct E.id, E.advisory_name, E.advisory, E.advisory_type, E.synopsis as advisory_synopsis, E.update_date
+ from rhnChannelErrata CE inner join
+ rhnErrataPackage EP on CE.errata_id = EP.errata_id inner join
+ rhnErrataCloned EC on EC.original_id = CE.errata_id inner join
+ rhnChannelErrata CE2 on CE2.errata_id = EC.id inner join
+ rhnErrata E on E.id = EC.id
+ where CE.channel_id = :ocid --original
+ and CE2.channel_id = :cid --clone
+ and Ep.package_id in (select CP.package_id
+ from rhnChannelPackage CP
+ where
+ CP.channel_id = :ocid --original
+ and CP.package_id not in (select CP2.package_id
+ from rhnChannelPackage CP2
+ where CP2.channel_id = :cid)) --clone
+ </query>
+</mode>
+
+<mode name="list_packages_needing_sync_from_set" class="com.redhat.rhn.frontend.dto.PackageOverview">
+ <query params="set_label, ocid, cid">
+ select P.id id, PN.name || '-' || PE.version
+ || '-' || PE.release || (CASE WHEN PE.epoch IS NULL THEN '' ELSE ':' || PE.epoch END)
+ || '-' || PA.label nvrea,
+ P.summary
+ from rhnPackage P inner join
+ rhnPackageArch PA on P.package_arch_id = PA.id inner join
+ rhnPackageEVR PE on P.evr_id = PE.id inner join
+ rhnPackageName PN on PN.id = P.name_id inner join
+ rhnErrataPackage EP on EP.package_id = P.id inner join
+ rhnErrataCloned EC on EC.original_id = EP.errata_id inner join
+ rhnChannelPackage CP on CP.package_id = P.id
+ where CP.channel_id = :ocid
+ and EC.id in ( select element
+ from rhnSet S
+ where S.label = :set_label)
+ and P.id not in ( select CP2.package_id
+ from rhnChannelPackage CP2
+ where CP2.channel_id = :cid)
+ </query>
+</mode>
+
+<mode name="list_channel_errata_ids">
+ <query params="cid">
+ select CE.errata_id as id
+ from rhnChannelErrata CE
+ where CE.channel_id = :cid
+ </query>
+</mode>
+
</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/domain/channel/Channel.java b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
index 07ab885..cef2312 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/Channel.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/Channel.java
@@ -387,6 +387,7 @@ public class Channel extends BaseDomainHelper implements Comparable {
/**
* Adds a single package to the channel
* @param packageIn The package to add
+ * @deprecated
*/
public void addPackage(Package packageIn) {
if (!getChannelArch().isCompatible(packageIn.getPackageArch())) {
@@ -397,6 +398,22 @@ public class Channel extends BaseDomainHelper implements Comparable {
}
/**
+ * Adds a single package to the channel
+ * @param packageIn The package to add
+ * @param user the user doign the add
+ */
+ public void addPackage(Package packageIn, User user) {
+ if (!getChannelArch().isCompatible(packageIn.getPackageArch())) {
+ throw new IncompatibleArchException(packageIn.getPackageArch(),
+ getChannelArch());
+ }
+ List<Long> list = new ArrayList<Long>();
+ list.add(packageIn.getId());
+ ChannelManager.addPackages(this, list, user);
+ }
+
+
+ /**
* Removes a single package from the channel
* @param user the user doing the remove
* @param packageIn The package to remove
diff --git a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
index 0d6733a..d87966a 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/errata/ErrataFactory.java
@@ -204,7 +204,7 @@ public class ErrataFactory extends HibernateFactory {
published = ErrataFactory.createPublishedErrata();
}
- copyDetails(published, unpublished);
+ copyDetails(published, unpublished, false);
//Save the published Errata
save(published);
@@ -353,7 +353,7 @@ public class ErrataFactory extends HibernateFactory {
UnpublishedClonedErrata clone = new UnpublishedClonedErrata();
- copyDetails(clone, e);
+ copyDetails(clone, e, true);
clone.setAdvisoryName(clonedAdvisoryName);
clone.setAdvisory(clonedAdvisory);
@@ -368,11 +368,19 @@ public class ErrataFactory extends HibernateFactory {
* Helper method to copy the details for.
* @param copy The object to copy into.
* @param original The object to copy from.
+ * @param clone set to true if this is a cloned errata, and thus
+ * things like org or advisory name shouldn't be set
*/
- private static void copyDetails(Errata copy, Errata original) {
+ private static void copyDetails(Errata copy, Errata original, boolean clone) {
//Set the easy things first ;)
- copy.setAdvisory(original.getAdvisory());
+
+ if (!clone) {
+ copy.setAdvisory(original.getAdvisory());
+ copy.setAdvisoryName(original.getAdvisoryName());
+ copy.setOrg(original.getOrg());
+ }
+
copy.setAdvisoryType(original.getAdvisoryType());
copy.setProduct(original.getProduct());
copy.setDescription(original.getDescription());
@@ -383,11 +391,10 @@ public class ErrataFactory extends HibernateFactory {
copy.setUpdateDate(original.getUpdateDate());
copy.setNotes(original.getNotes());
copy.setRefersTo(original.getRefersTo());
- copy.setAdvisoryName(original.getAdvisoryName());
copy.setAdvisoryRel(original.getAdvisoryRel());
copy.setLocallyModified(original.getLocallyModified());
copy.setLastModified(original.getLastModified());
- copy.setOrg(original.getOrg());
+
/*
* Copy the packages
@@ -415,39 +422,16 @@ public class ErrataFactory extends HibernateFactory {
Iterator bugsItr = IteratorUtils.getIterator(original.getBugs());
while (bugsItr.hasNext()) {
Bug bugIn = (Bug) bugsItr.next();
- Bug clone;
+ Bug cloneB;
if (copy.isPublished()) { //we want published bugs
- clone = ErrataManager.createNewPublishedBug(bugIn.getId(),
+ cloneB = ErrataManager.createNewPublishedBug(bugIn.getId(),
bugIn.getSummary());
}
else { //we want unpublished bugs
- clone = ErrataManager.createNewUnpublishedBug(bugIn.getId(),
+ cloneB = ErrataManager.createNewUnpublishedBug(bugIn.getId(),
bugIn.getSummary());
}
- copy.addBug(clone);
- }
-
- /*
- * Copy the files using the same idea as the above bug copying
- */
- Iterator filesItr = IteratorUtils.getIterator(original.getFiles());
- while (filesItr.hasNext()) {
- ErrataFile fileIn = (ErrataFile) filesItr.next();
- ErrataFile clone;
- Set packages = new HashSet(fileIn.getPackages());
- if (copy.isPublished()) {
- clone = ErrataManager.createNewPublishedErrataFile(fileIn.getFileType(),
- fileIn.getChecksum(),
- fileIn.getFileName(),
- packages);
- }
- else {
- clone = ErrataManager.createNewUnpublishedErrataFile(fileIn.getFileType(),
- fileIn.getChecksum(),
- fileIn.getFileName(),
- packages);
- }
- copy.addFile(clone);
+ copy.addBug(cloneB);
}
}
@@ -1048,7 +1032,13 @@ public class ErrataFactory extends HibernateFactory {
}
-
+ /**
+ * Sync all the errata details from one errata to another
+ * @param cloned the cloned errata that needs syncing
+ */
+ public static void syncErrataDetails(PublishedClonedErrata cloned) {
+ copyDetails(cloned, cloned.getOriginal(), true);
+ }
}
diff --git a/java/code/src/com/redhat/rhn/domain/errata/test/ErrataFactoryTest.java b/java/code/src/com/redhat/rhn/domain/errata/test/ErrataFactoryTest.java
index 13e2fda..42988a6 100644
--- a/java/code/src/com/redhat/rhn/domain/errata/test/ErrataFactoryTest.java
+++ b/java/code/src/com/redhat/rhn/domain/errata/test/ErrataFactoryTest.java
@@ -270,7 +270,9 @@ public class ErrataFactoryTest extends BaseTestCaseWithUser {
private static void fillOutErrata(Errata e, Long orgId) throws Exception {
String name = "JAVA Test " + TestUtils.randomString();
- e.setOrg(OrgFactory.lookupById(orgId));
+ if (orgId != null) {
+ e.setOrg(OrgFactory.lookupById(orgId));
+ }
e.setAdvisory(name);
e.setAdvisoryType(ErrataFactory.ERRATA_TYPE_BUG);
e.setProduct("Red Hat Linux");
@@ -334,11 +336,7 @@ public class ErrataFactoryTest extends BaseTestCaseWithUser {
assertEquals(published.getLocallyModified(), clone.getLocallyModified());
assertEquals(clonedAdvisoryName, clone.getAdvisoryName());
assertEquals(clonedAdvisory, clone.getAdvisory());
-
- assertEquals(1, clone.getFiles().size());
- ErrataFile ef = (ErrataFile)clone.getFiles().iterator().next();
- assertEquals(1, ef.getPackages().size());
-
+
/* Create a 2nd clone and make sure that the cloning function
* does not create a clone whose name collides with the already
* existing clone
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataAction.java
new file mode 100644
index 0000000..88410bd
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataAction.java
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2009 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.action.channel.manage;
+
+import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.channel.InvalidChannelRoleException;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.manager.channel.ChannelManager;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * SyncErrataAction
+ * @version $Rev$
+ */
+public class SyncErrataAction extends RhnAction implements Listable {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+
+ RequestContext rc = new RequestContext(request);
+ User user = rc.getLoggedInUser();
+
+ Channel chan = ChannelManager.lookupByIdAndUser(
+ rc.getRequiredParam(RequestContext.CID), user);
+
+ try {
+ ChannelManager.verifyChannelAdmin(user, chan.getId());
+ }
+ catch (InvalidChannelRoleException e) {
+ addMessage(request, e.getMessage());
+ return mapping.findForward("default");
+ }
+
+ ListRhnSetHelper helper = new ListRhnSetHelper(this, request,
+ RhnSetDecl.ERRATA_TO_SYNC.createCustom(chan.getId()));
+
+ helper.execute();
+ if (helper.isDispatched()) {
+ Map params = new HashMap();
+ params.put(RequestContext.CID, chan.getId());
+ return getStrutsDelegate().forwardParams(mapping.findForward("submit"),
+ params);
+ }
+
+ request.setAttribute("channel_name", chan.getName());
+ request.setAttribute(RequestContext.CID, chan.getId());
+ return mapping.findForward("default");
+ }
+
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public List getResult(RequestContext context) {
+ User user = context.getLoggedInUser();
+ Channel chan = ChannelManager.lookupByIdAndUser(
+ context.getRequiredParam(RequestContext.CID), user);
+
+ return ChannelManager.listErrataNeedingResync(chan, user);
+ }
+
+
+}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataPackagesAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataPackagesAction.java
new file mode 100644
index 0000000..88b4234
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/SyncErrataPackagesAction.java
@@ -0,0 +1,148 @@
+/**
+ * Copyright (c) 2009 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.action.channel.manage;
+
+import com.redhat.rhn.domain.channel.Channel;
+import com.redhat.rhn.domain.channel.InvalidChannelRoleException;
+import com.redhat.rhn.domain.errata.Errata;
+import com.redhat.rhn.domain.errata.ErrataFactory;
+import com.redhat.rhn.domain.errata.impl.PublishedClonedErrata;
+import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.struts.RequestContext;
+import com.redhat.rhn.frontend.struts.RhnAction;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListRhnSetHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
+import com.redhat.rhn.manager.channel.ChannelEditor;
+import com.redhat.rhn.manager.channel.ChannelManager;
+import com.redhat.rhn.manager.errata.ErrataManager;
+import com.redhat.rhn.manager.rhnset.RhnSetDecl;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.apache.struts.action.ActionMessage;
+import org.apache.struts.action.ActionMessages;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * SyncErrataAction
+ * @version $Rev$
+ */
+public class SyncErrataPackagesAction extends RhnAction implements Listable {
+
+
+ private Logger log = Logger.getLogger(SyncErrataPackagesAction.class);
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm formIn,
+ HttpServletRequest request,
+ HttpServletResponse response) {
+
+ RequestContext rc = new RequestContext(request);
+ User user = rc.getLoggedInUser();
+
+ Channel chan = ChannelManager.lookupByIdAndUser(
+ rc.getRequiredParam(RequestContext.CID), user);
+
+ try {
+ ChannelManager.verifyChannelAdmin(user, chan.getId());
+ }
+ catch (InvalidChannelRoleException e) {
+ addMessage(request, e.getMessage());
+ return mapping.findForward("default");
+ }
+
+ RhnSetDecl pkgDecl = RhnSetDecl.ERRATA_PACKAGES_TO_SYNC.createCustom(chan.getId());
+
+ ListRhnSetHelper helper = new ListRhnSetHelper(this, request,
+ pkgDecl);
+
+ helper.setPreSelectAll(true);
+ helper.execute();
+
+ if (helper.isDispatched()) {
+
+ Set eSet = RhnSetDecl.ERRATA_TO_SYNC.createCustom(
+ chan.getId()).get(user).getElementValues();
+ Set pSet = pkgDecl.get(user).getElementValues();
+ syncErrata(eSet, pSet, chan, user);
+
+
+ ActionMessages msg = new ActionMessages();
+ String[] msgParams = {eSet.size() + "", pSet.size() + "", chan.getName()};
+ msg.add(ActionMessages.GLOBAL_MESSAGE,
+ new ActionMessage("channel.jsp.errata.sync.complete",
+ msgParams));
+ getStrutsDelegate().saveMessages(rc.getRequest(), msg);
+
+
+ Map params = new HashMap();
+ params.put(RequestContext.CID, chan.getId());
+ return getStrutsDelegate().forwardParams(mapping.findForward("submit"),
+ params);
+ }
+
+ request.setAttribute("channel_name", chan.getName());
+ request.setAttribute(RequestContext.CID, chan.getId());
+ return mapping.findForward("default");
+ }
+
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public List getResult(RequestContext context) {
+ User user = context.getLoggedInUser();
+ Channel chan = ChannelManager.lookupByIdAndUser(
+ context.getRequiredParam(RequestContext.CID), user);
+ String label = RhnSetDecl.ERRATA_TO_SYNC.createCustom(
+ chan.getId()).getLabel();
+
+ return ChannelManager.listErrataPackagesForResync(chan, user, label);
+ }
+
+
+ private void syncErrata(Collection<Long> eids, Collection<Long> pids,
+ Channel chan, User user) {
+
+ ChannelEditor.getInstance().addPackages(user, chan, pids);
+ for (Long eid : eids) {
+ Errata e = ErrataManager.lookupErrata(eid, user);
+ if (e.isPublished() && e.isCloned()) {
+ ErrataFactory.syncErrataDetails((PublishedClonedErrata) e);
+ }
+ else {
+ log.fatal("Tried to sync errata with id " + eid +
+ " But it was not published or was not cloned");
+ }
+ }
+
+ }
+
+}
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 2470475..a5a3751 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
@@ -21302,6 +21302,31 @@ given channel.</source>
<trans-unit id="actions.jsp.pickedup">
<source>Picked Up</source>
</trans-unit>
+ <trans-unit id="header.jsp.errata.sync">
+ <source>Sync Errata</source>
+ </trans-unit>
+ <trans-unit id="channel.jsp.errata.sync.message">
+ <source>The following errata were cloned from errata that have since been updated.
+ This page will allow you to syncronize your cloned errata to that of its original.</source>
+ </trans-unit>
+ <trans-unit id="channel.jsp.errata.sync.note">
+ <source>Packages that were omitted as part of the origianl cloning process will be included here.</source>
+ </trans-unit>
+ <trans-unit id="channel.jsp.errata.sync.listempty">
+ <source>No out of date errata were found.</source>
+ </trans-unit>
+ <trans-unit id="header.jsp.errata.sync.packagepush">
+ <source>Packages to Push</source>
+ </trans-unit>
+ <trans-unit id="channel.jsp.errata.sync.packages.message">
+ <source>The following packages will be pushed to this channel as part of the errata sync process. Please review this list and unselect any unwanted packages.</source>
+ </trans-unit>
+ <trans-unit id="channel.jsp.errata.sync.complete">
+ <source>Sucessfully syncronized {0} errata and pushed {1} packages to channel {2}.</source>
+ </trans-unit>
+
+
+
</body>
</file>
</xliff>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml
index 93f3b37..0722a3c 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/nav/StringResource_en_US.xml
@@ -1006,6 +1006,13 @@ http://www.oasis-open.org/committees/xliff/documents/xliff-core-1.1.xsd"
</context-group>
</trans-unit>
+ <trans-unit id="Sync">
+ <source>Sync</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/channels/manage/errata/SyncErrata.do</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="Organizations">
<source>Organizations</source>
<context-group name="ctx">
@@ -1013,6 +1020,7 @@ http://www.oasis-open.org/committees/xliff/documents/xliff-core-1.1.xsd"
</context-group>
</trans-unit>
+
<trans-unit id="Trusts">
<source>Trusts</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/helper/ListSetHelper.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/helper/ListSetHelper.java
index d6a8e8f..ed7d337 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/helper/ListSetHelper.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/helper/ListSetHelper.java
@@ -15,6 +15,7 @@
package com.redhat.rhn.frontend.taglibs.list.helper;
+import com.redhat.rhn.frontend.dto.BaseDto;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnHelper;
import com.redhat.rhn.frontend.struts.Selectable;
@@ -24,6 +25,7 @@ import com.redhat.rhn.frontend.taglibs.list.TagHelper;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -86,6 +88,7 @@ abstract class ListSetHelper extends ListHelper {
private boolean dispatched = false;
private boolean ignoreEmptySelection = false;
private boolean willClearSet = true;
+ private boolean preSelectAll = false;
private Set initSet = Collections.EMPTY_SET;
/**
@@ -138,8 +141,8 @@ abstract class ListSetHelper extends ListHelper {
if (!context.isSubmitted() && alphaBarPressed == null && willClearSet) {
clear();
add(getPreSelected());
- }
-
+ }
+
if (request.getParameter(RequestContext.DISPATCH) != null) {
// if its one of the Dispatch actions handle it..
update();
@@ -161,6 +164,16 @@ abstract class ListSetHelper extends ListHelper {
List dataSet = getDataSet();
+
+ if (!context.isSubmitted() && alphaBarPressed == null && preSelectAll) {
+ Set selSet = new HashSet();
+ for (BaseDto bdto : (List<BaseDto>) dataSet) {
+ selSet.add(bdto.getId());
+ }
+ add(selSet);
+ }
+
+
// if its a list action update the set and the selections
if (ListTagHelper.getListAction(getListName(), request) != null) {
execute(dataSet);
@@ -290,4 +303,20 @@ abstract class ListSetHelper extends ListHelper {
this.willClearSet = willClearSetIn;
}
+
+ /**
+ * @return Returns the preSelectAll.
+ */
+ public boolean isPreSelectAll() {
+ return preSelectAll;
+ }
+
+
+ /**
+ * @param preSelectAllIn The preSelectAll to set.
+ */
+ public void setPreSelectAll(boolean preSelectAllIn) {
+ this.preSelectAll = preSelectAllIn;
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelEditor.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelEditor.java
index 5b00f26..651ee8a 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelEditor.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelEditor.java
@@ -16,16 +16,15 @@ package com.redhat.rhn.manager.channel;
import com.redhat.rhn.common.db.datasource.CallableMode;
import com.redhat.rhn.common.db.datasource.ModeFactory;
-import com.redhat.rhn.common.hibernate.LookupException;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.security.PermissionException;
import com.redhat.rhn.domain.channel.Channel;
import com.redhat.rhn.domain.channel.ChannelFactory;
-import com.redhat.rhn.domain.rhnpackage.Package;
import com.redhat.rhn.domain.user.User;
-import com.redhat.rhn.manager.rhnpackage.PackageManager;
import com.redhat.rhn.manager.user.UserManager;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -57,7 +56,7 @@ public class ChannelEditor {
* @param channel The channel to add the packages to
* @param packageIds A list containing the ids of packages to add.
*/
- public void addPackages(User user, Channel channel, List packageIds) {
+ public void addPackages(User user, Channel channel, Collection packageIds) {
changePackages(user, channel, packageIds, true);
}
@@ -67,7 +66,7 @@ public class ChannelEditor {
* @param channel The channel to remove the packages from
* @param packageIds A list containing the ids of packages to remove.
*/
- public void removePackages(User user, Channel channel, List packageIds) {
+ public void removePackages(User user, Channel channel, Collection packageIds) {
changePackages(user, channel, packageIds, false);
}
@@ -76,7 +75,8 @@ public class ChannelEditor {
* @param add If true, we are adding the list of packages to the channel. Otherwise,
* remove the list of packages from the channel.
*/
- private void changePackages(User user, Channel channel, List packageIds, boolean add) {
+ private void changePackages(User user, Channel channel,
+ Collection packageIds, boolean add) {
//Make sure the person adding packages is a channel admin
if (!UserManager.verifyChannelAdmin(user, channel)) {
StringBuffer msg = new StringBuffer("User: ");
@@ -112,27 +112,18 @@ public class ChannelEditor {
}
}
+ List<Long> existingPids = ChannelFactory.getPackageIds(channel.getId());
+
//Loop through packages and add to channel.
for (Iterator itr = packageIds.iterator(); itr.hasNext();) {
Long pid = convertObjectToLong(itr.next());
- Package pkg = PackageManager.lookupByIdAndUser(pid, user);
- if (pkg != null) {
- if (add) {
- channel.addPackage(pkg);
- }
- else {
- channel.removePackage(pkg, user);
- }
+ List list = new ArrayList();
+ list.add(pid);
+ if (add && !existingPids.contains(pid)) {
+ ChannelManager.addPackages(channel, list, user);
}
- else {
- //throw a lookup exception
- LocalizationService ls = LocalizationService.getInstance();
- String msg = "The package: " + pid + " could not be found.";
- LookupException e = new LookupException(msg);
- e.setLocalizedTitle(ls.getMessage("lookup.jsp.title.package"));
- e.setLocalizedReason1(ls.getMessage("lookup.jsp.reason1.package"));
- e.setLocalizedReason2(ls.getMessage("lookup.jsp.reason2.package"));
- throw e;
+ else if (!add) {
+ ChannelManager.removePackages(channel, list, user);
}
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index f84a434..41433a2 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -32,6 +32,7 @@ import com.redhat.rhn.domain.channel.ChannelFactory;
import com.redhat.rhn.domain.channel.ChannelFamily;
import com.redhat.rhn.domain.channel.ChannelFamilyFactory;
import com.redhat.rhn.domain.channel.ChannelVersion;
+import com.redhat.rhn.domain.channel.ClonedChannel;
import com.redhat.rhn.domain.channel.DistChannelMap;
import com.redhat.rhn.domain.channel.InvalidChannelRoleException;
import com.redhat.rhn.domain.channel.ProductName;
@@ -2506,6 +2507,42 @@ public class ChannelManager extends BaseManager {
}
/**
+ * Remove packages from a channel very quickly
+ * @param chan the channel
+ * @param packageIds list of package ids
+ * @param user the user doing the removing
+ */
+ public static void addPackages(Channel chan, List<Long> packageIds, User user) {
+
+ if (!UserManager.verifyChannelAdmin(user, chan)) {
+ StringBuffer msg = new StringBuffer("User: ");
+ msg.append(user.getLogin());
+ msg.append(" does not have channel admin access to channel: ");
+ msg.append(chan.getLabel());
+
+ LocalizationService ls = LocalizationService.getInstance();
+ PermissionException pex = new PermissionException(msg.toString());
+ pex.setLocalizedTitle(ls.getMessage("permission.jsp.title.channel"));
+ pex.setLocalizedSummary(ls.getMessage("permission.jsp.summary.channel"));
+ throw pex;
+ }
+
+ Map params = new HashMap();
+ params.put("cid", chan.getId());
+
+ WriteMode m = ModeFactory.getWriteMode("Channel_queries", "add_channel_package");
+ for (Long pid : packageIds) {
+ params.put("pid", pid);
+ m.executeUpdate(params);
+ }
+
+
+ HibernateFactory.getSession().refresh(chan);
+
+ }
+
+
+ /**
* Remove a set of erratas from a channel
* and remove associated packages
* @param chan The channel to remove from
@@ -2553,4 +2590,58 @@ public class ChannelManager extends BaseManager {
return (List<PackageDto>) mode.execute(params);
}
+ /**
+ * List errata that is within a channel that needs to be resynced
+ * This is determined by the packages in the channel
+ *
+ * @param c the channel
+ * @param user the user
+ * @return list of errataOverview objects that need to be resynced
+ */
+ public static List listErrataNeedingResync(Channel c, User user) {
+ if (!user.hasRole(RoleFactory.CHANNEL_ADMIN)) {
+ throw new PermissionException(RoleFactory.CHANNEL_ADMIN);
+ }
+
+ if (c.isCloned()) {
+ Map params = new HashMap();
+ params.put("cid", c.getId());
+ ClonedChannel cc = (ClonedChannel) c;
+ params.put("ocid", cc.getOriginal().getId());
+ SelectMode m = ModeFactory.getMode("Errata_queries",
+ "list_errata_needing_sync");
+ return m.execute(params);
+ }
+ else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ /**
+ * List errata packages that need to be resynced
+ * @param c the channel to look for packages in
+ * @param user the user doing it
+ * @param setLabel the set of errata to base the package off of
+ * @return the list of PackageOverview objects
+ */
+ public static List listErrataPackagesForResync(Channel c, User user, String setLabel) {
+ if (!user.hasRole(RoleFactory.CHANNEL_ADMIN)) {
+ throw new PermissionException(RoleFactory.CHANNEL_ADMIN);
+ }
+
+ if (c.isCloned()) {
+ Map params = new HashMap();
+ params.put("cid", c.getId());
+ params.put("set_label", setLabel);
+ ClonedChannel cc = (ClonedChannel) c;
+ params.put("ocid", cc.getOriginal().getId());
+ SelectMode m = ModeFactory.getMode("Errata_queries",
+ "list_packages_needing_sync_from_set");
+ return m.execute(params);
+ }
+ else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/test/ChannelManagerTest.java b/java/code/src/com/redhat/rhn/manager/channel/test/ChannelManagerTest.java
index 4f52632..7818c97 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/test/ChannelManagerTest.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/test/ChannelManagerTest.java
@@ -39,6 +39,7 @@ import com.redhat.rhn.domain.server.ServerFactory;
import com.redhat.rhn.domain.server.VirtualInstance;
import com.redhat.rhn.domain.server.test.ServerFactoryTest;
import com.redhat.rhn.domain.user.User;
+import com.redhat.rhn.frontend.action.user.AdminUserEditAction;
import com.redhat.rhn.frontend.dto.ChannelOverview;
import com.redhat.rhn.frontend.dto.ErrataOverview;
import com.redhat.rhn.frontend.dto.EssentialChannelDto;
@@ -49,6 +50,7 @@ import com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException;
import com.redhat.rhn.manager.channel.ChannelEntitlementCounter;
import com.redhat.rhn.manager.channel.ChannelManager;
import com.redhat.rhn.manager.entitlement.EntitlementManager;
+import com.redhat.rhn.manager.errata.ErrataManager;
import com.redhat.rhn.manager.rhnpackage.test.PackageManagerTest;
import com.redhat.rhn.manager.rhnset.RhnSetDecl;
import com.redhat.rhn.manager.rhnset.RhnSetManager;
@@ -747,4 +749,64 @@ public class ChannelManagerTest extends BaseTestCaseWithUser {
}
+
+ public void testListErrataNeedingResync() throws Exception {
+
+ user.addRole(RoleFactory.CHANNEL_ADMIN);
+
+ Channel ochan = ChannelFactoryTest.createTestChannel();
+ Channel cchan = ChannelFactoryTest.createTestClonedChannel(ochan, user);
+
+ Errata oe = ErrataFactoryTest.createTestErrata(null);
+ ochan.addErrata(oe);
+
+ List list = new ArrayList();
+ list.add(cchan.getId());
+
+ Errata ce = ErrataManager.createClone(user, oe);
+ ce = ErrataManager.publish(ce, list, user);
+
+ Package testPackage = PackageTest.createTestPackage();
+ oe.addPackage(testPackage);
+ ochan.addPackage(testPackage);
+
+ List<ErrataOverview> result = ChannelManager.listErrataNeedingResync(cchan, user);
+ assertTrue(result.size() == 1);
+ assertEquals(result.get(0).getId(), ce.getId());
+
+ }
+
+ public void testListErrataPackagesForResync() throws Exception {
+
+ user.addRole(RoleFactory.CHANNEL_ADMIN);
+
+ Channel ochan = ChannelFactoryTest.createTestChannel();
+ Channel cchan = ChannelFactoryTest.createTestClonedChannel(ochan, user);
+
+ Errata oe = ErrataFactoryTest.createTestErrata(null);
+ ochan.addErrata(oe);
+
+ List list = new ArrayList();
+ list.add(cchan.getId());
+
+ Errata ce = ErrataManager.createClone(user, oe);
+ ce = ErrataManager.publish(ce, list, user);
+
+ Package testPackage = PackageTest.createTestPackage();
+ oe.addPackage(testPackage);
+ ochan.addPackage(testPackage);
+
+ RhnSet set = RhnSetDecl.ERRATA_TO_SYNC.get(user);
+ set.clear();
+ set.add(ce.getId());
+ RhnSetManager.store(set);
+
+ List<PackageOverview> result = ChannelManager.listErrataPackagesForResync(cchan, user, set.getLabel());
+ assertTrue(result.size() == 1);
+
+ assertEquals(result.get(0).getId(), testPackage.getId());
+
+ }
+
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
index 2535b63..2f757e0 100644
--- a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
+++ b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
@@ -31,6 +31,7 @@ import com.redhat.rhn.domain.errata.Errata;
import com.redhat.rhn.domain.errata.ErrataFactory;
import com.redhat.rhn.domain.errata.ErrataFile;
import com.redhat.rhn.domain.errata.ErrataFileType;
+import com.redhat.rhn.domain.errata.impl.PublishedClonedErrata;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.rhnset.RhnSet;
import com.redhat.rhn.domain.role.RoleFactory;
@@ -1237,4 +1238,19 @@ public class ErrataManager extends BaseManager {
return flag;
}
+
+ /**
+ * resync an errata, including all it's details
+ * doesn't actually push any packages to a channel
+ * @param cloned the cloned errata needing resyncing
+ * @param user the user doign the syncing
+ */
+ public static void reSyncErrata(PublishedClonedErrata cloned, User user) {
+ if (!user.hasRole(RoleFactory.CHANNEL_ADMIN)) {
+ throw new PermissionException(RoleFactory.CHANNEL_ADMIN);
+ }
+ ErrataFactory.syncErrataDetails(cloned);
+ }
+
+
}
diff --git a/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java b/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
index d1cd5fb..a151135 100644
--- a/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
+++ b/java/code/src/com/redhat/rhn/manager/rhnset/RhnSetDecl.java
@@ -81,6 +81,13 @@ public class RhnSetDecl {
public static final RhnSetDecl ERRATA_TO_DELETE_BULK = make("errata_to_delete_bulk",
SetCleanup.UNOWNED_ERRATA);
+ // set of errata by errata_id; needs new cleanup
+ public static final RhnSetDecl ERRATA_TO_SYNC = make("errata_to_sync",
+ SetCleanup.UNOWNED_ERRATA);
+
+ public static final RhnSetDecl ERRATA_PACKAGES_TO_SYNC = make("errata_packages_to_sync",
+ SetCleanup.UNOWNED_PACKAGES);
+
// set of file list: needs new cleanup
public static final RhnSetDecl FILE_LISTS = make("file_lists",
SetCleanup.UNOWNED_FILE_LIST);
diff --git a/java/code/webapp/WEB-INF/nav/manage_channel.xml b/java/code/webapp/WEB-INF/nav/manage_channel.xml
index ae6cc40..acdb4cd 100644
--- a/java/code/webapp/WEB-INF/nav/manage_channel.xml
+++ b/java/code/webapp/WEB-INF/nav/manage_channel.xml
@@ -29,6 +29,10 @@
<rhn-tab-url>/network/software/channels/manage/errata/clone.pxt?pxt:trap=rhn:empty_set&set_label=errata_clone_actions</rhn-tab-url>
<rhn-tab-url>/network/software/channels/manage/errata/clone_confirm.pxt</rhn-tab-url>
</rhn-tab>
+ <rhn-tab name="Sync" acl="channel_is_clone();user_role(channel_admin);">
+ <rhn-tab-url>/rhn/channels/manage/errata/SyncErrata.do</rhn-tab-url>
+ <rhn-tab-url>/rhn/channels/manage/errata/ConfirmSyncPackages.do</rhn-tab-url>
+ </rhn-tab>
</rhn-tab>
<rhn-tab name="Packages" acl="channel_exists()" node-id="remove_channel_packages">
<rhn-tab-url>/rhn/channels/manage/ChannelPackageMenu.do</rhn-tab-url>
diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/erratapackagesync.jsp b/java/code/webapp/WEB-INF/pages/channel/manage/erratapackagesync.jsp
new file mode 100644
index 0000000..6a82188
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/channel/manage/erratapackagesync.jsp
@@ -0,0 +1,80 @@
+<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
+
+<html:xhtml/>
+<html>
+<head>
+ <meta name="page-decorator" content="none" />
+</head>
+<body>
+
+<html:messages id="message" message="true">
+ <rhn:messages><c:out escapeXml="false" value="${message}" /></rhn:messages>
+</html:messages>
+
+<html:messages id="message" message="true">
+ <rhn:messages><c:out escapeXml="false" value="${message}" /></rhn:messages>
+</html:messages>
+
+ <%@ include file="/WEB-INF/pages/common/fragments/channel/manage/manage_channel_header.jspf" %>
+<BR>
+
+<h2><img src="/img/rhn-icon-packages.gif"> <bean:message key="header.jsp.errata.sync.packagepush"/></h2>
+
+ <bean:message key="channel.jsp.errata.sync.packages.message"/>
+
+<rl:listset name="packageSet" legend="system-group">
+
+<input type="hidden" name="cid" value="${cid}" />
+
+ <rl:list
+ decorator="SelectableDecorator"
+ emptykey="package.jsp.emptylist"
+ alphabarcolumn="nvrea"
+ filter="com.redhat.rhn.frontend.taglibs.list.filters.PackageFilter" >
+
+
+ <rl:decorator name="PageSizeDecorator"/>
+
+ <rl:selectablecolumn value="${current.id}"
+ selected="${current.selected}"
+ disabled="${not current.selectable}"
+ styleclass="first-column"/>
+
+
+
+ <rl:column sortable="true"
+ bound="false"
+ headerkey="download.jsp.package"
+ sortattr="nvrea"
+ defaultsort="asc"
+ >
+
+ <a href="/rhn/software/packages/Details.do?pid=${current.id}">${current.nvrea}</a>
+ </rl:column>
+
+
+ <rl:column sortable="false"
+ bound="false"
+ headerkey="packagesearch.jsp.summary"
+ styleclass="last-column"
+ >
+ ${current.summary}
+ </rl:column>
+ </rl:list>
+
+ <div align="right">
+ <hr />
+ <input type="submit" name="dispatch"
+ value="<bean:message key="confirm"/>" />
+ </div>
+ <rhn:submitted/>
+
+
+</rl:listset>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/java/code/webapp/WEB-INF/pages/channel/manage/erratasync.jsp b/java/code/webapp/WEB-INF/pages/channel/manage/erratasync.jsp
new file mode 100644
index 0000000..089d675
--- /dev/null
+++ b/java/code/webapp/WEB-INF/pages/channel/manage/erratasync.jsp
@@ -0,0 +1,110 @@
+<%@ taglib uri="http://rhn.redhat.com/rhn" prefix="rhn" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://rhn.redhat.com/tags/list" prefix="rl" %>
+
+<html:xhtml/>
+<html>
+<head>
+ <meta name="page-decorator" content="none" />
+</head>
+<body>
+
+<html:messages id="message" message="true">
+ <rhn:messages><c:out escapeXml="false" value="${message}" /></rhn:messages>
+</html:messages>
+
+
+
+ <%@ include file="/WEB-INF/pages/common/fragments/channel/manage/manage_channel_header.jspf" %>
+ <h2>
+ <img src="/img/rhn-icon-errata.gif" alt="erratum" /> <bean:message key="header.jsp.errata.sync"/>
+ </h2>
+
+ <bean:message key="channel.jsp.errata.sync.message"/>
+
+ <rl:listset name="errata_list_set">
+ <input type="hidden" name="cid" value="${cid}">
+
+ <rl:list
+ decorator="SelectableDecorator"
+ emptykey="channel.jsp.errata.sync.listempty"
+ alphabarcolumn="advisorySynopsis" >
+
+ <rl:decorator name="ElaborationDecorator"/>
+ <rl:decorator name="PageSizeDecorator"/>
+
+ <rl:selectablecolumn value="${current.selectionKey}"
+ selected="${current.selected}"
+ styleclass="first-column"/>
+
+
+
+
+
+ <rl:column sortable="true"
+ bound="false"
+ headerkey="erratalist.jsp.type"
+ headerclass="thin-column"
+ sortattr="advisoryType">
+ <c:if test="${current.advisoryType == 'Product Enhancement Advisory'}">
+ <img src="/img/wrh-product.gif" alt="Product Enhancement Advisory" title="Product Enhancement Advisory" />
+ </c:if>
+ <c:if test="${current.advisoryType == 'Security Advisory'}">
+ <img src="/img/wrh-product.gif" alt="Product Enhancement Advisory" title="Product Enhancement Advisory" />
+ </c:if>
+ <c:if test="${current.advisoryType == 'Bug Fix Advisory'}">
+ <img src="/img/wrh-bug.gif" alt="Bug Fix Advisory" title="Bug Fix Advisory" />
+ </c:if>
+
+ </rl:column>
+
+
+ <rl:column sortable="true"
+ bound="false"
+ headerkey="erratalist.jsp.advisory"
+ sortattr="advisory"
+ >
+
+ <a href="/rhn/errata/manage/Edit.do?eid=${current.id}">${current.advisoryName}</a>
+ </rl:column>
+
+
+ <rl:column sortable="false"
+ bound="false"
+ filterattr="advisorySynopsis"
+ headerkey="erratalist.jsp.synopsis"
+ >
+ ${current.advisorySynopsis}
+ </rl:column>
+
+
+ <rl:column sortable="true"
+ bound="false"
+ headerkey="erratalist.jsp.updated"
+ styleclass="last-column"
+ sortattr="updateDateObj"
+ defaultsort="desc"
+ >
+ ${current.updateDate}
+ </rl:column>
+
+
+ </rl:list>
+
+
+ <rhn:tooltip key="channel.jsp.errata.sync.note"/>
+
+ <p align="right">
+ <input type="submit" name="dispatch" value="<bean:message key="header.jsp.errata.sync"/>">
+ </p>
+ <rhn:submitted/>
+
+
+</rl:listset>
+
+
+</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 31c416e..1b8023b 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -6169,6 +6169,27 @@
<forward name="default" path="/channels/manage/errata/Add.do" />
</action>
+
+ <action path="/channels/manage/errata/SyncErrata"
+ scope="request"
+ input="/WEB-INF/pages/channel/manage/erratasync.jsp"
+ type="com.redhat.rhn.frontend.action.channel.manage.SyncErrataAction"
+ className="com.redhat.rhn.frontend.struts.RhnActionMapping">
+ <forward name="default" path="/WEB-INF/pages/channel/manage/erratasync.jsp" />
+ <forward name="submit" path="/channels/manage/errata/ConfirmSyncPackages.do" redirect="true"/>
+ </action>
+
+ <action path="/channels/manage/errata/ConfirmSyncPackages"
+ scope="request"
+ input="/WEB-INF/pages/channel/manage/erratapackagesync.jsp"
+ type="com.redhat.rhn.frontend.action.channel.manage.SyncErrataPackagesAction"
+ className="com.redhat.rhn.frontend.struts.RhnActionMapping">
+ <forward name="default" path="/WEB-INF/pages/channel/manage/erratapackagesync.jsp" />
+ <forward name="submit" path="/channels/manage/errata/SyncErrata.do" redirect="true"/>
+ </action>
+
+
+
<action path="/channels/manage/errata/Errata"
scope="request"
type="com.redhat.rhn.frontend.action.channel.manage.ErrataIndexAction"
diff --git a/web/html/nav/manage_channel.xml b/web/html/nav/manage_channel.xml
index 97d2a8f..cb764a4 100644
--- a/web/html/nav/manage_channel.xml
+++ b/web/html/nav/manage_channel.xml
@@ -26,6 +26,10 @@
<rhn-tab-url>/network/software/channels/manage/errata/clone.pxt</rhn-tab-url>
<rhn-tab-url>/network/software/channels/manage/errata/clone_confirm.pxt</rhn-tab-url>
</rhn-tab>
+ <rhn-tab name="Sync" acl="channel_is_clone();user_role(channel_admin);" node-id="sync_errata">
+ <rhn-tab-url>/rhn/channels/manage/errata/SyncErrata.do</rhn-tab-url>
+ <rhn-tab-url>/rhn/channels/manage/errata/ConfirmSyncPackages.do</rhn-tab-url>
+ </rhn-tab>
</rhn-tab>
<rhn-tab name="Packages" acl="channel_exists()">
<rhn-tab-url>/rhn/channels/manage/ChannelPackageMenu.do</rhn-tab-url>
commit f3f25b5bd528e2c0bb290b2423e1dedc92f9971b
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Tue Jun 2 14:25:22 2009 -0400
small fix to channel-to-update so it doesnt ignore bundle size
diff --git a/scripts/channel-to-update-level/create-channel-update b/scripts/channel-to-update-level/create-channel-update
index a3a0d98..606f620 100755
--- a/scripts/channel-to-update-level/create-channel-update
+++ b/scripts/channel-to-update-level/create-channel-update
@@ -49,14 +49,14 @@ def main():
gather(hasOpt("C", "clear"))
exit(0)
- global server, user, password, filename, ssl
+ global server, user, password, filename, ssl, bundleSize
server = getOpt("s", "server", msg = "--server not provided")
user = getOpt("l", "user", "--user not provided")
password = getOpt("p", "password")
if password == None:
password = getpass.getpass()
if (getOpt("b", "bundle") is not None):
- bundleSize == int(getOpt("b", "bundle"))
+ bundleSize = int(getOpt("b", "bundle"))
#did you provide a data file? If not we need all the information
if not hasOpt("D", "data"):
commit b89fcdb834dbe8b68967788152561a3ccf720c7f
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Fri May 29 15:45:24 2009 -0400
501784 - fixed issue with timed out logins that required cookie deletion to log in again
issue resolved around the fact that we are no longer setting the domain in the java stack, but still was in the perl coupled with the fact the expire time on the perl side was using the config value session_cookie_lifetime which was not set, resulting in a cookie that would only expire when the browser was closed
diff --git a/web/modules/pxt/PXT/Request.pm b/web/modules/pxt/PXT/Request.pm
index dd66184..3855b09 100644
--- a/web/modules/pxt/PXT/Request.pm
+++ b/web/modules/pxt/PXT/Request.pm
@@ -456,8 +456,8 @@ sub cookie_jar {
my $session_cookie = new Apache2::Cookie $self->{apr},
-name => $self->session_cookie_name,
-value => $self->session->key,
- #-domain => PXT::Config->get("base_domain"),
- # Don't set the cookie's domain, as it will cause issues since we aren't setting it in the java stack
+ #-domain => PXT::Config->get("base_domain"),
+ # Don't set the cookie's domain, as it will cause issues since we aren't setting it in the java stack
@expire,
@secure,
-path => "/";
14 years, 11 months
satellite/install
by Devan Goodwin
satellite/install/install.pl | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 0530358fae431007a25697ec6210478033414502
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Tue Jun 2 15:39:39 2009 -0300
502958 - Use up2date in installer if on RHEL 4 that has yum installed.
diff --git a/satellite/install/install.pl b/satellite/install/install.pl
index 1c88b4c..f91f7dc 100755
--- a/satellite/install/install.pl
+++ b/satellite/install/install.pl
@@ -73,6 +73,17 @@ Spacewalk::Setup::upgrade_stop_services(\%opts);
remove_obsoleted_packages(\%opts);
my $have_yum = ( -f '/usr/bin/yum' ? 1 : 0 );
+if ($have_yum) {
+ # If we have yum available but are on RHEL 4, stick with up2date:
+ # NOTE: Even if the system has no redhat-release (i.e. Fedora) this regex
+ # will simply not match.
+ my $redhat_release = `rpm -q --qf='%{VERSION}' redhat-release`;
+ if ($redhat_release =~ /^4.*/) {
+ $have_yum = 0;
+ print loc("Warning: Found yum on RHEL 4, using up2date instead.\n");
+ }
+}
+
my $run_updater;
if (defined $opts{'run-updater'}) {
14 years, 11 months
Branch 'VADER' - satellite/install
by Devan Goodwin
satellite/install/install.pl | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 449a348a7b1fc42055d894ff1fa1fe2f74408b56
Author: Devan Goodwin <dgoodwin(a)redhat.com>
Date: Tue Jun 2 15:39:39 2009 -0300
502958 - Use up2date in installer if on RHEL 4 that has yum installed.
diff --git a/satellite/install/install.pl b/satellite/install/install.pl
index 1c88b4c..f91f7dc 100755
--- a/satellite/install/install.pl
+++ b/satellite/install/install.pl
@@ -73,6 +73,17 @@ Spacewalk::Setup::upgrade_stop_services(\%opts);
remove_obsoleted_packages(\%opts);
my $have_yum = ( -f '/usr/bin/yum' ? 1 : 0 );
+if ($have_yum) {
+ # If we have yum available but are on RHEL 4, stick with up2date:
+ # NOTE: Even if the system has no redhat-release (i.e. Fedora) this regex
+ # will simply not match.
+ my $redhat_release = `rpm -q --qf='%{VERSION}' redhat-release`;
+ if ($redhat_release =~ /^4.*/) {
+ $have_yum = 0;
+ print loc("Warning: Found yum on RHEL 4, using up2date instead.\n");
+ }
+}
+
my $run_updater;
if (defined $opts{'run-updater'}) {
14 years, 11 months
java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 1e0d5f0d8b326aff7030001c23a05ac4e9233595
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Jun 2 12:58:50 2009 -0400
502646 - Fixed list tag filter issue hitting the enter key in IE
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
index 1f3fbce..46c83d5 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
@@ -46,6 +46,9 @@ import com.redhat.rhn.frontend.struts.RequestContext;
* @version $Rev $
*/
public class ListTagUtil {
+ private static final String IE_MAGIC_SNIPPET = "<!--[if IE]><input type=\"text\" " +
+ "style=\"display: none;\" disabled=\"disabled\" size=\"1\" /><![endif]-->";
+
private ListTagUtil() {
}
@@ -628,7 +631,8 @@ public class ListTagUtil {
ListTagUtil.write(pageContext, filterValue);
}
ListTagUtil.write(pageContext, "\" />");
-
+
+ ListTagUtil.write(pageContext, IE_MAGIC_SNIPPET);
ListTagUtil.write(pageContext,
" <input type=\"submit\"" + "name=\"" +
filterName + "\"" + "value=\"" +
14 years, 11 months
Branch 'VADER' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit 6d69ff325f616d3ce832575681eaed08b9f1fab1
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Jun 2 12:58:50 2009 -0400
502646 - Fixed list tag filter issue hitting the enter key in IE
diff --git a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
index 1f3fbce..46c83d5 100644
--- a/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
+++ b/java/code/src/com/redhat/rhn/frontend/taglibs/list/ListTagUtil.java
@@ -46,6 +46,9 @@ import com.redhat.rhn.frontend.struts.RequestContext;
* @version $Rev $
*/
public class ListTagUtil {
+ private static final String IE_MAGIC_SNIPPET = "<!--[if IE]><input type=\"text\" " +
+ "style=\"display: none;\" disabled=\"disabled\" size=\"1\" /><![endif]-->";
+
private ListTagUtil() {
}
@@ -628,7 +631,8 @@ public class ListTagUtil {
ListTagUtil.write(pageContext, filterValue);
}
ListTagUtil.write(pageContext, "\" />");
-
+
+ ListTagUtil.write(pageContext, IE_MAGIC_SNIPPET);
ListTagUtil.write(pageContext,
" <input type=\"submit\"" + "name=\"" +
filterName + "\"" + "value=\"" +
14 years, 11 months
Branch 'VADER' - java/buildconf java/code web/conf
by Brad Buckingham
java/buildconf/apidoc/html/macros.txt | 5
java/buildconf/apidoc/jsp/macros.txt | 5
java/buildconf/apidoc/singlepage/macros.txt | 79 +++
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 10
java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml | 61 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java | 239 +++++++++-
java/code/src/com/redhat/rhn/manager/action/ActionManager.java | 65 ++
web/conf/rhn_web.conf | 2
8 files changed, 458 insertions(+), 8 deletions(-)
New commits:
commit 4bbcadff178a8ee783be7c6be15a9a7e090c5888
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Tue Jun 2 12:30:16 2009 -0400
501224 - api - enhance system.listSystemEvents to include more detail on events executed
Currently, when a user looks at the event history in the UI, they see
more information than they can currently obtain with the API.
For example,
- for a package action (e.g. install/remove/upgrade/verify)
- user can see the pkgs that were involved in the event
- for an errata update
- user can see the advisory name & synopsis
- for a config file deploy/upload
- user can see the file name and possibly revision info
- for a config file compare/diff
- user can see the files compared and the differences found
The above information is not returned in the API; therefore, enhancing the
system.listSystemEvents to include an optional 'additional_info' array
that will include this information when it is available.
One thing to note is that these details are stored in different tables
depending on the action that was executed. As a result, we have to
perform different queries depending on the action type; therefore, rather
than use a basic serializer, the api handler itself will gather the results
and populate the data to be returned.
diff --git a/java/buildconf/apidoc/html/macros.txt b/java/buildconf/apidoc/html/macros.txt
index 87c3b8b..f7a70d2 100644
--- a/java/buildconf/apidoc/html/macros.txt
+++ b/java/buildconf/apidoc/html/macros.txt
@@ -22,6 +22,11 @@
<ul>
<li>
#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
#macro(prop_array_end)
</li>
</ul>
diff --git a/java/buildconf/apidoc/jsp/macros.txt b/java/buildconf/apidoc/jsp/macros.txt
index 87c3b8b..f7a70d2 100644
--- a/java/buildconf/apidoc/jsp/macros.txt
+++ b/java/buildconf/apidoc/jsp/macros.txt
@@ -22,6 +22,11 @@
<ul>
<li>
#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
#macro(prop_array_end)
</li>
</ul>
diff --git a/java/buildconf/apidoc/singlepage/macros.txt b/java/buildconf/apidoc/singlepage/macros.txt
new file mode 100644
index 0000000..f7a70d2
--- /dev/null
+++ b/java/buildconf/apidoc/singlepage/macros.txt
@@ -0,0 +1,79 @@
+
+#set($date="dateTime.iso8601")
+
+#macro( serializer $serializer )
+ <li> $serializer </li>
+#end
+#macro( prop $type $value )
+ <li> $type "$value"</li>
+#end
+#macro( prop_desc $type $value $desc )
+ <li> $type "$value" - $desc </li>
+#end
+#macro(prop_array $key $type $desc)
+ <li>array "$key"
+ <ul>
+ <li>$type $desc</li>
+ </ul>
+ </li>
+#end
+#macro(prop_array_begin $key)
+ <li>array "$key"
+ <ul>
+ <li>
+#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
+#macro(prop_array_end)
+ </li>
+ </ul>
+ </li>
+#end
+#macro( struct $type )
+ struct - $type
+ <ul>
+#end
+#macro( struct_end )
+ </ul>
+#end
+#macro( array)
+array:
+ <ul>
+ <li>
+#end
+#macro(array_end)
+</li></ul>
+#end
+#macro(array_single $type $desc)
+array:
+<ul>
+ <li>$type - $desc</li>
+</ul>
+#end
+#macro(options)
+ <ul>
+#end
+#macro(item $item)
+ <li>$item</li>
+#end
+#macro(item_desc $item, $desc)
+ <li>$item - $desc</li>
+#end
+#macro(options_end)
+ </ul>
+#end
+#macro(param $type $value)
+ $type $value
+#end
+#macro(param_desc $type $value $desc)
+ $type $value - $desc
+#end
+#macro(session_key)
+ #param("string", "sessionKey")
+#end
+#macro(return_int_success)
+ int - 1 on success, exception thrown otherwise.
+#end
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 6f8915f..78a3e84 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -1175,6 +1175,14 @@ SELECT 1
</query>
</mode>
-
+<mode name="errata_associated_with_action">
+ <query params="aid">
+SELECT E.id, E.advisory, E.synopsis
+ FROM rhnErrata E,
+ rhnActionErrataUpdate AEU
+ WHERE E.id = AEU.errata_id
+ AND AEU.action_id = :aid
+ </query>
+</mode>
</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
index 6ea33fb..256a68c 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
@@ -2152,6 +2152,67 @@ SELECT CC.id, CR.revision AS config_revision,
</elaborator>
</mode>
+<mode name="upload_action_status">
+ <query params="aid">
+SELECT CFN.path,
+ CFF.name AS FAILURE_REASON
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnActionConfigFileName ACFN
+ WHERE ACFN.action_id = :aid
+ AND ACFN.config_file_name_id = CFN.id
+ AND ACFN.failure_id = CFF.id (+)
+ORDER BY CFN.path
+ </query>
+</mode>
+
+<mode name="config_action_revisions">
+ <query params="aid">
+SELECT CFN.path,
+ CR.id,
+ CR.revision,
+ ACR.id AS ACTION_REVISION_ID,
+ CFF.name AS FAILURE_REASON
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnConfigFile CF,
+ rhnConfigRevision CR,
+ rhnActionConfigRevision ACR
+ WHERE ACR.action_id = :aid
+ AND ACR.config_revision_id = CR.id
+ AND CR.config_file_id = CF.id
+ AND CF.config_file_name_id = CFN.id
+ AND ACR.failure_id = CFF.id (+)
+ORDER BY UPPER(CFN.path)
+ </query>
+</mode>
+
+<mode name="diff_action_revisions">
+ <query params="aid">
+SELECT CFN.path,
+ CR.id,
+ CR.id AS REVISION_ID,
+ CR.revision,
+ ACR.id AS ACTION_REVISION_ID,
+ CFF.name AS FAILURE_REASON,
+ ACRR.result AS DIFF,
+ rhn_config_channel.action_diff_revision_status(ACR.id) AS STATUS
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnConfigFile CF,
+ rhnConfigRevision CR,
+ rhnActionConfigRevision ACR,
+ rhnActionConfigRevisionResult ACRR
+ WHERE ACR.action_id = :aid
+ AND ACR.config_revision_id = CR.id
+ AND CR.config_file_id = CF.id
+ AND CF.config_file_name_id = CFN.id
+ AND ACRR.action_config_revision_id = ACR.id
+ AND ACR.failure_id = CFF.id (+)
+ORDER BY UPPER(CFN.path)
+ </query>
+</mode>
+
<callable-mode name="create_new_config_channel">
<query params="org_id_in, type_in, name_in, label_in, description_in">
{:channelId = call rhn_config.insert_channel( :org_id_in, :type_in, :name_in, :label_in, :description_in)}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
index aa5a3ab..ed29fd5 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
@@ -16,6 +16,7 @@ package com.redhat.rhn.frontend.xmlrpc.system;
import java.net.URI;
import java.net.URISyntaxException;
+import java.sql.Blob;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -35,6 +36,7 @@ import com.redhat.rhn.FaultException;
import com.redhat.rhn.common.client.ClientCertificate;
import com.redhat.rhn.common.conf.Config;
import com.redhat.rhn.common.db.datasource.DataResult;
+import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.hibernate.LookupException;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.validator.ValidatorError;
@@ -1645,26 +1647,251 @@ public class SystemHandler extends BaseHandler {
* @param sessionKey The sessionKey containing the logged in user
* @param sid The id of the server you are wanting to lookup
* @return Returns an array of maps representing a system
- * @since 10.3
+ * @since 10.8
*
- * @xmlrpc.doc List all system events for given server. This is *all* events for the
- * server since it was registered. This may require the caller to
+ * @xmlrpc.doc List all system events for given server. This includes *all* events
+ * for the server since it was registered. This may require the caller to
* filter the results to fetch the specific events they are looking for.
*
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.param #param("int", "serverId") - ID of system.
* @xmlrpc.returntype
* #array()
- * $ServerActionSerializer
+ * #struct("action")
+ * #prop_desc("int", "failed_count", "Number of times action failed.")
+ * #prop_desc("string", "modified", "Date modified. (Deprecated by
+ * modified_date)")
+ * #prop_desc($date, "modified_date", "Date modified.")
+ * #prop_desc("string", "created", "Date created. (Deprecated by
+ * created_date)")
+ * #prop_desc($date, "created_date", "Date created.")
+ * #prop("string", "action_type")
+ * #prop_desc("int", "successful_count",
+ * "Number of times action was successful.")
+ * #prop_desc("string", "earliest_action", "Earliest date this action
+ * will occur.")
+ * #prop_desc("int", "archived", "If this action is archived. (1 or 0)")
+ * #prop("string", "scheduler_user")
+ * #prop_desc("string", "prerequisite", "Pre-requisite action. (optional)")
+ * #prop_desc("string", "name", "Name of this action.")
+ * #prop_desc("int", "id", "Id of this action.")
+ * #prop_desc("string", "version", "Version of action.")
+ * #prop_desc("string", "completion_time", "The date/time the event was
+ * completed. Format ->YYYY-MM-dd hh:mm:ss.ms
+ * Eg ->2007-06-04 13:58:13.0. (optional)
+ * (Deprecated by completed_date)")
+ * #prop_desc($date, "completed_date", "The date/time the event was completed.
+ * (optional)")
+ * #prop_desc("string", "pickup_time", "The date/time the action was picked
+ * up. Format ->YYYY-MM-dd hh:mm:ss.ms
+ * Eg ->2007-06-04 13:58:13.0. (optional)
+ * (Deprecated by pickup_date)")
+ * #prop_desc($date, "pickup_date", "The date/time the action was picked up.
+ * (optional)")
+ * #prop_desc("string", "result_msg", "The result string after the action
+ * executes at the client machine. (optional)")
+ * #prop_array_begin_desc("additional_info", "This array contains additional
+ * information for the event, if available.")
+ * #struct("info")
+ * #prop_desc("string", "detail", "The detail provided depends on the
+ * specific event. For example, for a package event, this will be the
+ * package name, for an errata event, this will be the advisory name
+ * and synopsis, for a config file event, this will be path and
+ * optional revision information...etc.")
+ * #prop_desc("string", "result", "The result (if included) depends
+ * on the specific event. For example, for a package or errata event,
+ * no result is included, for a config file event, the result might
+ * include an error (if one occurred, such as the file was missing)
+ * or in the case of a config file comparison it might include the
+ * differenes found.")
+ * #struct_end()
+ * #prop_array_end()
+ * #struct_end()
* #array_end()
*/
- public List<ServerAction> listSystemEvents(String sessionKey, Integer sid) {
+ public List listSystemEvents(String sessionKey, Integer sid) {
+
List retval = new LinkedList();
// Get the logged in user and server
User loggedInUser = getLoggedInUser(sessionKey);
Server server = lookupServer(loggedInUser, sid);
- return ActionFactory.listServerActionsForServer(server);
+ List<ServerAction> sActions = ActionFactory.listServerActionsForServer(server);
+
+ // In order to support bug 501224, this method is being updated to populate
+ // the result vs having the serializer do so. The reason is that in order to
+ // support this bug, we want to be able to return some additional detail for the
+ // various events in the system history; however, those details are stored in
+ // different database tables depending upon the event type. This includes
+ // information like, the specific errata applied, pkgs installed/removed/
+ // upgraded/verified, config files uploaded, deployed or compared...etc.
+
+ List<Map> results = new ArrayList<Map>();
+ for (ServerAction sAction : sActions) {
+
+ Map result = new HashMap();
+
+ Action action = sAction.getParentAction();
+
+ if (action.getFailedCount() != null) {
+ result.put("failed_count", action.getFailedCount());
+ }
+ if (action.getActionType().getName() != null) {
+ result.put("action_type", action.getActionType().getName());
+ }
+ if (action.getSuccessfulCount() != null) {
+ result.put("successful_count", action.getSuccessfulCount());
+ }
+ if (action.getEarliestAction() != null) {
+ result.put("earliest_action", action.getEarliestAction().toString());
+ }
+ if (action.getArchived() != null) {
+ result.put("archived", action.getArchived());
+ }
+ if (action.getSchedulerUser().getLogin() != null) {
+ result.put("scheduler_user", action.getSchedulerUser().getLogin());
+ }
+ if (action.getPrerequisite() != null) {
+ result.put("prerequisite", action.getPrerequisite());
+ }
+ if (action.getName() != null) {
+ result.put("name", action.getName());
+ }
+ if (action.getId() != null) {
+ result.put("id", action.getId());
+ }
+ if (action.getVersion() != null) {
+ result.put("version", action.getVersion().toString());
+ }
+
+ if (sAction.getCompletionTime() != null) {
+ result.put("completion_time", sAction.getCompletionTime().toString());
+ }
+ if (sAction.getPickupTime() != null) {
+ result.put("pickup_time", sAction.getPickupTime().toString());
+ }
+ if (sAction.getModified() != null) {
+ result.put("modified", sAction.getModified().toString());
+ result.put("modified_date", sAction.getModified());
+ }
+ if (sAction.getCreated() != null) {
+ result.put("created", sAction.getCreated().toString());
+ result.put("created_date", sAction.getCreated());
+ }
+ if (sAction.getCompletionTime() != null) {
+ result.put("completed_date", sAction.getCompletionTime());
+ }
+ if (sAction.getPickupTime() != null) {
+ result.put("pickup_date", sAction.getPickupTime());
+ }
+ if (sAction.getResultMsg() != null) {
+ result.put("result_msg", sAction.getResultMsg());
+ }
+
+ // depending on the event type, we need to retrieve additional information
+ // and store that information in the result
+ ActionType type = action.getActionType();
+ List<Map<String, String>> additionalInfo = new ArrayList<Map<String, String>>();
+
+ if (type.equals(ActionFactory.TYPE_PACKAGES_REMOVE) ||
+ type.equals(ActionFactory.TYPE_PACKAGES_UPDATE) ||
+ type.equals(ActionFactory.TYPE_PACKAGES_VERIFY)) {
+
+ // retrieve the list of package names associated with the action...
+
+ DataResult pkgs = ActionManager.getPackageList(action.getId(), null);
+ for (Iterator itr = pkgs.iterator(); itr.hasNext();) {
+ Map pkg = (Map) itr.next();
+ String detail = (String) pkg.get("nvre");
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", detail);
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_ERRATA)) {
+
+ // retrieve the errata that were associated with the action...
+ DataResult errata = ActionManager.getErrataList(action.getId());
+ for (Iterator itr = errata.iterator(); itr.hasNext();) {
+ Map erratum = (Map) itr.next();
+ String detail = (String) erratum.get("advisory");
+ detail += " (" + (String) erratum.get("synopsis") + ")";
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", detail);
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_UPLOAD) ||
+ type.equals(ActionFactory.TYPE_CONFIGFILES_MTIME_UPLOAD)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileUploadList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", (String) file.get("path"));
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_DEPLOY)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileDeployList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ String path = (String) file.get("path");
+ path += " (rev. " + (Long) file.get("revision") + ")";
+ info.put("detail", path);
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_DIFF)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileDiffList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ String path = (String) file.get("path");
+ path += " (rev. " + (Long) file.get("revision") + ")";
+ info.put("detail", path);
+
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ else {
+ // if there wasn't an error, check to see if there was a difference
+ // detected...
+ Blob blob = (Blob) file.get("diff");
+ if (blob != null) {
+ String diff = HibernateFactory.blobToString(blob);
+ info.put("result", diff);
+ }
+ }
+ additionalInfo.add(info);
+ }
+ }
+ if (additionalInfo.size() > 0) {
+ result.put("additional_info", additionalInfo);
+ }
+ results.add(result);
+ }
+ return results;
}
/**
diff --git a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
index 612c3b4..c8c3de5 100644
--- a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
+++ b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
@@ -763,6 +763,71 @@ public class ActionManager extends BaseManager {
dr.setTotalSize(dr.size());
return dr;
}
+
+ /**
+ * Returns the list of errata associated with a specific action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the errata for the action.
+ */
+ public static DataResult getErrataList(Long aid) {
+ SelectMode m = ModeFactory.getMode("Errata_queries",
+ "errata_associated_with_action");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file upload action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the errata for the action.
+ */
+ public static DataResult getConfigFileUploadList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "upload_action_status");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file deploy action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the details for the action.
+ */
+ public static DataResult getConfigFileDeployList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "config_action_revisions");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file diff action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the details for the action.
+ */
+ public static DataResult getConfigFileDiffList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "diff_action_revisions");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
/**
* Retrieves the systems that have completed a given action
diff --git a/web/conf/rhn_web.conf b/web/conf/rhn_web.conf
index c6d86de..a9a640d 100644
--- a/web/conf/rhn_web.conf
+++ b/web/conf/rhn_web.conf
@@ -228,7 +228,7 @@ web.config_delim_end = |}
web.version = 0.5
# the version of API
-web.apiversion = 10.7
+web.apiversion = 10.8
# maximum size for a config file
web.maximum_config_file_size = 131072
14 years, 11 months
java/buildconf java/code web/conf
by Brad Buckingham
java/buildconf/apidoc/html/macros.txt | 5
java/buildconf/apidoc/jsp/macros.txt | 5
java/buildconf/apidoc/singlepage/macros.txt | 5
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 10
java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml | 61 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java | 239 +++++++++-
java/code/src/com/redhat/rhn/manager/action/ActionManager.java | 65 ++
web/conf/rhn_web.conf | 2
8 files changed, 384 insertions(+), 8 deletions(-)
New commits:
commit 6d4d83165ec00d7ca8b7c57b5698687687d06090
Author: Brad Buckingham <bbuckingham(a)redhat.com>
Date: Tue Jun 2 12:30:16 2009 -0400
501224 - api - enhance system.listSystemEvents to include more detail on events executed
Currently, when a user looks at the event history in the UI, they see
more information than they can currently obtain with the API.
For example,
- for a package action (e.g. install/remove/upgrade/verify)
- user can see the pkgs that were involved in the event
- for an errata update
- user can see the advisory name & synopsis
- for a config file deploy/upload
- user can see the file name and possibly revision info
- for a config file compare/diff
- user can see the files compared and the differences found
The above information is not returned in the API; therefore, enhancing the
system.listSystemEvents to include an optional 'additional_info' array
that will include this information when it is available.
One thing to note is that these details are stored in different tables
depending on the action that was executed. As a result, we have to
perform different queries depending on the action type; therefore, rather
than use a basic serializer, the api handler itself will gather the results
and populate the data to be returned.
diff --git a/java/buildconf/apidoc/html/macros.txt b/java/buildconf/apidoc/html/macros.txt
index 87c3b8b..f7a70d2 100644
--- a/java/buildconf/apidoc/html/macros.txt
+++ b/java/buildconf/apidoc/html/macros.txt
@@ -22,6 +22,11 @@
<ul>
<li>
#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
#macro(prop_array_end)
</li>
</ul>
diff --git a/java/buildconf/apidoc/jsp/macros.txt b/java/buildconf/apidoc/jsp/macros.txt
index 87c3b8b..f7a70d2 100644
--- a/java/buildconf/apidoc/jsp/macros.txt
+++ b/java/buildconf/apidoc/jsp/macros.txt
@@ -22,6 +22,11 @@
<ul>
<li>
#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
#macro(prop_array_end)
</li>
</ul>
diff --git a/java/buildconf/apidoc/singlepage/macros.txt b/java/buildconf/apidoc/singlepage/macros.txt
index 87c3b8b..f7a70d2 100644
--- a/java/buildconf/apidoc/singlepage/macros.txt
+++ b/java/buildconf/apidoc/singlepage/macros.txt
@@ -22,6 +22,11 @@
<ul>
<li>
#end
+#macro(prop_array_begin_desc $key $desc)
+ <li>array "$key" - $desc
+ <ul>
+ <li>
+#end
#macro(prop_array_end)
</li>
</ul>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 6f8915f..78a3e84 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -1175,6 +1175,14 @@ SELECT 1
</query>
</mode>
-
+<mode name="errata_associated_with_action">
+ <query params="aid">
+SELECT E.id, E.advisory, E.synopsis
+ FROM rhnErrata E,
+ rhnActionErrataUpdate AEU
+ WHERE E.id = AEU.errata_id
+ AND AEU.action_id = :aid
+ </query>
+</mode>
</datasource_modes>
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
index 6ea33fb..256a68c 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
@@ -2152,6 +2152,67 @@ SELECT CC.id, CR.revision AS config_revision,
</elaborator>
</mode>
+<mode name="upload_action_status">
+ <query params="aid">
+SELECT CFN.path,
+ CFF.name AS FAILURE_REASON
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnActionConfigFileName ACFN
+ WHERE ACFN.action_id = :aid
+ AND ACFN.config_file_name_id = CFN.id
+ AND ACFN.failure_id = CFF.id (+)
+ORDER BY CFN.path
+ </query>
+</mode>
+
+<mode name="config_action_revisions">
+ <query params="aid">
+SELECT CFN.path,
+ CR.id,
+ CR.revision,
+ ACR.id AS ACTION_REVISION_ID,
+ CFF.name AS FAILURE_REASON
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnConfigFile CF,
+ rhnConfigRevision CR,
+ rhnActionConfigRevision ACR
+ WHERE ACR.action_id = :aid
+ AND ACR.config_revision_id = CR.id
+ AND CR.config_file_id = CF.id
+ AND CF.config_file_name_id = CFN.id
+ AND ACR.failure_id = CFF.id (+)
+ORDER BY UPPER(CFN.path)
+ </query>
+</mode>
+
+<mode name="diff_action_revisions">
+ <query params="aid">
+SELECT CFN.path,
+ CR.id,
+ CR.id AS REVISION_ID,
+ CR.revision,
+ ACR.id AS ACTION_REVISION_ID,
+ CFF.name AS FAILURE_REASON,
+ ACRR.result AS DIFF,
+ rhn_config_channel.action_diff_revision_status(ACR.id) AS STATUS
+ FROM rhnConfigFileFailure CFF,
+ rhnConfigFileName CFN,
+ rhnConfigFile CF,
+ rhnConfigRevision CR,
+ rhnActionConfigRevision ACR,
+ rhnActionConfigRevisionResult ACRR
+ WHERE ACR.action_id = :aid
+ AND ACR.config_revision_id = CR.id
+ AND CR.config_file_id = CF.id
+ AND CF.config_file_name_id = CFN.id
+ AND ACRR.action_config_revision_id = ACR.id
+ AND ACR.failure_id = CFF.id (+)
+ORDER BY UPPER(CFN.path)
+ </query>
+</mode>
+
<callable-mode name="create_new_config_channel">
<query params="org_id_in, type_in, name_in, label_in, description_in">
{:channelId = call rhn_config.insert_channel( :org_id_in, :type_in, :name_in, :label_in, :description_in)}
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
index aa5a3ab..ed29fd5 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java
@@ -16,6 +16,7 @@ package com.redhat.rhn.frontend.xmlrpc.system;
import java.net.URI;
import java.net.URISyntaxException;
+import java.sql.Blob;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -35,6 +36,7 @@ import com.redhat.rhn.FaultException;
import com.redhat.rhn.common.client.ClientCertificate;
import com.redhat.rhn.common.conf.Config;
import com.redhat.rhn.common.db.datasource.DataResult;
+import com.redhat.rhn.common.hibernate.HibernateFactory;
import com.redhat.rhn.common.hibernate.LookupException;
import com.redhat.rhn.common.localization.LocalizationService;
import com.redhat.rhn.common.validator.ValidatorError;
@@ -1645,26 +1647,251 @@ public class SystemHandler extends BaseHandler {
* @param sessionKey The sessionKey containing the logged in user
* @param sid The id of the server you are wanting to lookup
* @return Returns an array of maps representing a system
- * @since 10.3
+ * @since 10.8
*
- * @xmlrpc.doc List all system events for given server. This is *all* events for the
- * server since it was registered. This may require the caller to
+ * @xmlrpc.doc List all system events for given server. This includes *all* events
+ * for the server since it was registered. This may require the caller to
* filter the results to fetch the specific events they are looking for.
*
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.param #param("int", "serverId") - ID of system.
* @xmlrpc.returntype
* #array()
- * $ServerActionSerializer
+ * #struct("action")
+ * #prop_desc("int", "failed_count", "Number of times action failed.")
+ * #prop_desc("string", "modified", "Date modified. (Deprecated by
+ * modified_date)")
+ * #prop_desc($date, "modified_date", "Date modified.")
+ * #prop_desc("string", "created", "Date created. (Deprecated by
+ * created_date)")
+ * #prop_desc($date, "created_date", "Date created.")
+ * #prop("string", "action_type")
+ * #prop_desc("int", "successful_count",
+ * "Number of times action was successful.")
+ * #prop_desc("string", "earliest_action", "Earliest date this action
+ * will occur.")
+ * #prop_desc("int", "archived", "If this action is archived. (1 or 0)")
+ * #prop("string", "scheduler_user")
+ * #prop_desc("string", "prerequisite", "Pre-requisite action. (optional)")
+ * #prop_desc("string", "name", "Name of this action.")
+ * #prop_desc("int", "id", "Id of this action.")
+ * #prop_desc("string", "version", "Version of action.")
+ * #prop_desc("string", "completion_time", "The date/time the event was
+ * completed. Format ->YYYY-MM-dd hh:mm:ss.ms
+ * Eg ->2007-06-04 13:58:13.0. (optional)
+ * (Deprecated by completed_date)")
+ * #prop_desc($date, "completed_date", "The date/time the event was completed.
+ * (optional)")
+ * #prop_desc("string", "pickup_time", "The date/time the action was picked
+ * up. Format ->YYYY-MM-dd hh:mm:ss.ms
+ * Eg ->2007-06-04 13:58:13.0. (optional)
+ * (Deprecated by pickup_date)")
+ * #prop_desc($date, "pickup_date", "The date/time the action was picked up.
+ * (optional)")
+ * #prop_desc("string", "result_msg", "The result string after the action
+ * executes at the client machine. (optional)")
+ * #prop_array_begin_desc("additional_info", "This array contains additional
+ * information for the event, if available.")
+ * #struct("info")
+ * #prop_desc("string", "detail", "The detail provided depends on the
+ * specific event. For example, for a package event, this will be the
+ * package name, for an errata event, this will be the advisory name
+ * and synopsis, for a config file event, this will be path and
+ * optional revision information...etc.")
+ * #prop_desc("string", "result", "The result (if included) depends
+ * on the specific event. For example, for a package or errata event,
+ * no result is included, for a config file event, the result might
+ * include an error (if one occurred, such as the file was missing)
+ * or in the case of a config file comparison it might include the
+ * differenes found.")
+ * #struct_end()
+ * #prop_array_end()
+ * #struct_end()
* #array_end()
*/
- public List<ServerAction> listSystemEvents(String sessionKey, Integer sid) {
+ public List listSystemEvents(String sessionKey, Integer sid) {
+
List retval = new LinkedList();
// Get the logged in user and server
User loggedInUser = getLoggedInUser(sessionKey);
Server server = lookupServer(loggedInUser, sid);
- return ActionFactory.listServerActionsForServer(server);
+ List<ServerAction> sActions = ActionFactory.listServerActionsForServer(server);
+
+ // In order to support bug 501224, this method is being updated to populate
+ // the result vs having the serializer do so. The reason is that in order to
+ // support this bug, we want to be able to return some additional detail for the
+ // various events in the system history; however, those details are stored in
+ // different database tables depending upon the event type. This includes
+ // information like, the specific errata applied, pkgs installed/removed/
+ // upgraded/verified, config files uploaded, deployed or compared...etc.
+
+ List<Map> results = new ArrayList<Map>();
+ for (ServerAction sAction : sActions) {
+
+ Map result = new HashMap();
+
+ Action action = sAction.getParentAction();
+
+ if (action.getFailedCount() != null) {
+ result.put("failed_count", action.getFailedCount());
+ }
+ if (action.getActionType().getName() != null) {
+ result.put("action_type", action.getActionType().getName());
+ }
+ if (action.getSuccessfulCount() != null) {
+ result.put("successful_count", action.getSuccessfulCount());
+ }
+ if (action.getEarliestAction() != null) {
+ result.put("earliest_action", action.getEarliestAction().toString());
+ }
+ if (action.getArchived() != null) {
+ result.put("archived", action.getArchived());
+ }
+ if (action.getSchedulerUser().getLogin() != null) {
+ result.put("scheduler_user", action.getSchedulerUser().getLogin());
+ }
+ if (action.getPrerequisite() != null) {
+ result.put("prerequisite", action.getPrerequisite());
+ }
+ if (action.getName() != null) {
+ result.put("name", action.getName());
+ }
+ if (action.getId() != null) {
+ result.put("id", action.getId());
+ }
+ if (action.getVersion() != null) {
+ result.put("version", action.getVersion().toString());
+ }
+
+ if (sAction.getCompletionTime() != null) {
+ result.put("completion_time", sAction.getCompletionTime().toString());
+ }
+ if (sAction.getPickupTime() != null) {
+ result.put("pickup_time", sAction.getPickupTime().toString());
+ }
+ if (sAction.getModified() != null) {
+ result.put("modified", sAction.getModified().toString());
+ result.put("modified_date", sAction.getModified());
+ }
+ if (sAction.getCreated() != null) {
+ result.put("created", sAction.getCreated().toString());
+ result.put("created_date", sAction.getCreated());
+ }
+ if (sAction.getCompletionTime() != null) {
+ result.put("completed_date", sAction.getCompletionTime());
+ }
+ if (sAction.getPickupTime() != null) {
+ result.put("pickup_date", sAction.getPickupTime());
+ }
+ if (sAction.getResultMsg() != null) {
+ result.put("result_msg", sAction.getResultMsg());
+ }
+
+ // depending on the event type, we need to retrieve additional information
+ // and store that information in the result
+ ActionType type = action.getActionType();
+ List<Map<String, String>> additionalInfo = new ArrayList<Map<String, String>>();
+
+ if (type.equals(ActionFactory.TYPE_PACKAGES_REMOVE) ||
+ type.equals(ActionFactory.TYPE_PACKAGES_UPDATE) ||
+ type.equals(ActionFactory.TYPE_PACKAGES_VERIFY)) {
+
+ // retrieve the list of package names associated with the action...
+
+ DataResult pkgs = ActionManager.getPackageList(action.getId(), null);
+ for (Iterator itr = pkgs.iterator(); itr.hasNext();) {
+ Map pkg = (Map) itr.next();
+ String detail = (String) pkg.get("nvre");
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", detail);
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_ERRATA)) {
+
+ // retrieve the errata that were associated with the action...
+ DataResult errata = ActionManager.getErrataList(action.getId());
+ for (Iterator itr = errata.iterator(); itr.hasNext();) {
+ Map erratum = (Map) itr.next();
+ String detail = (String) erratum.get("advisory");
+ detail += " (" + (String) erratum.get("synopsis") + ")";
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", detail);
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_UPLOAD) ||
+ type.equals(ActionFactory.TYPE_CONFIGFILES_MTIME_UPLOAD)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileUploadList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ info.put("detail", (String) file.get("path"));
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_DEPLOY)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileDeployList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ String path = (String) file.get("path");
+ path += " (rev. " + (Long) file.get("revision") + ")";
+ info.put("detail", path);
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ additionalInfo.add(info);
+ }
+ }
+ else if (type.equals(ActionFactory.TYPE_CONFIGFILES_DIFF)) {
+
+ // retrieve the details associated with the action...
+ DataResult files = ActionManager.getConfigFileDiffList(action.getId());
+ for (Iterator itr = files.iterator(); itr.hasNext();) {
+ Map file = (Map) itr.next();
+
+ Map<String, String> info = new HashMap<String, String>();
+ String path = (String) file.get("path");
+ path += " (rev. " + (Long) file.get("revision") + ")";
+ info.put("detail", path);
+
+ String error = (String) file.get("failure_reason");
+ if (error != null) {
+ info.put("result", error);
+ }
+ else {
+ // if there wasn't an error, check to see if there was a difference
+ // detected...
+ Blob blob = (Blob) file.get("diff");
+ if (blob != null) {
+ String diff = HibernateFactory.blobToString(blob);
+ info.put("result", diff);
+ }
+ }
+ additionalInfo.add(info);
+ }
+ }
+ if (additionalInfo.size() > 0) {
+ result.put("additional_info", additionalInfo);
+ }
+ results.add(result);
+ }
+ return results;
}
/**
diff --git a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
index 612c3b4..c8c3de5 100644
--- a/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
+++ b/java/code/src/com/redhat/rhn/manager/action/ActionManager.java
@@ -763,6 +763,71 @@ public class ActionManager extends BaseManager {
dr.setTotalSize(dr.size());
return dr;
}
+
+ /**
+ * Returns the list of errata associated with a specific action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the errata for the action.
+ */
+ public static DataResult getErrataList(Long aid) {
+ SelectMode m = ModeFactory.getMode("Errata_queries",
+ "errata_associated_with_action");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file upload action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the errata for the action.
+ */
+ public static DataResult getConfigFileUploadList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "upload_action_status");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file deploy action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the details for the action.
+ */
+ public static DataResult getConfigFileDeployList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "config_action_revisions");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
+
+ /**
+ * Returns the list of details associated with a config file diff action.
+ * @param aid The action id for the action in question
+ * @return Return a list containing the details for the action.
+ */
+ public static DataResult getConfigFileDiffList(Long aid) {
+ SelectMode m = ModeFactory.getMode("config_queries", "diff_action_revisions");
+
+ Map params = new HashMap();
+ params.put("aid", aid);
+
+ DataResult dr = m.execute(params);
+ dr.setTotalSize(dr.size());
+ return dr;
+ }
/**
* Retrieves the systems that have completed a given action
diff --git a/web/conf/rhn_web.conf b/web/conf/rhn_web.conf
index c6d86de..a9a640d 100644
--- a/web/conf/rhn_web.conf
+++ b/web/conf/rhn_web.conf
@@ -228,7 +228,7 @@ web.config_delim_end = |}
web.version = 0.5
# the version of API
-web.apiversion = 10.7
+web.apiversion = 10.8
# maximum size for a config file
web.maximum_config_file_size = 131072
14 years, 11 months
Branch 'VADER' - selinux/spacewalk-monitoring-selinux
by Milan Zazrivec
selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 8958e335989206ece036eced9c98c4e33899fde6
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Tue Jun 2 18:09:20 2009 +0200
spacewalk_monitoring_conf_t for /etc/NOCpulse.ini
/etc/NOCpulse.ini would get etc_t after filesystem relabel
without a permanent labeling rule.
diff --git a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
index e4ad3d1..81cfab9 100644
--- a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
+++ b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
@@ -11,6 +11,7 @@
/var/run/SysVStep\..* gen_context(system_u:object_r:spacewalk_monitoring_var_run_t,s0)
/etc/notification(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_conf_t,s0)
+/etc/NOCpulse\.ini gen_context(system_u:object_r:spacewalk_monitoring_conf_t,s0)
/var/lib/nocpulse(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_var_lib_t,s0)
/var/lib/notification(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_var_lib_t,s0)
14 years, 11 months
selinux/spacewalk-monitoring-selinux
by Milan Zazrivec
selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc | 1 +
1 file changed, 1 insertion(+)
New commits:
commit 6f686d2b9d273df52ba010948e12956a7e3f75fb
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Tue Jun 2 18:09:20 2009 +0200
spacewalk_monitoring_conf_t for /etc/NOCpulse.ini
/etc/NOCpulse.ini would get etc_t after filesystem relabel
without a permanent labeling rule.
diff --git a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
index e4ad3d1..81cfab9 100644
--- a/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
+++ b/selinux/spacewalk-monitoring-selinux/spacewalk-monitoring.fc
@@ -11,6 +11,7 @@
/var/run/SysVStep\..* gen_context(system_u:object_r:spacewalk_monitoring_var_run_t,s0)
/etc/notification(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_conf_t,s0)
+/etc/NOCpulse\.ini gen_context(system_u:object_r:spacewalk_monitoring_conf_t,s0)
/var/lib/nocpulse(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_var_lib_t,s0)
/var/lib/notification(/.*)? gen_context(system_u:object_r:spacewalk_monitoring_var_lib_t,s0)
14 years, 11 months
web/html
by Shannon Hughes
web/html/errors/error.html | 134 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 134 insertions(+)
New commits:
commit 57e516e99ec40ba4662b195757348f5de1aad018
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Tue Jun 2 11:33:42 2009 -0400
500709 - static html for non session error pages
diff --git a/web/html/errors/error.html b/web/html/errors/error.html
new file mode 100644
index 0000000..265323c
--- /dev/null
+++ b/web/html/errors/error.html
@@ -0,0 +1,134 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"><head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <title>Error</title>
+ <link rel="shortcut icon" href="/img/favicon.ico">
+ <link rel="stylesheet" href="/css/rhn-base.css" type="text/css">
+ <!--[if IE]>
+ <link rel="stylesheet" type="text/css" href="/css/rhn-iecompat.css" />
+ <![endif]-->
+ <script src="/javascript/prototype-1.js"></script>
+
+
+
+ </head><body><div class="wrap" id="top-wrap">
+
+
+
+
+
+
+<div id="utility">
+ <div id="utilityLinks">
+<p id="linx"><span class="hide"><strong>Shortcuts:</strong> </span><a href="http://kbase.redhat.com/">Knowledgebase</a> <span class="navPipe">|</span> <a href="https://scooby.rdu.redhat.com/help">Documentation</a></p>
+ </div>
+ <div id="utilityAccount">
+
+ </div>
+
+</div>
+
+<div id="header">
+ <a href="/"><img src="/img/logo.png" id="rhnLogo" height="52" width="228"></a>
+ <div id="searchbar">
+ <div id="searchbarinner">
+ <form name="form1" action="/rhn/Search.do" method="get">
+ <select name="search_type">
+
+ <option value="systems">Systems</option>
+
+ <option value="packages">Packages</option>
+ <option value="errata">Errata</option>
+ <option value="docs">Documentation</option>
+ </select><input name="search_string" maxlength="40" size="20" type="text">
+
+ <input name="submitted" value="true" type="hidden">
+ <input class="button" name="image-1" value="Search" type="submit" align="top"></form>
+ </div>
+ </div>
+</div>
+
+<div id="navWrap">
+<div id="mainNavWrap">
+
+
+<ul>
+<li id="mainFirst-active"><a href="/">Sign In</a></li>
+
+<li id="mainLast"><a href="/help/about.pxt" class="mainLastLink">About</a></li>
+</ul>
+</div><!-- end mainNavWrap -->
+</div><!-- end navWrap -->
+
+
+
+
+
+
+
+
+<div id="bar">
+
+<div id="systembar">
+<div id="systembarinner">
+
+
+
+
+
+
+<div>
+
+</div>
+
+
+</div>
+</div>
+
+</div>
+<!-- close bar -->
+
+
+
+
+ </div>
+ <div class="wrap" id="bottom-wrap">
+ <div id="content">
+ <table width="100%" cellspacing="0">
+ <tbody><tr>
+ <td class="sidebar">
+
+
+<div id="sidenavp"><ul></ul>
+</div>
+
+ </td>
+ <td class="page-content" width="100%">
+
+
+ <h1>Page Error</h1>
+ <p>Error requesting page. Some possible causes of this problem:</p>
+
+ <ol>
+ <li>Page no longer exists</li>
+ <li>Page permission issue</li>
+ <li>You are doing something naughty</li>
+ </ol>
+
+ <p>Cookie support required. Note: cookies are <strong>not</strong> used
+ for marketing purposes; we use them strictly to keep track
+ of your login state and other state data absolutely
+ necessary for the proper functioning of your account.</p>
+
+ </td>
+ </tr>
+ </tbody></table>
+
+ <div id="footer">
+ Copyright © 2002-08 Red Hat, Inc. All rights reserved. <a href="https://www.redhat.com/legal/privacy_statement.html">Privacy statement</a> : <a href="http://www.redhat.com/legal/legal_statement.html">Legal statement</a> : <a href="http://www.redhat.com/">redhat.com</a>
+ </div>
+
+ </div> <!-- close content -->
+ </div> <!-- close wrap -->
+
+ </body></html>
14 years, 11 months