java/code
by Lukas Zapletal
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
New commits:
commit bbdec54162f6b0d31636f6564525863daf274be4
Author: Lukas Zapletal <lzap+git(a)redhat.com>
Date: Wed Sep 22 09:39:25 2010 +0200
630585 - about-chat string correction (Spacewalk)
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 5314185..37d3577 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
@@ -21469,10 +21469,8 @@ given channel.</source>
<source>IRC Chat</source>
</trans-unit>
<trans-unit id="help.jsp.chatinfo">
- <source>Please contact Red Hat Support for direct assistance for RHN Satellite.
-This page allows you to join an IRC chat room for discussions with other users of
-RHN Satellite and not an official means of gaining support for RHN Satellite
-from Red Hat.</source>
+ <source>This page allows you to join an IRC chat room for discussions with other users
+ of @@PRODUCT_NAME@@.</source>
</trans-unit>
<trans-unit id="help.jsp.chatlink">
<source>Access <a href="http://webchat.freenode.net?channels=#spacewalk" target="_blank">#spacewalk</a> channel on IRC.</source>
13 years, 7 months
backend/server java/code
by Partha Aji
backend/server/rhnVirtualization.py | 8 --
java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml | 7 +-
java/code/src/com/redhat/rhn/frontend/dto/VirtualSystemOverview.java | 28 ++++++++++
java/code/webapp/WEB-INF/pages/systems/details/virtualization/virtualguestslist.jsp | 12 +++-
java/code/webapp/WEB-INF/pages/systems/virtuallist.jsp | 28 ++++++----
5 files changed, 60 insertions(+), 23 deletions(-)
New commits:
commit 271c44b2d93e798e97ac582d9c6db9dc60427b2d
Author: Partha Aji <paji(a)redhat.com>
Date: Tue Sep 21 19:41:35 2010 -0400
634263 - Fix to allow guests to register across orgs + UI fixes for the Virtual systems page
diff --git a/backend/server/rhnVirtualization.py b/backend/server/rhnVirtualization.py
index a1f0a40..7941d16 100644
--- a/backend/server/rhnVirtualization.py
+++ b/backend/server/rhnVirtualization.py
@@ -379,23 +379,17 @@ class VirtualizationEventHandler:
guest_id = system_id
# Check to see if this uuid has already been registered to a
- # host in the same org and is confirmed.
+ # host and is confirmed.
check_sql = """
select
vi.id,
vi.host_system_id,
vi.confirmed
from
- rhnServer sguest,
- rhnServer shost,
rhnVirtualInstance vi
where
vi.uuid = :uuid
and confirmed = 1
- and vi.host_system_id is not null
- and vi.host_system_id = shost.id
- and :system_id = sguest.id
- and shost.org_id = sguest.org_id
"""
query = rhnSQL.prepare(check_sql)
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
index 93fa651..3e5292f 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
@@ -834,6 +834,8 @@ SELECT PI.server_id ID, S.name,
NVL(VIS.label, 'unknown') AS STATE_LABEL,
NVL(VII.vcpus, 0) AS VCPUS,
NVL(VII.memory_size_k, 0) AS MEMORY,
+ NVL(((SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = :user_id AND USP.server_id = VI.virtual_system_id)), 0 ) as accessible,
+ rhn_channel.user_role_check((select channel_id from rhnServerOverview where server_id = VI.virtual_system_id), :user_id, 'subscribe') AS subscribable,
1 AS selectable
FROM rhnVirtualInstance VI,
rhnVirtualInstanceInfo VII,
@@ -881,8 +883,9 @@ ORDER BY NAME, VI.virtual_system_id, VI.uuid DESC
and grp.group_type = type.id
and VI.virtual_system_id is null
and ( type.label = 'virtualization_host' or type.label = 'virtualization_host_platform')
- ) as virt_entitlement
-
+ ) as virt_entitlement,
+ NVL(((SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = :user_id AND USP.server_id = VI.virtual_system_id)), 0 ) as accessible,
+ rhn_channel.user_role_check((select channel_id from rhnServerOverview where server_id = VI.virtual_system_id), :user_id, 'subscribe') AS subscribable
FROM rhnVirtualInstance VI,
rhnVirtualInstanceInfo VII,
rhnVirtualInstanceState VIS
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/VirtualSystemOverview.java b/java/code/src/com/redhat/rhn/frontend/dto/VirtualSystemOverview.java
index 625f66f..a6b297d 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/VirtualSystemOverview.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/VirtualSystemOverview.java
@@ -38,9 +38,37 @@ public class VirtualSystemOverview extends SystemOverview
private Long vcpus;
private Long memory;
private String virtEntitlement;
+ private boolean accessible;
+ private boolean subscribable;
+ /**
+ * @return Returns the accessible.
+ */
+ public boolean isAccessible() {
+ return accessible;
+ }
+
+ /**
+ * @param accessibleIn The accessible to set.
+ */
+ public void setAccessible(boolean accessibleIn) {
+ accessible = accessibleIn;
+ }
/**
+ * @return Returns the subscribable.
+ */
+ public boolean isSubscribable() {
+ return subscribable;
+ }
+
+ /**
+ * @param subscribableIn The subscribable to set.
+ */
+ public void setSubscribable(boolean subscribableIn) {
+ subscribable = subscribableIn;
+ }
+ /**
* @return Returns the system id.
*/
public Long getSystemId() {
diff --git a/java/code/webapp/WEB-INF/pages/systems/details/virtualization/virtualguestslist.jsp b/java/code/webapp/WEB-INF/pages/systems/details/virtualization/virtualguestslist.jsp
index 041acd5..ce6d60e 100644
--- a/java/code/webapp/WEB-INF/pages/systems/details/virtualization/virtualguestslist.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/details/virtualization/virtualguestslist.jsp
@@ -47,10 +47,13 @@
<c:when test="${current.virtualSystemId == null}">
<bean:message key="virtualguestslist.jsp.unregistered" />
</c:when>
- <c:otherwise>
+ <c:when test="${current.accessible}">
<a href="/rhn/systems/details/Overview.do?sid=${current.virtualSystemId}">
${current.serverName}
</a>
+ </c:when>
+ <c:otherwise>
+${current.serverName}
</c:otherwise>
</c:choose>
</rhn:column>
@@ -77,10 +80,13 @@
<c:when test="${current.channelId == null}">
<bean:message key="none.message"/>
</c:when>
- <c:otherwise>
- <a href="/rhn/channels/ChannelDetail.do?cid=${current.channelId}">
+ <c:when test="${current.subscribable}">
+ <a href="/rhn/channels/ChannelDetail.do?cid=${current.channelId}">
${current.channelLabels}
</a>
+ </c:when>
+ <c:otherwise>
+ ${current.channelLabels}
</c:otherwise>
</c:choose>
</rhn:column>
diff --git a/java/code/webapp/WEB-INF/pages/systems/virtuallist.jsp b/java/code/webapp/WEB-INF/pages/systems/virtuallist.jsp
index 05dfc8b..fceda45 100644
--- a/java/code/webapp/WEB-INF/pages/systems/virtuallist.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/virtuallist.jsp
@@ -63,11 +63,14 @@
<c:when test="${current.virtualSystemId == null}">
${current.name}
</c:when>
- <c:otherwise>
- <a href="/rhn/systems/details/Overview.do?sid=${current.virtualSystemId}">
- ${current.serverName}
- </a>
- </c:otherwise>
+ <c:when test="${current.accessible}">
+ <a href="/rhn/systems/details/Overview.do?sid=${current.virtualSystemId}">
+ ${current.serverName}
+ </a>
+ </c:when>
+ <c:otherwise>
+ ${current.serverName}
+ </c:otherwise>
</c:choose>
</rhn:column>
@@ -85,12 +88,15 @@
<c:when test="${current.channelId == null}">
<bean:message key="none.message"/>
</c:when>
- <c:otherwise>
- <a href="/rhn/channels/ChannelDetail.do?cid=${current.channelId}">
- ${current.channelLabels}
- </a>
- </c:otherwise>
- </c:choose>
+ <c:when test="${current.subscribable}">
+ <a href="/rhn/channels/ChannelDetail.do?cid=${current.channelId}">
+ ${current.channelLabels}
+ </a>
+ </c:when>
+ <c:otherwise>
+ ${current.channelLabels}
+ </c:otherwise>
+ </c:choose>
</rhn:column>
</c:otherwise>
13 years, 7 months
Changes to 'refs/tags/spacecmd-0.6.2-1'
by aparsons
Tag 'spacecmd-0.6.2-1' created by Aron Parsons <aparsons(a)redhat.com> at 2010-09-21 20:38 +0000
Tagging package [spacecmd] version [0.6.2-1] in directory [spacecmd/].
Changes since spacewalk-java-1.2.42-1:
Aron Parsons (1):
Automatic commit of package [spacecmd] release [0.6.2-1].
---
rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
---
13 years, 7 months
rel-eng/packages spacecmd/spacecmd.spec
by aparsons
rel-eng/packages/spacecmd | 2 +-
spacecmd/spacecmd.spec | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit ac6a08ead993c1b28e8516015a25d9dccb38b3bb
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 16:38:48 2010 -0400
Automatic commit of package [spacecmd] release [0.6.2-1].
diff --git a/rel-eng/packages/spacecmd b/rel-eng/packages/spacecmd
index 7d89031..9f79387 100644
--- a/rel-eng/packages/spacecmd
+++ b/rel-eng/packages/spacecmd
@@ -1 +1 @@
-0.6.1-1 spacecmd/
+0.6.2-1 spacecmd/
diff --git a/spacecmd/spacecmd.spec b/spacecmd/spacecmd.spec
index 4b6362a..63a23d0 100644
--- a/spacecmd/spacecmd.spec
+++ b/spacecmd/spacecmd.spec
@@ -4,7 +4,7 @@
%endif
Name: spacecmd
-Version: 0.6.1
+Version: 0.6.2
Release: 1%{?dist}
Summary: Command-line interface to Spacewalk and Satellite servers
@@ -57,6 +57,11 @@ touch %{buildroot}/%{python_sitelib}/spacecmd/__init__.py
%doc %{_mandir}/man1/spacecmd.1.gz
%changelog
+* Tue Sep 21 2010 Aron Parsons <aparsons(a)redhat.com> 0.6.2-1
+- added new function softwarechannel_removeerrata
+ (aparsons(a)redhat.com)
+- update softwarechannel_adderrata to use the new
+ mergeErratawithPackages API call (aparsons(a)redhat.com)
* Mon Sep 20 2010 Aron Parsons <aparsons(a)redhat.com> 0.6.1-1
- support symlinks, selinux contexts and revisions in configchannel_*
(aparsons(a)redhat.com)
13 years, 7 months
Changes to 'refs/tags/spacewalk-java-1.2.42-1'
by aparsons
Tag 'spacewalk-java-1.2.42-1' created by Aron Parsons <aparsons(a)redhat.com> at 2010-09-21 20:36 +0000
Tagging package [spacewalk-java] version [1.2.42-1] in directory [java/].
Changes since spacewalk-remote-utils-1.0.2-1:
Aron Parsons (16):
spacecmd: remove prompts for summary/description when creating software channels and just use the name
spacecmd: clarify what 'Original State' means when cloning a software channel
spacecmd: show the last checkin time in report_inactivesystems
spacecmd: cleanup column headers in report_outofdatesystems
spacecmd: revert to the old-style of errata merging due to bugzilla 591291
spacecmd: allow --debug to be passed multiple times
spacecmd: avoid proxy timeouts when cloning errata by doing them individually
spacecmd: added new function softwarechannel_listallpackages
spacecmd: support symlinks, selinux contexts and revisions in configchannel_*
Automatic commit of package [spacecmd] release [0.6.1-1].
added a new variation of channel.software.mergeErrata API call that allows the user to pass in a list of advisory names
591291 - added new API calls channel.software.mergeErrataWithPackages
spacecmd: update softwarechannel_adderrata to use the new mergeErratawithPackages API call
added new API call channel.software.removeErrata
spacecmd: added new function softwarechannel_removeerrata
Automatic commit of package [spacewalk-java] release [1.2.42-1].
Justin Sherrill (1):
634834 - fixing ISE when putting in invalid day of week
Lukas Zapletal (1):
630585 - about-chat now points to proper channel (branding)
Michael Mraka (1):
fixed comments in xmlrpc handler configuration files
Milan Zazrivec (1):
do not restart whole satellite when enabling monitoring
---
.gitignore | 1
backend/httpd-conf/rhn/spacewalk-backend-app.conf | 1
backend/httpd-conf/rhn/spacewalk-backend-applet.conf | 3
backend/httpd-conf/rhn/spacewalk-backend-config-management-tool.conf | 3
backend/httpd-conf/rhn/spacewalk-backend-config-management.conf | 3
backend/httpd-conf/rhn/spacewalk-backend-package-push.conf | 3
backend/httpd-conf/rhn/spacewalk-backend-pkg-upload.conf | 3
backend/httpd-conf/rhn/spacewalk-backend-sat-export-internal.conf | 4
backend/httpd-conf/rhn/spacewalk-backend-xmlrpc.conf | 1
backend/httpd-conf/rhn/spacewalk-backend-xp.conf | 1
java/code/src/com/redhat/rhn/common/util/RecurringEventPicker.java | 6
java/code/src/com/redhat/rhn/frontend/action/help/ChatAction.java | 28
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 12
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 233 +++++++
java/code/webapp/WEB-INF/nav/sitenav-authenticated.xml | 3
java/code/webapp/WEB-INF/nav/sitenav.xml | 3
java/code/webapp/WEB-INF/pages/help/chatindex.jsp | 24
java/code/webapp/WEB-INF/struts-config.xml | 6
java/spacewalk-java.spec | 22
rel-eng/packages/spacecmd | 2
rel-eng/packages/spacewalk-java | 2
spacecmd/spacecmd.spec | 21
spacecmd/src/bin/spacecmd | 6
spacecmd/src/lib/configchannel.py | 217 ++++---
spacecmd/src/lib/misc.py | 6
spacecmd/src/lib/report.py | 28
spacecmd/src/lib/softwarechannel.py | 304 +++++++---
spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl | 3
web/html/nav/sitenav-authenticated.xml | 3
web/html/nav/sitenav.xml | 3
30 files changed, 768 insertions(+), 187 deletions(-)
---
13 years, 7 months
java/spacewalk-java.spec rel-eng/packages
by aparsons
java/spacewalk-java.spec | 22 +++++++++++++++++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 6a599b2cc480bd95145ed498d8560ee4c126ecbf
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 16:36:37 2010 -0400
Automatic commit of package [spacewalk-java] release [1.2.42-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 6fdb72e..70b13bd 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -19,7 +19,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.2.41
+Version: 1.2.42
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -336,6 +336,26 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Tue Sep 21 2010 Aron Parsons <aparsons(a)redhat.com> 1.2.42-1
+- added new API call channel.software.removeErrata (aparsons(a)redhat.com)
+- 591291 - added new API calls channel.software.mergeErrataWithPackages
+ (aparsons(a)redhat.com)
+- added a new variation of channel.software.mergeErrata API call that allows
+ the user to pass in a list of advisory names (aparsons(a)redhat.com)
+- 630585 - about-chat now points to proper channel (branding)
+ (lzap+git(a)redhat.com)
+- 634834 - fixing ISE when putting in invalid day of week (jsherril(a)redhat.com)
+- 634910 - fixing permission denied error on manage channel errata that should
+ not have been denied (jsherril(a)redhat.com)
+- checkstyle fix for previous commit (lzap+git(a)redhat.com)
+- various checkstyle fixes for previous commit (lzap+git(a)redhat.com)
+- 634884 - managing repositories within channels through XMLRPC API disabled
+ (lzap+git(a)redhat.com)
+- fixed NPE when spacewalk_reposync_logpath is set to nonexisting dir
+ (lzap+git(a)redhat.com)
+- 633956 -fixing error popup on YourRhn when a warning or critical probe exists
+ (jsherril(a)redhat.com)
+
* Thu Sep 16 2010 Lukas Zapletal 1.2.41-1
- 595500 - added contents_enc64 param to createOrUpdatePath XMLAPI
- making taskmoatic work with the rkbloom driver
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 14e7e60..fe697e8 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.2.41-1 java/
+1.2.42-1 java/
13 years, 7 months
spacecmd/src
by aparsons
spacecmd/src/lib/softwarechannel.py | 100 +++++++++++++++++++++++++++++++-----
1 file changed, 88 insertions(+), 12 deletions(-)
New commits:
commit 07b199a3f76fb8e3676508ed2f33a6f8a6f96a9b
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 16:35:05 2010 -0400
spacecmd: added new function softwarechannel_removeerrata
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index 236ec2a..ccd83c5 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -44,7 +44,7 @@ def do_softwarechannel_getentitlements(self, args):
channel = args[0]
entitlements = \
- self.client.channel.software.availableEntitlements(self.session,
+ self.client.channel.software.availableEntitlements(self.session,
channel)
print entitlements
@@ -129,7 +129,7 @@ def help_softwarechannel_listpackages(self):
def complete_softwarechannel_listpackages(self, text, line, beg, end):
if len(line.split(' ')) == 2:
- return tab_completer(self.do_softwarechannel_list('', True),
+ return tab_completer(self.do_softwarechannel_list('', True),
text)
else:
return []
@@ -216,7 +216,7 @@ def do_softwarechannel_details(self, args):
self.client.channel.software.listSubscribedSystems(\
self.session, channel)
- trees = self.client.kickstart.tree.list(self.session,
+ trees = self.client.kickstart.tree.list(self.session,
channel)
packages = \
@@ -425,7 +425,7 @@ def do_softwarechannel_clone(self, args):
self.client.channel.software.clone(self.session,
source,
details,
- orig_state)
+ orig_state)
####################
@@ -437,7 +437,7 @@ def complete_softwarechannel_addpackages(self, text, line, beg, end):
parts = line.split(' ')
if len(parts) == 2:
- return tab_completer(self.do_softwarechannel_list('', True),
+ return tab_completer(self.do_softwarechannel_list('', True),
text)
elif len(parts) > 2:
return tab_completer(self.get_package_names(True), text)
@@ -471,23 +471,99 @@ def do_softwarechannel_addpackages(self, args):
if not self.user_confirm('Add these packages [y/N]:'): return
- self.client.channel.software.addPackages(self.session,
- channel,
+ self.client.channel.software.addPackages(self.session,
+ channel,
package_ids)
####################
+def help_softwarechannel_removeerrata(self):
+ print 'softwarechannel_removeerrata: Remove errata from a ' + \
+ 'software channel'
+ print 'usage: softwarechannel_removeerrata CHANNEL <ERRATA:search:XXX ...>'
+
+def complete_softwarechannel_removeerrata(self, text, line, beg, end):
+ parts = line.split(' ')
+
+ if len(parts) == 2:
+ return tab_completer(self.do_softwarechannel_list('', True),
+ text)
+ elif len(parts) > 2:
+ return self.tab_complete_errata(text)
+
+def do_softwarechannel_removeerrata(self, args):
+ args = parse_arguments(args)
+
+ if not len(args):
+ self.help_softwarechannel_removeerrata()
+ return
+
+ channel = args[0]
+ errata_wanted = self.expand_errata(args[1:])
+
+ logging.debug('Retrieving the list of errata from source channel')
+ channel_errata = self.client.channel.software.listErrata(self.session,
+ channel)
+
+ errata = filter_results([ e.get('advisory_name') for e in channel_errata ],
+ errata_wanted)
+
+ # keep the details for our matching errata so we can use them later
+ errata_details = []
+ for erratum in channel_errata:
+ if erratum.get('advisory_name') in errata:
+ errata_details.append(erratum)
+
+ # get the packages that resolve these errata so we can add them
+ # to the channel afterwards
+ package_ids = []
+ for erratum in errata:
+ logging.debug('Retrieving packages for errata %s' % erratum)
+
+ # get the packages affected by this errata
+ packages = self.client.errata.listPackages(self.session, erratum)
+
+ # only add packages that exist in the source channel
+ for package in packages:
+ if channel in package.get('providing_channels'):
+ package_ids.append(package.get('id'))
+
+ if not len(errata_details):
+ logging.warning('No errata to remove')
+ return
+
+ print_errata_list(errata_details)
+
+ print
+ print 'Packages'
+ print '--------'
+ print '\n'.join(sorted([ self.get_package_name(p) for p in package_ids ]))
+
+ print
+ print 'Total Errata: %s' % str(len(errata)).rjust(3)
+ print 'Total Packages: %s' % str(len(package_ids)).rjust(3)
+
+ if not self.user_confirm('Remove these errata [y/N]:'): return
+
+ # remove the errata and the packages they brought in
+ self.client.channel.software.removeErrata(self.session,
+ channel,
+ errata,
+ True)
+
+####################
+
def help_softwarechannel_removepackages(self):
print 'softwarechannel_removepackages: Remove packages from a ' + \
'software channel'
print 'usage: softwarechannel_removepackages CHANNEL <PACKAGE ...>'
-def complete_softwarechannel_removepackages(self, text, line, beg,
+def complete_softwarechannel_removepackages(self, text, line, beg,
end):
parts = line.split(' ')
if len(parts) == 2:
- return tab_completer(self.do_softwarechannel_list('', True),
+ return tab_completer(self.do_softwarechannel_list('', True),
text)
elif len(parts) > 2:
# only tab complete packages in the channel
@@ -539,8 +615,8 @@ def do_softwarechannel_removepackages(self, args):
if not self.user_confirm('Remove these packages [y/N]:'): return
- self.client.channel.software.removePackages(self.session,
- channel,
+ self.client.channel.software.removePackages(self.session,
+ channel,
package_ids)
####################
@@ -600,7 +676,7 @@ def do_softwarechannel_adderratabydate(self, args):
def help_softwarechannel_adderrata(self):
print 'softwarechannel_adderrata: Add errata from one channel ' + \
'into another channel'
- print 'usage: softwarechannel_adderrata SOURCE DEST <ERRATA:search:XXX ...>'
+ print 'usage: softwarechannel_adderrata SOURCE DEST <ERRATA|search:XXX ...>'
def complete_softwarechannel_adderrata(self, text, line, beg, end):
parts = line.split(' ')
13 years, 7 months
java/code
by aparsons
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 77 ++++++++++
1 file changed, 77 insertions(+)
New commits:
commit b4b9078743f07be8a8613b1abde3140c56b7b7c7
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 16:34:32 2010 -0400
added new API call channel.software.removeErrata
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
index 62fa619..b64adc2 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
@@ -1140,6 +1140,83 @@ public class ChannelSoftwareHandler extends BaseHandler {
}
/**
+ * Removes a given list of errata from the given channel.
+ * @param sessionKey The sessionKey containing the logged in user
+ * @param channelLabel The label for the channel
+ * @param errataNames A list containing the advisory names of errata to remove
+ * @param removePackages Boolean to remove packages from the channel also
+ * @return Returns 1 if successfull, Exception otherwise
+ * - The user is not a channel admin for the channel
+ * - The channel is invalid
+ * - The user doesn't have access to one of the channels in the list
+ *
+ * @xmlrpc.doc Removes a given list of errata from the given channel.
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "channelLabel", "target channel.")
+ * @xmlrpc.param #array_single("string", "advisoryName - name of an erratum to remove")
+ * @xmlrpc.param #param_desc("boolean", "removePackages", "True to remove packages from the channel")
+ * @xmlrpc.returntype #return_int_success()
+ */
+ public int removeErrata(String sessionKey, String channelLabel,
+ List errataNames, boolean removePackages) {
+
+ User user = getLoggedInUser(sessionKey);
+ channelAdminPermCheck(user);
+
+ Channel channel = lookupChannelByLabel(user, channelLabel);
+
+ if (! UserManager.verifyChannelAdmin(user, channel)) {
+ throw new PermissionCheckFailureException();
+ }
+
+ HashSet<Errata> errataToRemove = new HashSet();
+
+ for (Iterator itr = errataNames.iterator(); itr.hasNext();) {
+ Errata erratum = ErrataManager.lookupByAdvisory((String)itr.next());
+
+ if (erratum != null) {
+ errataToRemove.add(erratum);
+ ErrataManager.removeErratumFromChannel(erratum, channel, user);
+ }
+ }
+
+ // remove packages from the channel if requested
+ if (removePackages) {
+ List<Long> packagesToRemove = new ArrayList();
+
+ List<Long> channelPkgs = ChannelFactory.getPackageIds(channel.getId());
+
+ for (Errata erratum : errataToRemove) {
+ Set<Package> erratumPackageList = erratum.getPackages();
+
+ for (Package pkg : erratumPackageList) {
+ // if the package is in the channel, remove it
+ if (channelPkgs.contains(pkg.getId())) {
+ packagesToRemove.add(pkg.getId());
+ }
+ }
+ }
+
+ // remove the packages from the channel
+ ChannelManager.removePackages(channel, packagesToRemove, user);
+
+ // refresh the channel
+ ChannelManager.refreshWithNewestPackages(channel, "api");
+
+ // Mark the affected channel to have it's metadata evaluated, where necessary
+ // (RHEL5+, mostly)
+ ChannelManager.queueChannelChange(channel.getLabel(), "java::removeErrata",
+ user.getLogin());
+
+ List<Long> cids = new ArrayList();
+ cids.add(channel.getId());
+ ErrataCacheManager.insertCacheForChannelPackagesAsync(cids, packagesToRemove);
+ }
+
+ return 1;
+ }
+
+ /**
* Removes a given list of packages from the given channel.
* @param sessionKey The sessionKey containing the logged in user
* @param channelLabel The label for the channel
13 years, 7 months
spacecmd/src
by aparsons
spacecmd/src/lib/softwarechannel.py | 37 ++++++++++++++++++++++++------------
1 file changed, 25 insertions(+), 12 deletions(-)
New commits:
commit 5504c0cda59809b599d4428b51194ef1201bad94
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 15:47:51 2010 -0400
spacecmd: update softwarechannel_adderrata to use the new mergeErratawithPackages API call
diff --git a/spacecmd/src/lib/softwarechannel.py b/spacecmd/src/lib/softwarechannel.py
index dfaa035..236ec2a 100644
--- a/spacecmd/src/lib/softwarechannel.py
+++ b/spacecmd/src/lib/softwarechannel.py
@@ -666,18 +666,31 @@ def do_softwarechannel_adderrata(self, args):
if not self.user_confirm('Add these errata and packages [y/N]:'): return
- # clone each erratum individually because the process is slow and it can
- # lead to timeouts on the server
- logging.info('Cloning errata into %s' % dest_channel)
- for erratum in errata:
- logging.debug('Cloning %s' % erratum)
- self.client.errata.clone(self.session, dest_channel, [erratum])
-
- # add the affected packages to the channel
- logging.info('Adding required packages to %s' % dest_channel)
- self.client.channel.software.addPackages(self.session,
- dest_channel,
- package_ids)
+ if self.check_api_version('10.12'):
+ merged = \
+ self.client.channel.software.mergeErrataWithPackages(self.session,
+ source_channel,
+ dest_channel,
+ errata)
+
+ # show the user which errata were actually merged
+ print
+ print "Errata Merged"
+ print "-------------"
+ print
+ print_errata_list(merged)
+ else:
+ # clone each erratum individually because the process is slow and it can
+ # lead to timeouts on the server
+ for erratum in errata:
+ logging.debug('Cloning %s' % erratum)
+ self.client.errata.clone(self.session, dest_channel, [erratum])
+
+ # add the affected packages to the channel
+ logging.info('Adding required packages to %s' % dest_channel)
+ self.client.channel.software.addPackages(self.session,
+ dest_channel,
+ package_ids)
# regenerate the errata cache since we just cloned errata
self.generate_errata_cache(True)
13 years, 7 months
java/code
by aparsons
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 109 +++++++++-
1 file changed, 101 insertions(+), 8 deletions(-)
New commits:
commit aecf408bd48b53e672560c1daa2dcf3257d5e90b
Author: Aron Parsons <aparsons(a)redhat.com>
Date: Tue Sep 21 15:41:35 2010 -0400
591291 - added new API calls channel.software.mergeErrataWithPackages
the old API calls are preserved. the new API calls will get the list of
packages that the errata affects, check if they are in the source channel
and if they are, it will then add them to the destination channel. this should
address Tomas's issues listed in the Bugzilla about pulling in packages
that shouldn't go into the destination channel.
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
index cc35072..62fa619 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
@@ -1739,6 +1739,11 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public Object[] mergeErrata(String sessionKey, String mergeFromLabel,
String mergeToLabel) {
+ return mergeErrata(sessionKey, mergeFromLabel, mergeToLabel, false);
+ }
+
+ private Object[] mergeErrata(String sessionKey, String mergeFromLabel,
+ String mergeToLabel, boolean addPackages) {
User loggedInUser = getLoggedInUser(sessionKey);
channelAdminPermCheck(loggedInUser);
@@ -1752,7 +1757,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
Set<Errata> mergedErrata =
mergeErrataToChannel(loggedInUser, new HashSet(mergeFrom.getErratas()),
- mergeTo, mergeFrom);
+ mergeTo, mergeFrom, addPackages);
return mergedErrata.toArray();
}
@@ -1782,6 +1787,11 @@ public class ChannelSoftwareHandler extends BaseHandler {
*/
public Object[] mergeErrata(String sessionKey, String mergeFromLabel,
String mergeToLabel, String startDate, String endDate) {
+ return mergeErrata(sessionKey, mergeFromLabel, mergeToLabel, startDate, endDate, false);
+ }
+
+ private Object[] mergeErrata(String sessionKey, String mergeFromLabel,
+ String mergeToLabel, String startDate, String endDate, boolean addPackages) {
User loggedInUser = getLoggedInUser(sessionKey);
channelAdminPermCheck(loggedInUser);
@@ -1797,20 +1807,72 @@ public class ChannelSoftwareHandler extends BaseHandler {
loggedInUser.getOrg(), mergeFrom, startDate, endDate);
Set<Errata> mergedErrata =
- mergeErrataToChannel(loggedInUser, new HashSet(fromErrata), mergeTo, mergeFrom);
+ mergeErrataToChannel(loggedInUser, new HashSet(fromErrata), mergeTo, mergeFrom, addPackages);
return mergedErrata.toArray();
}
/**
- * Merge a list of errata from one channel into another channel
+ * Merge a channel's errata into another channel and adds the packages
+ * @param sessionKey session of the user
+ * @param mergeFromLabel the label of the channel to pull the errata from
+ * @param mergeToLabel the label of the channel to push errata into
+ * @return A list of errata that were merged.
+ *
+ * @xmlrpc.doc Merges all errata from one channel into another and adds the packages
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "mergeFromLabel", "the label of the
+ * channel to pull errata from")
+ * @xmlrpc.param #param_desc("string", "mergeToLabel", "the label to push the
+ * errata into")
+ * @xmlrpc.returntype
+ * #array()
+ * $ErrataSerializer
+ * #array_end()
+ */
+ public Object[] mergeErrataWithPackages(String sessionKey, String mergeFromLabel,
+ String mergeToLabel) {
+ return mergeErrata(sessionKey, mergeFromLabel, mergeToLabel, true);
+ }
+
+ /**
+ * Merge a channel's errata into another channel based upon a given start/end date and add the packages
+ * @param sessionKey session of the user
+ * @param mergeFromLabel the label of the channel to pull the errata from
+ * @param mergeToLabel the label of the channel to push errata into
+ * @param startDate begin date
+ * @param endDate end date
+ * @return A list of errata that were merged.
+ *
+ * @xmlrpc.doc Merges all errata from one channel into another based upon a
+ * given start/end date.
+ * @xmlrpc.param #session_key()
+ * @xmlrpc.param #param_desc("string", "mergeFromLabel", "the label of the
+ * channel to pull errata from")
+ * @xmlrpc.param #param_desc("string", "mergeToLabel", "the label to push the
+ * errata into")
+ * @xmlrpc.param #param("string", "startDate")
+ * @xmlrpc.param #param("string", "endDate")
+ * @xmlrpc.returntype
+ * #array()
+ * $ErrataSerializer
+ * #array_end()
+ */
+ public Object[] mergeErrataWithPackages(String sessionKey, String mergeFromLabel,
+ String mergeToLabel, String startDate, String endDate) {
+ return mergeErrata(sessionKey, mergeFromLabel, mergeToLabel, startDate, endDate, true);
+ }
+
+ /**
+ * Merge a list of errata from one channel into another channel and adds the packages
* @param sessionKey session of the user
* @param mergeFromLabel the label of the channel to pull the errata from
* @param mergeToLabel the label of the channel to push errata into
* @param errataNames the list of errata to merge
* @return A list of errata that were merged.
*
- * @xmlrpc.doc Merges a list of errata from one channel into another
+ * @xmlrpc.doc Merges a list of errata from one channel into another and
+ * adds the affected packages to the destination channel
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "mergeFromLabel", "the label of the
* channel to pull errata from")
@@ -1823,7 +1885,7 @@ public class ChannelSoftwareHandler extends BaseHandler {
* $ErrataSerializer
* #array_end()
*/
- public Object[] mergeErrata(String sessionKey, String mergeFromLabel,
+ public Object[] mergeErrataWithPackages(String sessionKey, String mergeFromLabel,
String mergeToLabel, List errataNames) {
User loggedInUser = getLoggedInUser(sessionKey);
@@ -1852,13 +1914,13 @@ public class ChannelSoftwareHandler extends BaseHandler {
}
Set<Errata> mergedErrata =
- mergeErrataToChannel(loggedInUser, errataToMerge, mergeTo, mergeFrom);
+ mergeErrataToChannel(loggedInUser, errataToMerge, mergeTo, mergeFrom, true);
return mergedErrata.toArray();
}
private Set<Errata> mergeErrataToChannel(User user, Set<Errata> errataToMerge,
- Channel toChannel, Channel fromChannel) {
+ Channel toChannel, Channel fromChannel, boolean addPackages) {
// find errata that we do not need to merge
List<Errata> same = ErrataManager.listSamePublishedInChannels(
@@ -1875,7 +1937,38 @@ public class ChannelSoftwareHandler extends BaseHandler {
ErrataManager.publishErrataToChannelAsync(toChannel,
getErrataIds(errataToMerge), user);
- // no need to regenerate errata cache, because we didn't touch any packages
+ // add packages to the channel if requested
+ if (addPackages) {
+ List<Long> packagesToAdd = new ArrayList();
+
+ List<Long> fromChannelPkgs = ChannelFactory.getPackageIds(fromChannel.getId());
+
+ for (Errata erratum : errataToMerge) {
+ Set<Package> erratumPackageList = erratum.getPackages();
+
+ for (Package pkg : erratumPackageList) {
+ // if the package is in the source channel, add it to the destination
+ if (fromChannelPkgs.contains(pkg.getId())) {
+ packagesToAdd.add(pkg.getId());
+ }
+ }
+ }
+
+ // add the packages to the destination channel
+ ChannelManager.addPackages(toChannel, packagesToAdd, user);
+
+ // refresh the channel
+ ChannelManager.refreshWithNewestPackages(toChannel, "api");
+
+ // Mark the affected channel to have it's metadata evaluated, where necessary
+ // (RHEL5+, mostly)
+ ChannelManager.queueChannelChange(toChannel.getLabel(), "java::mergeErrataToChannel",
+ user.getLogin());
+
+ List<Long> cids = new ArrayList();
+ cids.add(toChannel.getId());
+ ErrataCacheManager.insertCacheForChannelPackagesAsync(cids, packagesToAdd);
+ }
return errataToMerge;
}
13 years, 7 months