java/spacewalk-java.spec rel-eng/packages
by Michael Mraka
java/spacewalk-java.spec | 7 ++++++-
rel-eng/packages/spacewalk-java | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
New commits:
commit 25217badff55aac5bb2ee886026e231a1e350131
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 9 11:06:00 2010 +0100
Automatic commit of package [spacewalk-java] release [1.3.24-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index dd980a9..e3ca094 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -17,7 +17,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.3.23
+Version: 1.3.24
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -446,6 +446,11 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Thu Dec 09 2010 Michael Mraka <michael.mraka(a)redhat.com> 1.3.24-1
+- 646488 - fixed systemGroups.jsp according to new query
+- removed unused code
+- removed unused overview query
+
* Wed Dec 08 2010 Tomas Lestach <tlestach(a)redhat.com> 1.3.23-1
- change default owner:group of ojdbc14.jar and postgresql-jdbc.jar
(tlestach(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 870e928..34b5b5f 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.3.23-1 java/
+1.3.24-1 java/
13 years, 6 months
3 commits - java/code web/modules
by Michael Mraka
java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml | 14 ---
java/code/src/com/redhat/rhn/frontend/dto/SystemGroupOverview.java | 39 ----------
java/code/webapp/WEB-INF/pages/common/fragments/yourrhn/systemGroups.jsp | 4 -
web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml | 14 ---
4 files changed, 2 insertions(+), 69 deletions(-)
New commits:
commit b3d63417f319bddc5fecc14dfef0a4df5010fe61
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 9 10:06:12 2010 +0100
removed unused code
securityErrata, bugErrata and enhancementErrata are dead after
5e8fa20c917abb5dfabc2c5877ce6e9a453bb066
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/SystemGroupOverview.java b/java/code/src/com/redhat/rhn/frontend/dto/SystemGroupOverview.java
index 43dd405..9dcb731 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/SystemGroupOverview.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/SystemGroupOverview.java
@@ -24,9 +24,6 @@ public class SystemGroupOverview extends BaseDto {
private Long id;
private String name;
- private Long securityErrata;
- private Long bugErrata;
- private Long enhancementErrata;
private Long groupAdmins;
private Long serverCount;
private Long noteCount;
@@ -61,30 +58,6 @@ public class SystemGroupOverview extends BaseDto {
}
/**
- * @return Returns the bugErrata.
- */
- public Long getBugErrata() {
- return bugErrata;
- }
- /**
- * @param bugErrataIn The bugErrata to set.
- */
- public void setBugErrata(Long bugErrataIn) {
- this.bugErrata = bugErrataIn;
- }
- /**
- * @return Returns the enhancementErrata.
- */
- public Long getEnhancementErrata() {
- return enhancementErrata;
- }
- /**
- * @param enhancementErrataIn The enhancementErrata to set.
- */
- public void setEnhancementErrata(Long enhancementErrataIn) {
- this.enhancementErrata = enhancementErrataIn;
- }
- /**
* @return Returns the groupAdmins.
*/
public Long getGroupAdmins() {
@@ -157,18 +130,6 @@ public class SystemGroupOverview extends BaseDto {
this.noteCount = noteCountIn;
}
/**
- * @return Returns the securityErrata.
- */
- public Long getSecurityErrata() {
- return securityErrata;
- }
- /**
- * @param securityErrataIn The securityErrata to set.
- */
- public void setSecurityErrata(Long securityErrataIn) {
- this.securityErrata = securityErrataIn;
- }
- /**
* @return Returns the serverCount.
*/
public Long getServerCount() {
commit 4571bec22d34af64eb9b22fb471879f3214f6ef4
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Dec 9 09:52:06 2010 +0100
646488 - fixed systemGroups.jsp according to new query
query has been changed in 73369cb5971a658c38f3f41e8354ad1a15a67fb4
diff --git a/java/code/webapp/WEB-INF/pages/common/fragments/yourrhn/systemGroups.jsp b/java/code/webapp/WEB-INF/pages/common/fragments/yourrhn/systemGroups.jsp
index b6a5f40..374edc7 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/yourrhn/systemGroups.jsp
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/yourrhn/systemGroups.jsp
@@ -16,12 +16,12 @@
<rl:column headerkey="grouplist.jsp.status" styleclass="first-column">
<a href="/network/systems/groups/errata_list.pxt?sgid=${current.id}">
<c:choose>
- <c:when test="${current.securityErrata > 0}">
+ <c:when test="${current.mostSevereErrata == 'Security Advisory'}">
<img src="/img/icon_crit_update.gif" border="0"
alt="<bean:message key="grouplist.jsp.security"/>"
title="<bean:message key="grouplist.jsp.security"/>" />
</c:when>
- <c:when test="${current.bugErrata > 0 or current.enhancementErrata > 0}">
+ <c:when test="${current.mostSevereErrata == 'Bug Fix Advisory' or current.mostSevereErrata == 'Product Enhancement Advisory'}">
<img src="/img/icon_reg_update.gif" border="0"
alt="<bean:message key="grouplist.jsp.updates"/>"
title="<bean:message key="grouplist.jsp.updates"/>" />
commit a7cb16062726c98e2c4f74ea0feb73f88bbe5a88
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 8 23:46:56 2010 +0100
removed unused overview query
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
index e857f69..8964eec 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/SystemGroup_queries.xml
@@ -68,20 +68,6 @@
</query>
- <query name="visible_to_user_overview_slow" params="org_id, user_id">
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
- GO.GROUP_ID AS ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT,
- NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS,
- NVL(SECURITY_ERRATA + BUG_ERRATA + ENHANCEMENT_ERRATA, 0) AS ALL_ERRATA
- FROM rhnVisServerGroupOverview GO, rhnUserManagedServerGroups UMSG
- WHERE GO.ORG_ID = :org_id
- AND UMSG.user_id = :user_id
- AND UMSG.server_group_id IN (%s)
- AND GO.GROUP_ID = UMSG.server_group_id
-ORDER BY UPPER(GROUP_NAME), GO.GROUP_ID
- </query>
-
-
<query name="visible_to_user_ids" params="user_id">
select * from (
SELECT DISTINCT SG.id AS ID, SG.name AS NAME
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
index 9adb6f7..5e0e92c 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/SystemGroup_queries.xml
@@ -48,20 +48,6 @@ SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
ORDER BY UPPER(GROUP_NAME), GO.GROUP_ID
</query>
- <query name="visible_to_user_overview_slow" params="org_id, user_id">
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
- GO.GROUP_ID AS ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT,
- NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS,
- NVL(SECURITY_ERRATA + BUG_ERRATA + ENHANCEMENT_ERRATA, 0) AS ALL_ERRATA
- FROM rhnVisServerGroupOverview GO, rhnUserManagedServerGroups UMSG
- WHERE GO.ORG_ID = :org_id
- AND UMSG.user_id = :user_id
- AND UMSG.server_group_id IN (%s)
- AND GO.GROUP_ID = UMSG.server_group_id
-ORDER BY UPPER(GROUP_NAME), GO.GROUP_ID
- </query>
-
-
<query name="visible_to_user_ids" params="user_id">
SELECT DISTINCT SG.id AS ID, SG.name AS GROUP_NAME
FROM rhnServerGroup SG, rhnUserManagedServerGroups UMSG
13 years, 6 months
utils/delete-old-systems-interactive utils/spacewalk-api
by Jan Pazdziora
utils/delete-old-systems-interactive | 3 ++-
utils/spacewalk-api | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
New commits:
commit b15c29da8a73f1ef86b37b8d74cbd0d5eca30c1b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:18:53 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/utils/delete-old-systems-interactive b/utils/delete-old-systems-interactive
index 22920c2..83dafc4 100755
--- a/utils/delete-old-systems-interactive
+++ b/utils/delete-old-systems-interactive
@@ -11,13 +11,14 @@ my ($host, $username) = ( 'localhost', 'admin' );
my $passwd;
my $force;
+my $usage = "Usage: $0 --idle=<idletime[w|d|h|m]> [--host=<host>] [--username=<username>] [--password=<password>] [--force]\n";
Getopt::Long::GetOptions(
'idle=s' => \$idle_time,
'host=s' => \$host,
'username=s' => \$username,
'password=s' => \$passwd,
'force' => \$force,
-);
+) or die $usage;
if (not defined $idle_time) {
die "Need --idle parameter\n";
diff --git a/utils/spacewalk-api b/utils/spacewalk-api
index 6abb41c..f69b2a0 100644
--- a/utils/spacewalk-api
+++ b/utils/spacewalk-api
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
#
-# Copyright (c) 2009 Red Hat, Inc.
+# Copyright (c) 2009--2010 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
@@ -24,11 +24,12 @@ use Term::ReadKey;
my ($server, $user, $password)= ('', '', '');
my $login=1;
+my $usage = "Usage: $0 --server=<server> [--login] [--user=<user>] [--password=<password>] [--force]\n";
GetOptions("server=s" => \$server,
"login!" => \$login,
"user:s" => \$user,
"password:s" => \$password,
- );
+ ) or die $usage;
if (not $server) {
print "Error: No server specified.\n";
13 years, 6 months
spacewalk/spacewalk-setup-jabberd
by Jan Pazdziora
spacewalk/spacewalk-setup-jabberd/bin/spacewalk-setup-jabberd | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
New commits:
commit e9aca73bfd0b21432bead8f5b95dd719e46c7ee5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:14:03 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/spacewalk/spacewalk-setup-jabberd/bin/spacewalk-setup-jabberd b/spacewalk/spacewalk-setup-jabberd/bin/spacewalk-setup-jabberd
index f5000a7..25bd7f0 100755
--- a/spacewalk/spacewalk-setup-jabberd/bin/spacewalk-setup-jabberd
+++ b/spacewalk/spacewalk-setup-jabberd/bin/spacewalk-setup-jabberd
@@ -33,10 +33,7 @@ if ($q =~ /^rhn-(org-)?httpd-ssl-key-pair/) {
$macros{'server_pem'} = '/etc/jabberd/server.pem';
}
-GetOptions("macros:s" => \$macros, "verbose" => \$verbose, "help" => \$help);
-
-if ($help) {
- print <<EOHELP;
+my $usage = <<EOHELP;
Usage: $0 --help | --verbose | --macros macros
Options:
--help Print this help message
@@ -44,6 +41,9 @@ Options:
--macros Comma delimited list of macroname:macrovalue options
EOHELP
+GetOptions("macros:s" => \$macros, "verbose" => \$verbose, "help" => \$help) or die $usage;
+if ($help) {
+ print $usage;
exit 0;
}
13 years, 6 months
spacewalk/setup
by Jan Pazdziora
spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl | 2 +-
spacewalk/setup/share/upgrade/rhn-enable-push.pl | 2 +-
spacewalk/setup/share/upgrade/rhn-load-config.pl | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit abe6d26eb291b2312da251b3d9a61b98363d7b1b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:12:38 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl b/spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl
index d13ae7e..5da6022 100644
--- a/spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl
+++ b/spacewalk/setup/share/upgrade/rhn-enable-monitoring.pl
@@ -35,7 +35,7 @@ my $usage = "usage: $0 [ --enable-scout ] [ --admin-email=<email_address> ] [ --
. " [ --mail-domain=<mail_domain> ] [ --hostname=<override_hostname> ]"
. " [ --help ]\n";
-GetOptions(\%opts, @valid_opts);
+GetOptions(\%opts, @valid_opts) or die $usage;
if ($opts{help}) {
die $usage;
diff --git a/spacewalk/setup/share/upgrade/rhn-enable-push.pl b/spacewalk/setup/share/upgrade/rhn-enable-push.pl
index 439068a..848cfdc 100644
--- a/spacewalk/setup/share/upgrade/rhn-enable-push.pl
+++ b/spacewalk/setup/share/upgrade/rhn-enable-push.pl
@@ -30,7 +30,7 @@ my $usage = "usage: $0 [ --hostname=<override_hostname> ] [ --ssl-dir=<ssl_build
. " [ --pub-ssl-cert=<public_ssl_certificate> ] [ --force ]"
. " [ --help ]\n";
-GetOptions(\%opts, @valid_opts);
+GetOptions(\%opts, @valid_opts) or die $usage;
if ($opts{help}) {
die $usage;
diff --git a/spacewalk/setup/share/upgrade/rhn-load-config.pl b/spacewalk/setup/share/upgrade/rhn-load-config.pl
index 0664fa0..33eb7f3 100755
--- a/spacewalk/setup/share/upgrade/rhn-load-config.pl
+++ b/spacewalk/setup/share/upgrade/rhn-load-config.pl
@@ -32,7 +32,7 @@ my $usage = "usage: $0 [ --force ]"
. " [ --disable-solaris ]"
. " [ --help ]\n";
-GetOptions(\%opts, @valid_opts);
+GetOptions(\%opts, @valid_opts) or die $usage;
if ($opts{help}) {
die $usage;
13 years, 6 months
spacewalk/admin
by Jan Pazdziora
spacewalk/admin/rhn-config-satellite.pl | 4 ++--
spacewalk/admin/rhn-config-schema.pl | 2 +-
spacewalk/admin/rhn-config-tnsnames.pl | 4 ++--
spacewalk/admin/rhn-deploy-ca-cert.pl | 4 ++--
spacewalk/admin/rhn-generate-pem.pl | 4 ++--
spacewalk/admin/rhn-install-ssl-cert.pl | 4 ++--
spacewalk/admin/rhn-load-ssl-cert.pl | 2 +-
spacewalk/admin/rhn-populate-database.pl | 2 +-
spacewalk/admin/validate-sat-cert.pl | 4 ++--
9 files changed, 15 insertions(+), 15 deletions(-)
New commits:
commit 93b41c6dbe706349373b0211a81665d6f9a9e96a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:11:36 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/spacewalk/admin/rhn-config-satellite.pl b/spacewalk/admin/rhn-config-satellite.pl
index e49b065..7e89842 100755
--- a/spacewalk/admin/rhn-config-satellite.pl
+++ b/spacewalk/admin/rhn-config-satellite.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -29,7 +29,7 @@ my $target = '';
my @options = ();
my $help = '';
-GetOptions("target=s" => \$target, "option=s" => \@options, "help" => \$help);
+GetOptions("target=s" => \$target, "option=s" => \@options, "help" => \$help) or die $usage;
if ($help) {
die $usage;
diff --git a/spacewalk/admin/rhn-config-schema.pl b/spacewalk/admin/rhn-config-schema.pl
index e9c89cc..ac60f7c 100755
--- a/spacewalk/admin/rhn-config-schema.pl
+++ b/spacewalk/admin/rhn-config-schema.pl
@@ -33,7 +33,7 @@ my $tablespace_name = '';
my $help = '';
GetOptions("source=s" => \$source, "target=s" => \$target,
- "tablespace-name=s" => \$tablespace_name, "help" => \$help);
+ "tablespace-name=s" => \$tablespace_name, "help" => \$help) or die $usage;
if ($help or not ($source and $target and $tablespace_name)) {
die $usage;
diff --git a/spacewalk/admin/rhn-config-tnsnames.pl b/spacewalk/admin/rhn-config-tnsnames.pl
index 554dab7..2b2871f 100755
--- a/spacewalk/admin/rhn-config-tnsnames.pl
+++ b/spacewalk/admin/rhn-config-tnsnames.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -32,7 +32,7 @@ my $sid = '';
my @options = ();
my $help = '';
-GetOptions("target=s" => \$target, "sid=s" => \$sid, "address=s" => \@options, "help" => \$help);
+GetOptions("target=s" => \$target, "sid=s" => \$sid, "address=s" => \@options, "help" => \$help) or die $usage;
if ($help) {
die $usage;
diff --git a/spacewalk/admin/rhn-deploy-ca-cert.pl b/spacewalk/admin/rhn-deploy-ca-cert.pl
index a4dd419..b698077 100755
--- a/spacewalk/admin/rhn-deploy-ca-cert.pl
+++ b/spacewalk/admin/rhn-deploy-ca-cert.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -32,7 +32,7 @@ my $source_dir = '';
my $target_dir = '';
my $help = '';
-GetOptions("source-dir=s" => \$source_dir, "target-dir=s" => \$target_dir, "help" => \$help);
+GetOptions("source-dir=s" => \$source_dir, "target-dir=s" => \$target_dir, "help" => \$help) or die $usage;
if ($help or not ($source_dir and $target_dir)) {
die $usage;
diff --git a/spacewalk/admin/rhn-generate-pem.pl b/spacewalk/admin/rhn-generate-pem.pl
index 3399e11..0845b47 100644
--- a/spacewalk/admin/rhn-generate-pem.pl
+++ b/spacewalk/admin/rhn-generate-pem.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -32,7 +32,7 @@ my $ssl_dir = '';
my $out_file = '';
my $help = '';
-GetOptions("ssl-dir=s" => \$ssl_dir, "out-file:s" => \$out_file, "help" => \$help);
+GetOptions("ssl-dir=s" => \$ssl_dir, "out-file:s" => \$out_file, "help" => \$help) or die $usage;
if ($help or not $ssl_dir) {
die $usage;
diff --git a/spacewalk/admin/rhn-install-ssl-cert.pl b/spacewalk/admin/rhn-install-ssl-cert.pl
index 41d62d0..6531bc2 100755
--- a/spacewalk/admin/rhn-install-ssl-cert.pl
+++ b/spacewalk/admin/rhn-install-ssl-cert.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -31,7 +31,7 @@ my $usage = "usage: $0 --dir=<directory> [ --help ]\n";
my $dir = '';
my $help = '';
-GetOptions("dir=s" => \$dir, "help" => \$help);
+GetOptions("dir=s" => \$dir, "help" => \$help) or die $usage;
if ($help or not $dir) {
die $usage;
diff --git a/spacewalk/admin/rhn-load-ssl-cert.pl b/spacewalk/admin/rhn-load-ssl-cert.pl
index 07874cf..c5ff403 100644
--- a/spacewalk/admin/rhn-load-ssl-cert.pl
+++ b/spacewalk/admin/rhn-load-ssl-cert.pl
@@ -41,7 +41,7 @@ my $org_id;
my $help;
GetOptions("ssl-dir=s" => \$ssl_dir, "hostname=s" => \$hostname,
- "channel=s" => \$channel, "org-id=i" => \$org_id, "version=s" => \$version, "help" => \$help);
+ "channel=s" => \$channel, "org-id=i" => \$org_id, "version=s" => \$version, "help" => \$help) or die $usage;
if ($help or not ($ssl_dir and $hostname and $channel and $org_id)) {
die $usage;
diff --git a/spacewalk/admin/rhn-populate-database.pl b/spacewalk/admin/rhn-populate-database.pl
index 177875c..ad6d661 100755
--- a/spacewalk/admin/rhn-populate-database.pl
+++ b/spacewalk/admin/rhn-populate-database.pl
@@ -49,7 +49,7 @@ GetOptions("host=s" => \$host, "port=s" => \$port,
"user=s" => \$user, "password=s" => \$password,
"database=s" => \$database, "schema-deploy-file=s" => \$schema_deploy_file,
"log=s" => \$log_file, "help" => \$help, "clear-db" => \$clear_db,
- "postgresql" => \$postgresql);
+ "postgresql" => \$postgresql) or die $usage;
if ($help
or not ($user and $password and $database and $schema_deploy_file)) {
diff --git a/spacewalk/admin/validate-sat-cert.pl b/spacewalk/admin/validate-sat-cert.pl
index 6e19dfa..690bb33 100755
--- a/spacewalk/admin/validate-sat-cert.pl
+++ b/spacewalk/admin/validate-sat-cert.pl
@@ -1,6 +1,6 @@
#!/usr/bin/perl
#
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -31,7 +31,7 @@ my $nosig;
my $allow_old;
GetOptions("keyring=s", \$keyring, "quiet" => \$quiet, "nosig" => \$nosig, "allow-old" => \$allow_old,
- "required-version=s" => \$required_version, "help" => \$show_help);
+ "required-version=s" => \$required_version, "help" => \$show_help) or die $usage;
if ($show_help) {
print "See 'man validate-sat-cert' for details on usage.\n";
13 years, 6 months
scripts/gen-oss-sat-cert.pl
by Jan Pazdziora
scripts/gen-oss-sat-cert.pl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 91e870a3b814d3db52894b30d5aa58e974aa8f6b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:06:47 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/scripts/gen-oss-sat-cert.pl b/scripts/gen-oss-sat-cert.pl
index 17a53aa..8aac952 100755
--- a/scripts/gen-oss-sat-cert.pl
+++ b/scripts/gen-oss-sat-cert.pl
@@ -38,17 +38,18 @@ sub passphrase_prompt {
return $passphrase;
}
+my $usage = "Usage: $0 --orgid <org_id> --owner <owner_name> --signer <signer> --no-passphrase --output <dest> --expires <when> --slots <num> [ --provisioning-slots <num> ] [ --channel-family label=n ] [ --satellite-version X.Y ]";
GetOptions("output=s" => \$filename, "orgid=n" => \$org_id,
"owner=s" => \$owner, "signer=s" => \$signer,
"no-passphrase" => \$no_passphrase,
"expires=s" => \$expires, "slots=n" => \$slots, "provisioning-slots=n" => \$provisioning_slots,
"channel-family=n" => \%channel_families,
"generation=s" => \$generation,
- "resign=s" => \$resign, "satellite-version=s" => \$sat_version);
+ "resign=s" => \$resign, "satellite-version=s" => \$sat_version) or die $usage;
$filename = $resign if $resign and not $filename;
-die "Usage: $0 --orgid <org_id> --owner <owner_name> --signer <signer> --no-passphrase --output <dest> --expires <when> --slots <num> [ --provisioning-slots <num> ] [ --channel-family label=n ] [ --satellite-version X.Y ]"
+die $usage
unless $filename && $signer && ($resign || ($expires && $slots && $owner));
my $passphrase = $no_passphrase ? undef : passphrase_prompt();
13 years, 6 months
projects/perl-Satcon
by Jan Pazdziora
projects/perl-Satcon/bin/satcon-build-dictionary.pl | 4 ++--
projects/perl-Satcon/bin/satcon-deploy-tree.pl | 4 ++--
projects/perl-Satcon/bin/satcon-make-rpm.pl | 13 ++++++++++---
3 files changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 711705a3d3160d854f1fe11335630c044b60bc28
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Dec 9 10:05:11 2010 +0100
We need to check the return value of GetOptions and die if the parameters were not correct.
diff --git a/projects/perl-Satcon/bin/satcon-build-dictionary.pl b/projects/perl-Satcon/bin/satcon-build-dictionary.pl
index 9f98d21..543f05c 100755
--- a/projects/perl-Satcon/bin/satcon-build-dictionary.pl
+++ b/projects/perl-Satcon/bin/satcon-build-dictionary.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -28,7 +28,7 @@ my $close = '@@';
my $help = '';
GetOptions("tree=s" => \$sourcedir, "target:s" => \$target,
- "start-delim:s" => \$open, "end-delim:s" => \$close);
+ "start-delim:s" => \$open, "end-delim:s" => \$close) or die $usage;
die $usage unless $sourcedir;
diff --git a/projects/perl-Satcon/bin/satcon-deploy-tree.pl b/projects/perl-Satcon/bin/satcon-deploy-tree.pl
index 7b9163d..7f50673 100755
--- a/projects/perl-Satcon/bin/satcon-deploy-tree.pl
+++ b/projects/perl-Satcon/bin/satcon-deploy-tree.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -35,7 +35,7 @@ my $help = '';
GetOptions("source=s" => \$sourcedir, "dest=s" => \$destdir,
"conf=s" => \$conf_file, "start-delim:s" => \$open,
- "end-delim:s" => \$close, "backupdir=s" => \$backupdir);
+ "end-delim:s" => \$close, "backupdir=s" => \$backupdir) or die $usage;
die $usage unless ($sourcedir and $destdir and $conf_file);
diff --git a/projects/perl-Satcon/bin/satcon-make-rpm.pl b/projects/perl-Satcon/bin/satcon-make-rpm.pl
index 2406496..a043e77 100755
--- a/projects/perl-Satcon/bin/satcon-make-rpm.pl
+++ b/projects/perl-Satcon/bin/satcon-make-rpm.pl
@@ -1,5 +1,5 @@
#!/usr/bin/perl -w
-# Copyright (c) 2008 Red Hat, Inc.
+# Copyright (c) 2008--2010 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
@@ -34,9 +34,16 @@ my $substitute;
my $conf;
my $sourcedir;
-GetOptions('name=s' => \$name, 'version=s' => \$version, 'release=s' => \$release, 'destdir=s' => \$basedir, 'conf=s' => \$conf, 'sourcedir=s' => \$sourcedir, 'prerender=s' => \$substitute);
+my $usage = "Usage: $0 -n name -v version -r release -c masterconf -s sourcetree [ -d destdir ]";
+GetOptions('name=s' => \$name,
+ 'version=s' => \$version,
+ 'release=s' => \$release,
+ 'destdir=s' => \$basedir,
+ 'conf=s' => \$conf,
+ 'sourcedir=s' => \$sourcedir,
+ 'prerender=s' => \$substitute) or die $usage;
-die "Usage: $0 -n name -v version -r release -c masterconf -s sourcetree [ -d destdir ]"
+die $usage
unless defined $conf and defined $sourcedir and defined $name and defined $version and defined $release;
$basedir ||= '/';
13 years, 6 months
schema/spacewalk
by Justin Sherrill
schema/spacewalk/oracle/packages/rhn_channel.pkb | 5
schema/spacewalk/postgres/packages/rhn_channel.pkb | 5
schema/spacewalk/upgrade/spacewalk-schema-1.2-to-spacewalk-schema-1.3/004-rhn_channel.pkb | 1212 ++++++++++
3 files changed, 1214 insertions(+), 8 deletions(-)
New commits:
commit 01ee646ff576168258b8bef550f028bf2b6c3175
Author: Justin Sherrill <jsherril(a)redhat.com>
Date: Wed Dec 8 15:55:41 2010 -0500
661109 - fixing issue where channel subscription would not use a flex guest subscription if the system already was using a flex guest subscription for a different channel
diff --git a/schema/spacewalk/oracle/packages/rhn_channel.pkb b/schema/spacewalk/oracle/packages/rhn_channel.pkb
index 096c001..027f722 100644
--- a/schema/spacewalk/oracle/packages/rhn_channel.pkb
+++ b/schema/spacewalk/oracle/packages/rhn_channel.pkb
@@ -279,10 +279,7 @@ IS
CURSOR vi_entries IS
SELECT 1
FROM rhnVirtualInstance vi
- WHERE vi.virtual_system_id = server_id_in
- and not exists(select server_id from rhnServerChannel sc where
- sc.server_id = vi.virtual_system_id
- and sc.is_fve='Y');
+ WHERE vi.virtual_system_id = server_id_in;
vi_count NUMBER;
BEGIN
diff --git a/schema/spacewalk/postgres/packages/rhn_channel.pkb b/schema/spacewalk/postgres/packages/rhn_channel.pkb
index 6da765f..19c32e6 100644
--- a/schema/spacewalk/postgres/packages/rhn_channel.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_channel.pkb
@@ -233,10 +233,7 @@ update pg_settings set setting = 'rhn_channel,' || setting where name = 'search_
vi_entries cursor for
SELECT 1
FROM rhnVirtualInstance vi
- WHERE vi.virtual_system_id = server_id_in
- and not exists(select server_id from rhnServerChannel sc where
- sc.server_id = vi.virtual_system_id
- and sc.is_fve='Y');
+ WHERE vi.virtual_system_id = server_id_in;
vi_count numeric;
begin
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.2-to-spacewalk-schema-1.3/004-rhn_channel.pkb b/schema/spacewalk/upgrade/spacewalk-schema-1.2-to-spacewalk-schema-1.3/004-rhn_channel.pkb
new file mode 100644
index 0000000..bdf0508
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.2-to-spacewalk-schema-1.3/004-rhn_channel.pkb
@@ -0,0 +1,1212 @@
+--
+-- Copyright (c) 2008--2010 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.
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_channel
+IS
+ body_version varchar2(100) := '';
+
+ -- Cursor that fetches all the possible base channels for a
+ -- (server_arch_id, release, org_id) combination
+ cursor base_channel_cursor(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number
+ ) return rhnChannel%ROWTYPE is
+ select distinct c.*
+ from rhnDistChannelMap dcm,
+ rhnServerChannelArchCompat scac,
+ rhnChannel c,
+ rhnChannelPermissions cp
+ where cp.org_id = org_id_in
+ and cp.channel_id = c.id
+ and c.parent_channel is null
+ and c.id = dcm.channel_id
+ and c.channel_arch_id = dcm.channel_arch_id
+ and dcm.release = release_in
+ and scac.server_arch_id = server_arch_id_in
+ and scac.channel_arch_id = c.channel_arch_id;
+
+ procedure obtain_read_lock(channel_family_id_in in number, org_id_in in number)
+ is
+ read_lock date;
+
+ begin
+ select created into read_lock
+ from rhnPrivateChannelFamily
+ where channel_family_id = channel_family_id_in and org_id = org_id_in
+ for update;
+ end obtain_read_lock;
+
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null, recalcfamily_in number := 1)
+ IS
+ channel_parent_val rhnChannel.parent_channel%TYPE;
+ parent_subscribed BOOLEAN;
+ server_has_base_chan BOOLEAN;
+ server_already_in_chan BOOLEAN;
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ available_fve_subs NUMBER;
+ consenting_user NUMBER;
+ allowed number := 0;
+ is_fve CHAR(1) := 'N';
+ BEGIN
+ if user_id_in is not null then
+ allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
+ else
+ allowed := 1;
+ end if;
+
+ if allowed = 0 then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+
+
+ SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
+
+ IF channel_parent_val IS NOT NULL
+ THEN
+ -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
+ parent_subscribed := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
+ LOOP
+ parent_subscribed := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT parent_subscribed
+ THEN
+ RETURN;
+ END IF;
+ ELSE
+ -- base channel
+ server_has_base_chan := FALSE;
+ FOR base IN server_base_subscriptions(server_id_in)
+ LOOP
+ server_has_base_chan := TRUE;
+ END LOOP base;
+
+ IF server_has_base_chan
+ THEN
+ rhn_exception.raise_exception('channel_server_one_base');
+ END IF;
+ END IF;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ --
+ -- Use the org_id of the server only if the org_id of the channel = NULL.
+ -- This is required for subscribing to shared channels.
+ --
+ SELECT NVL(org_id, (SELECT org_id FROM rhnServer WHERE id = server_id_in))
+ INTO server_org_id_val
+ FROM rhnChannel
+ WHERE id = channel_id_in;
+
+ begin
+ obtain_read_lock(channel_family_id_val, server_org_id_val);
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ end;
+
+ available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
+ available_fve_subs := rhn_channel.available_fve_family_subs(channel_family_id_val, server_org_id_val);
+
+ IF available_subscriptions IS NULL OR
+ available_subscriptions > 0 or
+ can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1 OR
+ (available_fve_subs > 0 AND can_server_consume_fve(server_id_in) = 1)
+ THEN
+ if can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 0 AND available_fve_subs > 0 AND can_server_consume_fve(server_id_in) = 1 THEN
+ is_fve := 'Y';
+ END IF;
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ INSERT INTO rhnServerChannel (server_id, channel_id, is_fve) VALUES (server_id_in, channel_id_in, is_fve);
+ IF recalcfamily_in > 0
+ THEN
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ END IF;
+ queue_server(server_id_in, immediate_in);
+ ELSE
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ END IF;
+
+ END subscribe_server;
+
+
+
+ FUNCTION can_convert_to_fve(server_id_in IN NUMBER, channel_family_id_val IN NUMBER)
+ RETURN NUMBER
+ IS
+ CURSOR fve_convertible_entries IS
+ select 1 from
+ rhnServerFveCapable cap
+ where cap.server_id = server_id_in
+ AND cap.channel_family_id = channel_family_id_val;
+ BEGIN
+ FOR entry IN fve_convertible_entries LOOP
+ return 1;
+ END LOOP;
+ RETURN 0;
+ END can_convert_to_fve;
+
+
+
+ -- Converts server channel_family to use a flex entitlement
+ PROCEDURE convert_to_fve(server_id_in IN NUMBER, channel_family_id_val IN NUMBER)
+ IS
+ available_fve_subs NUMBER;
+ server_org_id_val NUMBER;
+ BEGIN
+
+ --
+ -- Use the org_id of the server only if the org_id of the channel = NULL.
+ -- This is required for subscribing to shared channels.
+ --
+ SELECT org_id
+ INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ begin
+ obtain_read_lock(channel_family_id_val, server_org_id_val);
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ end;
+ IF (can_convert_to_fve(server_id_in, channel_family_id_val ) = 0)
+ THEN
+ rhn_exception.raise_exception('server_cannot_convert_to_flex');
+ END IF;
+
+ available_fve_subs := rhn_channel.available_fve_family_subs(channel_family_id_val, server_org_id_val);
+
+ IF (available_fve_subs > 0)
+ THEN
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'converted to flex entitlement' || SUBSTR(cf.label, 0, 99),
+ cf.label
+ from rhnChannelFamily cf
+ where cf.id = channel_family_id_val
+ );
+
+ UPDATE rhnServerChannel sc set sc.is_fve = 'Y'
+ where sc.server_id = server_id_in and
+ sc.channel_id in
+ (select cfm.channel_id from rhnChannelFamilyMembers cfm
+ where cfm.CHANNEL_FAMILY_ID = channel_family_id_val);
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ ELSE
+ rhn_exception.raise_exception('not_enough_flex_entitlements');
+ END IF;
+
+ END convert_to_fve;
+
+ function can_server_consume_virt_channl(
+ server_id_in in number,
+ family_id_in in number )
+ return number
+ is
+
+ cursor server_virt_families is
+ select vi.virtual_system_id, cfvsl.channel_family_id
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnVirtualInstance vi
+ where
+ vi.virtual_system_id = server_id_in
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ and cfvsl.channel_family_id = family_id_in
+ and exists (
+ select 1
+ from rhnServerEntitlementView sev
+ where vi.host_system_id = sev.server_id
+ and sev.server_group_type_id = sgtvsl.server_group_type_id );
+ begin
+
+ for server_virt_family in server_virt_families loop
+ return 1;
+ end loop;
+
+ return 0;
+
+ end;
+
+ FUNCTION can_server_consume_fve(server_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ CURSOR vi_entries IS
+ SELECT 1
+ FROM rhnVirtualInstance vi
+ WHERE vi.virtual_system_id = server_id_in;
+ vi_count NUMBER;
+
+ BEGIN
+ FOR vi_entry IN VI_ENTRIES LOOP
+ return 1;
+ END LOOP;
+ RETURN 0;
+ END;
+
+ function guess_server_base(
+ server_id_in in number
+ ) RETURN number is
+ cursor server_cursor is
+ select s.server_arch_id, s.release, s.org_id
+ from rhnServer s
+ where s.id = server_id_in;
+ begin
+ for s in server_cursor loop
+ for channel in base_channel_cursor(s.release,
+ s.server_arch_id, s.org_id)
+ loop
+ return channel.id;
+ end loop base_channel_cursor;
+ end loop server_cursor;
+ -- Server not found, or no base channel applies to it
+ return null;
+ end;
+
+ -- Private function
+ function normalize_server_arch(server_arch_in in varchar2)
+ return varchar2
+ deterministic
+ is
+ suffix VARCHAR2(128) := '-redhat-linux';
+ suffix_len NUMBER := length(suffix);
+ begin
+ if server_arch_in is NULL then
+ return NULL;
+ end if;
+ if instr(server_arch_in, '-') > 0
+ then
+ -- Suffix already present
+ return server_arch_in;
+ end if;
+ return server_arch_in || suffix;
+ end normalize_server_arch;
+
+ --
+ --
+ -- Raises:
+ -- server_arch_not_found
+ -- no_subscribe_permissions
+ function base_channel_for_release_arch(
+ release_in in varchar2,
+ server_arch_in in varchar2,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ server_arch varchar2(256) := normalize_server_arch(server_arch_in);
+ server_arch_id number;
+ begin
+ -- Look up the server arch
+ begin
+ select id
+ into server_arch_id
+ from rhnServerArch
+ where label = server_arch;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('server_arch_not_found');
+ end;
+ return base_channel_rel_archid(release_in, server_arch_id,
+ org_id_in, user_id_in);
+ end base_channel_for_release_arch;
+
+ function base_channel_rel_archid(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ denied_channel_id number := null;
+ valid_org_id number := org_id_in;
+ valid_user_id number := user_id_in;
+ channel_subscribable number;
+ begin
+ if org_id_in = -1 and user_id_in is not null then
+ -- Get the org id from the user id
+ begin
+ select org_id
+ into valid_org_id
+ from web_contact
+ where id = user_id_in;
+ exception
+ when no_data_found then
+ -- User doesn't exist
+ -- XXX Only list public stuff for now
+ valid_user_id := null;
+ valid_org_id := -1;
+ end;
+ end if;
+
+ for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
+ loop
+ -- This row is a possible match
+ if valid_user_id is null then
+ -- User ID not specified, so no user to channel permissions to
+ -- check
+ return c.id;
+ end if;
+
+ -- Check user to channel permissions
+ select loose_user_role_check(c.id, user_id_in, 'subscribe')
+ into channel_subscribable
+ from dual;
+
+ if channel_subscribable = 1 then
+ return c.id;
+ end if;
+
+ -- Base channel exists, but is not subscribable; keep trying
+ denied_channel_id := c.id;
+ end loop base_channel_fetch;
+
+ if denied_channel_id is not null then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+ -- No base channel applies
+ return NULL;
+ end base_channel_rel_archid;
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0,
+ update_family_countsYN IN NUMBER := 1)
+ IS
+ cursor server_channels(server_id_in in number) is
+ select s.org_id, sc.channel_id, cfm.channel_family_id
+ from rhnServer s,
+ rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where s.id = server_id_in
+ and s.id = sc.server_id
+ and sc.channel_id = cfm.channel_id
+ order by cfm.channel_family_id;
+ last_channel_family_id rhnChannelFamilyMembers.channel_family_id%type := -1;
+ last_channel_org_id rhnServer.org_id%type := -1;
+ BEGIN
+ for channel in server_channels(server_id_in)
+ loop
+ unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server, 0);
+ if update_family_countsYN > 0
+ and channel.channel_family_id != last_channel_family_id then
+ -- update family counts only once
+ -- after all channels with same family has been fetched
+ if last_channel_family_id != -1 then
+ update_family_counts(last_channel_family_id, last_channel_org_id);
+ end if;
+ last_channel_family_id := channel.channel_family_id;
+ last_channel_org_id := channel.org_id;
+ end if;
+ end loop channel;
+ if update_family_countsYN > 0 and last_channel_family_id != -1 then
+ -- update the last family fetched
+ update_family_counts(last_channel_family_id, last_channel_org_id);
+ end if;
+ END clear_subscriptions;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server IN NUMBER := 0,
+ update_family_countsYN IN NUMBER := 1)
+ IS
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ server_already_in_chan BOOLEAN;
+ cursor channel_family_is_proxy(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-proxy';
+ cursor channel_family_is_satellite(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-satellite';
+ -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
+ -- with the package-level one, we get a "cursor already open", so we need a
+ -- copy on our call stack instead. GROAN.
+ cursor local_chk_server_parent_memb (
+ server_id_in number,
+ channel_id_in number ) is
+ select c.id
+ from rhnChannel c,
+ rhnServerChannel sc
+ where 1=1
+ and c.parent_channel = channel_id_in
+ and c.id = sc.channel_id
+ and sc.server_id = server_id_in;
+ BEGIN
+ FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
+ LOOP
+ if unsubscribe_children_in = 1 then
+ unsubscribe_server(server_id_in => server_id_in,
+ channel_id_in => child.id,
+ immediate_in => immediate_in,
+ unsubscribe_children_in => unsubscribe_children_in,
+ deleting_server => deleting_server,
+ update_family_countsYN => update_family_countsYN);
+ else
+ rhn_exception.raise_exception('channel_unsubscribe_child_exists');
+ end if;
+ END LOOP child;
+
+ server_already_in_chan := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ if deleting_server = 0 then
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ end if;
+
+ DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
+
+ if deleting_server = 0 then
+ queue_server(server_id_in, immediate_in);
+ end if;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_unsubscribe_no_family');
+ END IF;
+
+ for ignore in channel_family_is_satellite(channel_family_id_val) loop
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ end loop;
+
+ for ignore in channel_family_is_proxy(channel_family_id_val) loop
+ delete from rhnProxyInfo where server_id = server_id_in;
+ end loop;
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ if update_family_countsYN = 1 then
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ end if;
+ END unsubscribe_server;
+
+
+ FUNCTION family_for_channel(channel_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN channel_family_id_val;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END family_for_channel;
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ cfp channel_family_perm_cursor%ROWTYPE;
+ current_members_val NUMBER;
+ max_members_val NUMBER;
+ found NUMBER;
+ BEGIN
+ IF NOT channel_family_perm_cursor%ISOPEN
+ THEN
+ OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
+ END IF;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+
+ WHILE channel_family_perm_cursor%FOUND
+ LOOP
+ found := 1;
+
+ current_members_val := cfp.current_members;
+ max_members_val := cfp.max_members;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+ END LOOP;
+
+ IF channel_family_perm_cursor%ISOPEN
+ THEN
+ CLOSE channel_family_perm_cursor;
+ END IF;
+
+ -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
+ -- either way, there are no available subscriptions
+
+ IF found IS NULL
+ THEN
+ RETURN 0;
+ END IF;
+
+ -- null max members? in that case, pass it on; NULL means infinite
+ IF max_members_val IS NULL
+ THEN
+ RETURN NULL;
+ END IF;
+
+ -- otherwise, return the delta
+ RETURN max_members_val - current_members_val;
+ END available_family_subscriptions;
+
+ FUNCTION available_fve_family_subs(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ cfp channel_family_perm_cursor%ROWTYPE;
+ fve_current_members_val NUMBER;
+ fve_max_members_val NUMBER;
+ found NUMBER;
+
+ BEGIN
+ IF NOT channel_family_perm_cursor%ISOPEN THEN
+ OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
+ END IF;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+
+ WHILE channel_family_perm_cursor%FOUND LOOP
+ found := 1;
+ fve_current_members_val := cfp.fve_current_members;
+ fve_max_members_val := cfp.fve_max_members;
+ FETCH channel_family_perm_cursor INTO cfp;
+ END LOOP;
+
+ IF channel_family_perm_cursor%ISOPEN THEN
+ CLOSE channel_family_perm_cursor;
+ END IF;
+
+ IF found IS NULL THEN
+ RETURN 0;
+ END IF;
+
+ IF fve_max_members_val IS NULL THEN
+ RETURN NULL;
+ END IF;
+
+ RETURN fve_max_members_val - fve_current_members_val;
+
+ END available_fve_family_subs;
+
+
+ -- *******************************************************************
+ -- FUNCTION: channel_family_current_members
+ -- Calculates and returns the actual count of systems consuming
+ -- physical channel subscriptions.
+ -- Called by: update_family_counts
+ -- rhn_entitlements.repoll_virt_guest_entitlements
+ -- *******************************************************************
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number
+ is
+ current_members_count number := 0;
+ begin
+ select count(distinct server_id)
+ into current_members_count
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.channel_family_id = channel_family_id_in
+ and cfsp.customer_id = org_id_in;
+ return current_members_count;
+ end;
+
+
+ function cfam_curr_fve_members(
+ channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number
+ is
+ current_members_count number := 0;
+
+ begin
+ select count(sc.server_id)
+ into current_members_count
+ from rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm,
+ rhnServer s
+ where s.org_id = org_id_in
+ and s.id = sc.server_id
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and exists (
+ select 1
+ from rhnChannelFamilyServerFve cfsp
+ where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
+ and cfsp.server_id = s.id
+ );
+
+ return current_members_count;
+ end;
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ IS
+ BEGIN
+ update rhnPrivateChannelFamily
+ set current_members = ( channel_family_current_members(channel_family_id_in, org_id_in)),
+ fve_current_members = ( cfam_curr_fve_members(channel_family_id_in, org_id_in))
+ where org_id = org_id_in
+ and channel_family_id = channel_family_id_in;
+ END update_family_counts;
+
+ PROCEDURE update_group_family_counts(group_label_in IN VARCHAR2,
+ org_id_in IN NUMBER)
+ IS
+ BEGIN
+ FOR i IN (
+ SELECT DISTINCT CFM.channel_family_id, SG.org_id
+ FROM rhnChannelFamilyMembers CFM
+ JOIN rhnServerChannel SC
+ ON SC.channel_id = CFM.channel_id
+ JOIN rhnServerGroupMembers SGM
+ ON SC.server_id = SGM.server_id
+ JOIN rhnServerGroup SG
+ ON SGM.server_group_id = SG.id
+ JOIN rhnServerGroupType SGT
+ ON SG.group_type = SGT.id
+ WHERE SGT.label = group_label_in
+ AND SG.org_id = org_id_in
+ AND SGT.is_base = 'Y'
+ ) LOOP
+ rhn_channel.update_family_counts(i.channel_family_id, i.org_id);
+ END LOOP;
+ END update_group_family_counts;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN rhn_channel.available_family_subscriptions(
+ channel_family_id_val, org_id_in);
+ END available_chan_subscriptions;
+
+ FUNCTION available_fve_chan_subs(channel_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN rhn_channel.available_fve_family_subs( channel_family_id_val, org_id_in);
+ END available_fve_chan_subs;
+
+ procedure unsubscribe_server_from_family(server_id_in in number,
+ channel_family_id_in in number)
+ is
+ begin
+ delete
+ from rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and channel_id in (
+ select rcfm.channel_id
+ from rhnChannelFamilyMembers rcfm
+ where rcfm.channel_family_id = channel_family_id_in);
+ end;
+
+ function get_org_id(channel_id_in in number)
+ return number
+ is
+ org_id_out number;
+ begin
+ select org_id into org_id_out
+ from rhnChannel
+ where id = channel_id_in;
+
+ return org_id_out;
+ end get_org_id;
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
+ return number
+ is
+ cursor families is
+ select 1
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = org_id_in;
+ begin
+ -- the idea: if we get past this query,
+ -- the user has the role, else catch the exception and return 0
+ for family in families loop
+ return 1;
+ end loop;
+ return 0;
+ end;
+
+ function get_org_access(channel_id_in in number, org_id_in in number)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query,
+ -- the org has access to the channel, else catch the exception and return 0
+ select distinct 1 into throwaway
+ from rhnChannelFamilyMembers CFM,
+ rhnOrgChannelFamilyPermissions CFP
+ where cfp.org_id = org_id_in
+ and CFM.channel_family_id = CFP.channel_family_id
+ and CFM.channel_id = channel_id_in
+ and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if a user has a given role, or if such a role is inferrable
+ function user_role_check_debug(channel_id_in in number,
+ user_id_in in number,
+ role_in in varchar2,
+ reason_out out varchar2)
+ return number
+ is
+ org_id number;
+ begin
+ org_id := rhn_user.get_org_id(user_id_in);
+
+ -- channel might be shared
+ if role_in = 'subscribe' and
+ rhn_channel.shared_user_role_check(channel_id_in, user_id_in, role_in) = 1 then
+ return 1;
+ end if;
+
+ if role_in = 'manage' and
+ NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
+ reason_out := 'channel_not_owned';
+ return 0;
+ end if;
+
+ if role_in = 'subscribe' and
+ rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
+ reason_out := 'channel_not_available';
+ return 0;
+ end if;
+
+ -- channel admins have all roles
+ if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
+ reason_out := 'channel_admin';
+ return 1;
+ end if;
+
+ -- the subscribe permission is inferred
+ -- UNLESS the not_globally_subscribable flag is set
+ if role_in = 'subscribe'
+ then
+ if rhn_channel.org_channel_setting(channel_id_in,
+ org_id,
+ 'not_globally_subscribable') = 0 then
+ reason_out := 'globally_subscribable';
+ return 1;
+ end if;
+ end if;
+
+ -- all other roles (manage right now) are explicitly granted
+ reason_out := 'direct_permission';
+ return rhn_channel.direct_user_role_check(channel_id_in,
+ user_id_in, role_in);
+ end;
+
+ -- same as above, but with no OUT param; useful in views, etc
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway varchar2(256);
+ begin
+ return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
+ end;
+
+ --
+ -- For multiorg phase II, this function simply checks to see if the user's
+ -- has a trust relationship that includes this channel by id.
+ --
+ function shared_user_role_check(channel_id in number, user_id in number, role in varchar2)
+ return number
+ is
+ n number;
+ oid number;
+ begin
+ oid := rhn_user.get_org_id(user_id);
+ select 1 into n
+ from rhnSharedChannelView s
+ where s.id = channel_id and s.org_trust_id = oid;
+ return 1;
+ exception
+ when no_data_found then
+ return 0;
+ end;
+
+ -- same as above, but returns 1 if user_id_in is null
+ -- This is useful in queries where user_id is not specified
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ begin
+ if user_id_in is null then
+ return 1;
+ end if;
+ return user_role_check(channel_id_in, user_id_in, role_in);
+ end loose_user_role_check;
+
+ -- directly checks the table, no inferred permissions
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnChannelPermissionRole CPR,
+ rhnChannelPermission CP
+ where CP.user_id = user_id_in
+ and CP.channel_id = channel_id_in
+ and CPR.label = role_in
+ and CP.role_id = CPR.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if an org has a certain setting
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnOrgChannelSettingsType OCST,
+ rhnOrgChannelSettings OCS
+ where OCS.org_id = org_id_in
+ and OCS.channel_id = channel_id_in
+ and OCST.label = setting_in
+ and OCS.setting_id = OCST.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ FUNCTION channel_priority(channel_id_in IN number)
+ RETURN number
+ IS
+ channel_name varchar2(256);
+ priority number;
+ end_of_life_val date;
+ org_id_val number;
+ BEGIN
+
+ select name, end_of_life, org_id
+ into channel_name, end_of_life_val, org_id_val
+ from rhnChannel
+ where id = channel_id_in;
+
+ if end_of_life_val is not null then
+ return -400;
+ end if;
+
+ if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
+ priority := 1000;
+ if channel_name not like '%Beta%' then
+ priority := priority + 1000;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 5%' then 600
+ when channel_name like '%v. 4%' then 500
+ when channel_name like '%v. 3%' then 400
+ when channel_name like '%v. 2%' then 300
+ when channel_name like '%v. 1%' then 200
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
+ when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
+ when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
+ when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
+ when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
+ when channel_name like '%Extras%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%)' then 5
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+ elsif channel_name like 'Red Hat Desktop%' then
+ priority := 900;
+
+ if channel_name not like '%Beta%' then
+ priority := priority + 50;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 4%' then 40
+ when channel_name like '%v. 3%' then 30
+ when channel_name like '%v. 2%' then 20
+ when channel_name like '%v. 1%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+
+ elsif org_id_val is not null then
+ priority := 600;
+ else
+ priority := 500;
+ end if;
+
+ return -priority;
+
+ end channel_priority;
+
+ -- right now this only does the accounting changes; the cascade
+ -- actually does the rhnServerChannel delete.
+ procedure delete_server_channels(server_id_in in number)
+ is
+ begin
+ update rhnPrivateChannelFamily
+ set current_members = current_members -1
+ where org_id in (
+ select org_id
+ from rhnServer
+ where id = server_id_in
+ )
+ and channel_family_id in (
+ select rcfm.channel_family_id
+ from rhnChannelFamilyMembers rcfm,
+ rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and rsc.channel_id = rcfm.channel_id
+ and not exists (
+ select 1
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnServerEntitlementView sev,
+ rhnVirtualInstance vi
+ where
+ -- system is a virtual instance
+ vi.virtual_system_id = server_id_in
+ and vi.host_system_id = sev.server_id
+ -- system's host has a virt ent
+ and sev.label in ('virtualization_host',
+ 'virtualization_host_platform')
+ and sev.server_group_type_id =
+ sgtvsl.server_group_type_id
+ -- the host's virt ent grants a cf virt sub level
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ -- the cf is in that virt sub level
+ and cfvsl.channel_family_id = rcfm.channel_family_id
+ )
+ );
+ end;
+
+ -- this could certainly be optimized to do updates if needs be
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
+ is
+ begin
+ delete from rhnChannelNewestPackage where channel_id = channel_id_in;
+ insert into rhnChannelNewestPackage
+ ( channel_id, name_id, evr_id, package_id, package_arch_id )
+ ( select channel_id,
+ name_id, evr_id,
+ package_id, package_arch_id
+ from rhnChannelNewestPackageView
+ where channel_id = channel_id_in
+ );
+ insert into rhnChannelNewestPackageAudit (channel_id, caller)
+ values (channel_id_in, caller_in);
+ update rhnChannel
+ set last_modified = greatest(sysdate, last_modified + 1/86400)
+ where id = channel_id_in;
+ end;
+
+ procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate )
+ is
+
+ channel_last_modified date;
+ last_modified_value date;
+
+ cursor snapshots is
+ select snapshot_id id
+ from rhnSnapshotChannel
+ where channel_id = channel_id_in;
+
+ begin
+
+ select last_modified
+ into channel_last_modified
+ from rhnChannel
+ where id = channel_id_in;
+
+ last_modified_value := date_to_use;
+
+ if last_modified_value <= channel_last_modified then
+ last_modified_value := last_modified_value + 1/86400;
+ end if;
+
+ update rhnChannel set last_modified = last_modified_value
+ where id = channel_id_in;
+
+ if invalidate_ss = 1 then
+ for snapshot in snapshots loop
+ update rhnSnapshot
+ set invalid = lookup_snapshot_invalid_reason('channel_modified')
+ where id = snapshot.id;
+ end loop;
+ end if;
+
+ end update_channel;
+
+ procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelPackage
+ where package_id = package_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we want to invalidate the snapshot assocated with the channel when we
+ -- do this b/c we know we've added or removed or packages
+ rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
+ end loop;
+ end update_channels_by_package;
+
+
+ procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelErrata
+ where errata_id = errata_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we won't invalidate snapshots, b/c just changing the errata associated with
+ -- a channel shouldn't invalidate snapshots
+ rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
+ end loop;
+ end update_channels_by_errata;
+
+ procedure update_needed_cache(channel_id_in in number)
+ is
+ pragma autonomous_transaction;
+ -- update of needed cache ican be commited on a per server basis
+ -- b/c failure of update for a server means nothing for the other servers
+ begin
+ -- we intentionaly do a loop here instead of one huge select
+ -- b/c we want to break update into smaller transaction to unblock other sessions
+ -- querying rhnServerNeededCache
+ for server in (
+ select sc.server_id as id
+ from rhnServerChannel sc
+ where sc.channel_id = channel_id_in
+ ) loop
+ rhn_server.update_needed_cache(server.id);
+ commit;
+ end loop;
+ end update_needed_cache;
+
+END rhn_channel;
+/
+SHOW ERRORS
13 years, 6 months
Changes to 'refs/tags/spacewalk-1.3.1-1'
by Tomas Lestach
Tag 'spacewalk-1.3.1-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2010-12-08 16:48 +0000
Tagging package [spacewalk] version [1.3.1-1] in directory [spacewalk/package/].
Changes since spacewalk-java-1.3.23-1:
Tomas Lestach (2):
remove jabberd-selinux dependency for rhel6+
Automatic commit of package [spacewalk] release [1.3.1-1].
---
rel-eng/packages/spacewalk | 2 +-
spacewalk/package/spacewalk.spec | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
---
13 years, 6 months