rel-eng/tito.props
by Miroslav Suchý
rel-eng/tito.props | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
New commits:
commit c14d55fb1e6f0c2d66e257744128be3647378af2
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Jun 23 16:11:57 2010 +0200
start building for Fedora 13
diff --git a/rel-eng/tito.props b/rel-eng/tito.props
index bf14015..9236bdd 100644
--- a/rel-eng/tito.props
+++ b/rel-eng/tito.props
@@ -3,7 +3,7 @@ default_builder = spacewalk.releng.builder.Builder
default_tagger = spacewalk.releng.tagger.VersionTagger
[koji]
-autobuild_tags = dist-f11-sw-1.1-candidate dist-5E-sw-1.1-candidate dist-f12-sw-1.1-candidate
+autobuild_tags = dist-f11-sw-1.1-candidate dist-5E-sw-1.1-candidate dist-f12-sw-1.1-candidate dist-f13-sw-1.1-candidate
[dist-f11-sw-1.1-candidate]
disttag = .fc11
@@ -15,3 +15,7 @@ disttag = .el5
[dist-f12-sw-1.1-candidate]
disttag = .fc12
blacklist=jabberd-selinux
+
+[dist-f13-sw-1.1-candidate]
+disttag = .fc13
+blacklist=jabberd-selinux
13 years, 10 months
rel-eng/build-missing-builds-in-koji.sh
by Miroslav Suchý
rel-eng/build-missing-builds-in-koji.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit b9d38ff4da55f3bcb370b40e2c1434da438a33cc
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Wed Jun 23 15:47:44 2010 +0200
start building for Fedora 13
diff --git a/rel-eng/build-missing-builds-in-koji.sh b/rel-eng/build-missing-builds-in-koji.sh
index 88bb144..443020a 100755
--- a/rel-eng/build-missing-builds-in-koji.sh
+++ b/rel-eng/build-missing-builds-in-koji.sh
@@ -1,6 +1,6 @@
#!/bin/bash
-TAGS=([0]="dist-5E-sw-1.1-candidate" [1]="dist-f11-sw-1.1-candidate" [2]="dist-f12-sw-1.1-candidate")
+TAGS=([0]="dist-5E-sw-1.1-candidate" [1]="dist-f11-sw-1.1-candidate" [2]="dist-f12-sw-1.1-candidate" [3]="dist-f13-sw-1.1-candidate")
pushd `pwd`
@@ -9,7 +9,7 @@ cd `dirname $0`/..
# say python to be nice to pipe
export PYTHONUNBUFFERED=1
-for tag in 0 1 2; do
+for tag in 0 1 2 3; do
rel-eng/koji-missing-builds.py --no-extra ${TAGS[$tag]} | \
awk '!(/buildsys-macros/ || /oracle-server-admin/ || /oracle-server-scripts/ || /heirloom-pkgtools/) {
if (x==1) { print gensub(" *([a-zA-Z_-]+)-.*", "\\1", "g")}
13 years, 10 months
Changes to 'refs/tags/spacewalk-java-1.1.15-1'
by Jan Pazdziora
Tag 'spacewalk-java-1.1.15-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-06-23 12:53 +0000
Tagging package [spacewalk-java] version [1.1.15-1] in directory [java/].
Changes since spacewalk-1.1.3-1:
Jan Pazdziora (8):
Search for missing builds on koji.spacewalkproject.org.
Fix postgresql_clear_db to clear the content of the PostgreSQL database.
TOP declaration seems to be needed, for Makefile to be useful at all.
To allow database population to create at least some database schema, do not stop on error for now.
Let's do a slightly better formatting of our terminal output.
Some values (db-sid) can be undef, leading to warnings, there does not need to be a host a port, and the default_db is different for PostgreSQL.
Some values (db-sid) can be undef, do not pass them to rhn-config-satellite.pl.
Automatic commit of package [spacewalk-java] release [1.1.15-1].
Joshua Roys (1):
Clean up a few remaining references to kbase 6227
Milan Zazrivec (1):
604101 - kbase article 6227 changed name & location
Partha Aji (1):
Fixed a couple of checkstyle errors
---
client/rhel/rhn-client-tools/po/ar.po | 8 -
client/rhel/rhn-client-tools/po/as.po | 14 +-
client/rhel/rhn-client-tools/po/bg.po | 8 -
client/rhel/rhn-client-tools/po/bn.po | 8 -
client/rhel/rhn-client-tools/po/bn_IN.po | 16 +-
client/rhel/rhn-client-tools/po/ca.po | 8 -
client/rhel/rhn-client-tools/po/cs.po | 8 -
client/rhel/rhn-client-tools/po/cy.po | 8 -
client/rhel/rhn-client-tools/po/da.po | 8 -
client/rhel/rhn-client-tools/po/de.po | 13 +-
client/rhel/rhn-client-tools/po/el.po | 8 -
client/rhel/rhn-client-tools/po/en_GB.po | 8 -
client/rhel/rhn-client-tools/po/es.po | 16 +-
client/rhel/rhn-client-tools/po/et.po | 8 -
client/rhel/rhn-client-tools/po/fa.po | 8 -
client/rhel/rhn-client-tools/po/fi.po | 8 -
client/rhel/rhn-client-tools/po/fr.po | 16 +-
client/rhel/rhn-client-tools/po/gu.po | 16 +-
client/rhel/rhn-client-tools/po/he.po | 8 -
client/rhel/rhn-client-tools/po/hi.po | 14 +-
client/rhel/rhn-client-tools/po/hr.po | 16 +-
client/rhel/rhn-client-tools/po/hu.po | 8 -
client/rhel/rhn-client-tools/po/hy.po | 8 -
client/rhel/rhn-client-tools/po/id.po | 8 -
client/rhel/rhn-client-tools/po/is.po | 8 -
client/rhel/rhn-client-tools/po/it.po | 16 +-
client/rhel/rhn-client-tools/po/ja.po | 16 +-
client/rhel/rhn-client-tools/po/ka.po | 8 -
client/rhel/rhn-client-tools/po/kn.po | 16 +-
client/rhel/rhn-client-tools/po/ko.po | 16 +-
client/rhel/rhn-client-tools/po/ku.po | 8 -
client/rhel/rhn-client-tools/po/lo.po | 8 -
client/rhel/rhn-client-tools/po/lv.po | 8 -
client/rhel/rhn-client-tools/po/mk.po | 8 -
client/rhel/rhn-client-tools/po/ml.po | 12 +-
client/rhel/rhn-client-tools/po/mr.po | 12 +-
client/rhel/rhn-client-tools/po/ms.po | 8 -
client/rhel/rhn-client-tools/po/my.po | 8 -
client/rhel/rhn-client-tools/po/nb.po | 8 -
client/rhel/rhn-client-tools/po/nl.po | 8 -
client/rhel/rhn-client-tools/po/no.po | 8 -
client/rhel/rhn-client-tools/po/or.po | 12 +-
client/rhel/rhn-client-tools/po/pa.po | 16 +-
client/rhel/rhn-client-tools/po/pl.po | 8 -
client/rhel/rhn-client-tools/po/pt.po | 24 ++--
client/rhel/rhn-client-tools/po/pt_BR.po | 16 +-
client/rhel/rhn-client-tools/po/rhn-client-tools.pot | 8 -
client/rhel/rhn-client-tools/po/ro.po | 8 -
client/rhel/rhn-client-tools/po/ru.po | 13 +-
client/rhel/rhn-client-tools/po/si.po | 14 +-
client/rhel/rhn-client-tools/po/sk.po | 8 -
client/rhel/rhn-client-tools/po/sl.po | 8 -
client/rhel/rhn-client-tools/po/sq.po | 8 -
client/rhel/rhn-client-tools/po/sr.po | 8 -
client/rhel/rhn-client-tools/po/sr(a)Latn.po | 8 -
client/rhel/rhn-client-tools/po/sv.po | 8 -
client/rhel/rhn-client-tools/po/ta.po | 16 +-
client/rhel/rhn-client-tools/po/te.po | 16 +-
client/rhel/rhn-client-tools/po/tr.po | 8 -
client/rhel/rhn-client-tools/po/uk.po | 12 +-
client/rhel/rhn-client-tools/po/ur.po | 8 -
client/rhel/rhn-client-tools/po/vi.po | 8 -
client/rhel/rhn-client-tools/po/zh_CN.GB2312.po | 8 -
client/rhel/rhn-client-tools/po/zh_CN.po | 14 +-
client/rhel/rhn-client-tools/po/zh_TW.Big5.po | 16 +-
client/rhel/rhn-client-tools/po/zh_TW.po | 16 +-
client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py | 8 -
java/code/src/com/redhat/rhn/frontend/xmlrpc/system/SystemHandler.java | 6 -
java/spacewalk-java.spec | 5
rel-eng/koji-missing-builds.py | 2
rel-eng/packages/spacewalk-java | 2
schema/spacewalk/Makefile | 1
spacewalk/admin/rhn-populate-database.pl | 2
spacewalk/setup/bin/spacewalk-setup | 27 +++--
spacewalk/setup/lib/Spacewalk/Setup.pm | 54 ++++++----
75 files changed, 426 insertions(+), 395 deletions(-)
---
13 years, 10 months
5 commits - java/spacewalk-java.spec rel-eng/packages spacewalk/admin spacewalk/setup
by Jan Pazdziora
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
spacewalk/admin/rhn-populate-database.pl | 2 +-
spacewalk/setup/bin/spacewalk-setup | 27 ++++++++++++++++++++-------
spacewalk/setup/lib/Spacewalk/Setup.pm | 4 ++--
5 files changed, 28 insertions(+), 12 deletions(-)
New commits:
commit 98e0c0cb1247b0c39771c33626d157905f331b33
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:53:15 2010 +0200
Automatic commit of package [spacewalk-java] release [1.1.15-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index beaa193..ecbbf3a 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.1.14
+Version: 1.1.15
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -321,6 +321,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Wed Jun 23 2010 Jan Pazdziora 1.1.15-1
+- Fixed a couple of checkstyle errors (paji(a)redhat.com)
+
* Mon Jun 21 2010 Jan Pazdziora 1.1.14-1
- updating rhnPackageRepodata table to not use a reserved word.
(jsherril(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 4588215..ab8d625 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.1.14-1 java/
+1.1.15-1 java/
commit 593420c807048f59b00330880164cc70388dd7b1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:07:18 2010 +0200
Some values (db-sid) can be undef, do not pass them to rhn-config-satellite.pl.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index b923ddb..ab7752a 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -1116,7 +1116,7 @@ sub write_config {
my $options = shift;
my $target = shift || Spacewalk::Setup::DEFAULT_RHN_CONF_LOCATION;
- my @opt_strings = map { "--option=${_}=" . $options->{$_} } keys %{$options};
+ my @opt_strings = map { "--option=${_}=" . $options->{$_} } grep { defined $options->{$_} } keys %{$options};
Spacewalk::Setup::system_or_exit([ "/usr/bin/rhn-config-satellite.pl",
"--target=$target",
commit ef76f21dae3aab9b1dd1841b25636c924765e90d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:06:44 2010 +0200
Some values (db-sid) can be undef, leading to warnings, there does not need to be a host a port, and the default_db is different for PostgreSQL.
diff --git a/spacewalk/setup/bin/spacewalk-setup b/spacewalk/setup/bin/spacewalk-setup
index d851cfa..b923ddb 100755
--- a/spacewalk/setup/bin/spacewalk-setup
+++ b/spacewalk/setup/bin/spacewalk-setup
@@ -946,13 +946,26 @@ sub populate_initial_configs {
}
# Define some db specific settings:
- my $hibernate_dialect = "org.hibernate.dialect.Oracle9iDialect";
- my $hibernate_driver = "oracle.jdbc.driver.OracleDriver";
- my $hibernate_url = "jdbc:oracle:thin:@" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . ":" . $answers->{"db-sid"};
- if ($answers->{'db-backend'} eq 'postgresql') {
+ my ($hibernate_dialect, $hibernate_driver, $hibernate_url, $default_db);
+ if ($answers->{'db-backend'} eq 'oracle') {
+ $hibernate_dialect = "org.hibernate.dialect.Oracle9iDialect";
+ $hibernate_driver = "oracle.jdbc.driver.OracleDriver";
+ $hibernate_url = "jdbc:oracle:thin:@" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . ":" . $answers->{"db-sid"};
+ $default_db = sprintf('%s/%s@%s', @{$answers}{qw/db-user db-password db-sid/}),
+ } elsif ($answers->{'db-backend'} eq 'postgresql') {
$hibernate_dialect = "org.hibernate.dialect.PostgreSQLDialect";
$hibernate_driver = "org.postgresql.Driver";
- $hibernate_url = "jdbc:postgresql://" . $answers->{"db-host"} . ":" . $answers->{"db-port"} . "/" . $answers->{"db-sid"};
+ $hibernate_url = "jdbc:postgresql://";
+ $default_db = "dbname=$answers->{'db-name'}";
+ if (defined $answers->{"db-host"} and $answers->{"db-host"} ne '') {
+ $hibernate_url .= $answers->{"db-host"};
+ $default_db .= ";host=$answers->{'db-host'}";
+ if (defined $answers->{"db-port"} and $answers->{"db-port"} ne '') {
+ $hibernate_url .= ':' . $answers->{"db-port"};
+ $default_db .= ";port=$answers->{'db-port'}";
+ }
+ }
+ $hibernate_url .= "/" . $answers->{"db-name"};
}
my %config_opts =
@@ -967,7 +980,7 @@ sub populate_initial_configs {
webDOTenable_solaris_support => 0,
osadispatcherDOTosa_ssl_cert => '/var/www/html/pub/RHN-ORG-TRUSTED-SSL-CERT',
encrypted_passwords => 1,
- default_db => sprintf('%s/%s@%s', @{$answers}{qw/db-user db-password db-sid/}),
+ default_db => $default_db,
db_backend => $answers->{'db-backend'},
db_user => $answers->{'db-user'},
db_password => $answers->{'db-password'},
commit 1e9a2e4ac4ab2a3e44bb53dad94170a05bbf3ddb
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 14:03:07 2010 +0200
Let's do a slightly better formatting of our terminal output.
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index 0cd5856..0a49712 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -809,7 +809,7 @@ sub postgresql_populate_db {
print Spacewalk::Setup::loc("** Database: Re-populating database.\n");
}
else {
- print Spacewalk::Setup::loc("**Database: The database already has schema. Skipping database population.");
+ print Spacewalk::Setup::loc("** Database: The database already has schema. Skipping database population.\n");
return 1;
}
}
@@ -1288,7 +1288,7 @@ sub oracle_populate_db {
print loc("** Database: Re-populating database.\n");
}
else {
- print loc("**Database: The database already has schema. Skipping database population.");
+ print loc("** Database: The database already has schema. Skipping database population.\n");
return 1;
}
commit e2487b374fa5156f5e03736ebf4a5c496f505b0a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 13:55:57 2010 +0200
To allow database population to create at least some database schema, do not stop on error for now.
diff --git a/spacewalk/admin/rhn-populate-database.pl b/spacewalk/admin/rhn-populate-database.pl
index 7e98d11..1841ab4 100755
--- a/spacewalk/admin/rhn-populate-database.pl
+++ b/spacewalk/admin/rhn-populate-database.pl
@@ -113,7 +113,7 @@ my @command;
if ($postgresql) {
print "*** Installing PostgreSQL schema from [$schema_deploy_file].\n";
chdir("/usr/share/spacewalk/schema/postgresql/");
- @command = ( 'psql', '-U', $user, '-d', $database, '-v', 'ON_ERROR_STOP=', '-f', $schema_deploy_file );
+ @command = ( 'psql', '-U', $user, '-d', $database, '-v', 'ON_ERROR_ROLLBACK=ON', '-f', $schema_deploy_file );
if (defined $host) {
push @command, '-h', $host;
if (defined $port) {
13 years, 10 months
2 commits - schema/spacewalk spacewalk/setup
by Jan Pazdziora
schema/spacewalk/Makefile | 1
spacewalk/setup/lib/Spacewalk/Setup.pm | 50 +++++++++++++++++++++------------
2 files changed, 33 insertions(+), 18 deletions(-)
New commits:
commit d44bef006b38b42031d5865ce9098467b2402c6e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jun 22 16:28:30 2010 +0200
TOP declaration seems to be needed, for Makefile to be useful at all.
diff --git a/schema/spacewalk/Makefile b/schema/spacewalk/Makefile
index f38bdd1..514b8bb 100644
--- a/schema/spacewalk/Makefile
+++ b/schema/spacewalk/Makefile
@@ -1,5 +1,6 @@
include ../../rel-eng/Makefile
+TOP := .
SPECFILE := $(firstword $(wildcard *.spec))
NAME := $(shell rpm -q --qf '%{name}\n' --specfile $(SPECFILE))
VERSION := $(shell rpm -q --qf '%{version}\n' --specfile $(SPECFILE))
commit 7138db043d2d370abd75b3db8043620cb6e2f44e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Jun 23 11:00:32 2010 +0200
Fix postgresql_clear_db to clear the content of the PostgreSQL database.
diff --git a/spacewalk/setup/lib/Spacewalk/Setup.pm b/spacewalk/setup/lib/Spacewalk/Setup.pm
index b0019ed..0cd5856 100644
--- a/spacewalk/setup/lib/Spacewalk/Setup.pm
+++ b/spacewalk/setup/lib/Spacewalk/Setup.pm
@@ -854,27 +854,41 @@ sub postgresql_test_db_schema {
}
# Clear the PostgreSQL schema by deleting the 'public' schema with cascade,
-# then re-creating it.
+# then re-creating it. Also delete all the other known schemas that
+# Spacewalk might have created.
+
+my $POSTGRESQL_CLEAR_SCHEMA = <<EOS;
+ drop schema rpm cascade ;
+ drop schema rhn_exception cascade ;
+ drop schema rhn_quota cascade ;
+ drop schema rhn_config cascade ;
+ drop schema rhn_server cascade ;
+ drop schema rhn_entitlements cascade ;
+ drop schema rhn_bel cascade ;
+ drop schema rhn_cache cascade ;
+ drop schema rhn_channel cascade ;
+ drop schema rhn_config_channel cascade ;
+ drop schema rhn_org cascade ;
+ drop schema rhn_package cascade ;
+ drop schema rhn_user cascade ;
+ drop schema public cascade ;
+ create schema public authorization postgres ;
+EOS
sub postgresql_clear_db {
- my $answers = shift;
-
+ my $answers = shift;
+
+ my $dbh = get_dbh($answers);
+ local $dbh->{RaiseError} = 0;
+ local $dbh->{PrintError} = 1;
+ local $dbh->{AutoCommit} = 1;
+ for my $c (split /\n/, $POSTGRESQL_CLEAR_SCHEMA) {
+ $dbh->do($c);
+ }
+ $dbh->disconnect;
+ return 1;
+}
- # Only way to clear a PostgreSQL db we've found so far is to wipe it out
- # completely:
- my $password = @{$answers}{'db-password'};
- my $user = @{$answers}{'db-user'};
- my $host = @{$answers}{'db-host'};
- my $port = @{$answers}{'db-port'};
- my $database = @{$answers}{'db-sid'};
- my $clear_db_cmd = "PGPASSWORD=$password dropdb -U $user -h $host -p $port $database";
- system($clear_db_cmd);
- $clear_db_cmd = "PGPASSWORD=$password createdb -U $user -h $host $database";
- system($clear_db_cmd);
- $clear_db_cmd = "PGPASSWORD=$password createlang -U $user -h $host plpgsql $database";
- system($clear_db_cmd);
- return 1;
-}
13 years, 10 months
Branch 'fve' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java | 2 --
java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java | 1 -
2 files changed, 3 deletions(-)
New commits:
commit 84843861d0ace31010f3d1dfd49f336968b279a4
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 00:11:22 2010 -0400
Fixed checkstyle errors
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
index ea05a15..f531858 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
@@ -36,8 +36,6 @@ import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
-import org.apache.struts.action.ActionMessage;
-import org.apache.struts.action.ActionMessages;
import java.util.HashMap;
import java.util.List;
diff --git a/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java b/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
index 0f67f81..72e2e34 100644
--- a/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
@@ -24,7 +24,6 @@ import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.org.OrgFactory;
import org.apache.log4j.Logger;
-import org.apache.tools.ant.taskdefs.condition.IsFileSelected;
import java.util.HashMap;
import java.util.Map;
13 years, 10 months
Branch 'fve' - 2 commits - rel-eng/koji-missing-builds.py
by Partha Aji
rel-eng/koji-missing-builds.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 11dec7f14c0960b52ec119a326ec9cc1bfd2aa42
Merge: 063f08f... 8386844...
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 00:08:47 2010 -0400
Merge branch 'master' into fve
commit 8386844d4d3fdf0822291f3b5037de87bf62725a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jun 22 20:19:51 2010 +0200
Search for missing builds on koji.spacewalkproject.org.
diff --git a/rel-eng/koji-missing-builds.py b/rel-eng/koji-missing-builds.py
index e311e77..f2e582d 100755
--- a/rel-eng/koji-missing-builds.py
+++ b/rel-eng/koji-missing-builds.py
@@ -51,7 +51,7 @@ if opts.brew:
mysession = koji.ClientSession("http://brewhub.devel.redhat.com/brewhub")
distsuffix = 'sat'
else:
- mysession = koji.ClientSession("http://koji.rhndev.redhat.com/kojihub")
+ mysession = koji.ClientSession("http://koji.spacewalkproject.org/kojihub")
rpmlist = mysession.getLatestRPMS(tag)
nvrs = []
13 years, 10 months
Branch 'fve' - java/code schema/spacewalk
by Partha Aji
java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml | 8
java/code/src/com/redhat/rhn/common/db/datasource/xml/Org_queries.xml | 4
java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java | 76 +++-
java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java | 160 ++++++----
java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java | 2
java/code/src/com/redhat/rhn/frontend/dto/OrgChannelFamily.java | 88 +++++
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml | 8
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 45 ++
java/code/src/com/redhat/rhn/frontend/xmlrpc/org/OrgHandler.java | 47 ++
java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java | 23 -
java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java | 109 ++++--
java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java | 14
java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp | 89 +++--
java/code/webapp/WEB-INF/struts-config.xml | 2
schema/spacewalk/oracle/packages/rhn_entitlements.pkb | 18 -
15 files changed, 498 insertions(+), 195 deletions(-)
New commits:
commit 063f08fc3588bc1ba62bbbfb5188da78b583b36c
Author: Partha Aji <paji(a)redhat.com>
Date: Wed Jun 23 00:07:07 2010 -0400
Added code to get multiorgs org -> software channel ents page work with flex entitlements
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
index 85ef770..f43463e 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Channel_queries.xml
@@ -354,14 +354,6 @@ SELECT CFO.id, CFO.name, CFO.label, CFO.current_members, CFO.max_members, CFO.ha
</query>
</mode>
-<mode name="channel_entitlements_for_all_orgs" class="com.redhat.rhn.frontend.dto.ChannelOverview">
- <query params="">
-SELECT CFO.id, CFO.org_id, CFO.name, CFO.label, CFO.current_members, CFO.max_members, CFO.has_subscription, CFO.url
- FROM rhnChannelFamilyOverview CFO
- ORDER BY CFO.name DESC
- </query>
-</mode>
-
<mode name="channel_entitlements_for_all_m_orgs" class="com.redhat.rhn.frontend.dto.MultiOrgEntitlementsDto">
<query params="">
SELECT MAX(cfo.id) as id,
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Org_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Org_queries.xml
index b5a7924..916463a 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Org_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Org_queries.xml
@@ -182,8 +182,8 @@ AND sg.org_id != 1
</callable-mode>
<callable-mode name="assign_software_entitlements">
- <query params="channel_family_label from_org_id, to_org_id, quantity">
- {call rhn_entitlements.assign_channel_entitlement(:channel_family_label,:from_org_id,:to_org_id,:quantity, 0)}
+ <query params="channel_family_label from_org_id, to_org_id, quantity, flex_quantity">
+ {call rhn_entitlements.assign_channel_entitlement(:channel_family_label,:from_org_id,:to_org_id,:quantity, :flex_quantity)}
</query>
</callable-mode>
diff --git a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
index e749c04..9a032ac 100644
--- a/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
+++ b/java/code/src/com/redhat/rhn/domain/channel/ChannelFamily.java
@@ -23,7 +23,6 @@ import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Set;
/**
@@ -40,7 +39,8 @@ public class ChannelFamily extends BaseDomainHelper {
private Set<Channel> channels = new HashSet<Channel>();
private Set virtSubscriptionLevels = new HashSet();
- private Set<PrivateChannelFamily> privateChannelFamilies;
+ private Set<PrivateChannelFamily> privateChannelFamilies =
+ new HashSet<PrivateChannelFamily>();
/**
* @return Returns the channels.
@@ -190,18 +190,11 @@ public class ChannelFamily extends BaseDomainHelper {
* @return maxmembers of this channelfamily. NULL == unlimited
*/
public Long getMaxMembers(Org orgIn) {
- Long retval = null;
- if (this.privateChannelFamilies != null &&
- this.privateChannelFamilies.size() > 0) {
- Iterator i = this.privateChannelFamilies.iterator();
- while (i.hasNext()) {
- PrivateChannelFamily pcf = (PrivateChannelFamily) i.next();
- if (pcf.getOrg().getId().equals(orgIn.getId())) {
- retval = pcf.getMaxMembers();
- }
- }
+ PrivateChannelFamily pcf = getAllocation(orgIn);
+ if (pcf != null) {
+ return pcf.getMaxMembers();
}
- return retval;
+ return null;
}
/**
@@ -210,20 +203,55 @@ public class ChannelFamily extends BaseDomainHelper {
* @return currentMembers of this channelfamily.
*/
public Long getCurrentMembers(Org orgIn) {
- Long retval = null;
- if (this.privateChannelFamilies != null &&
- this.privateChannelFamilies.size() > 0) {
- Iterator i = this.privateChannelFamilies.iterator();
- while (i.hasNext()) {
- PrivateChannelFamily pcf = (PrivateChannelFamily) i.next();
- if (pcf.getOrg().equals(orgIn)) {
- retval = pcf.getCurrentMembers();
- }
- }
+ PrivateChannelFamily pcf = getAllocation(orgIn);
+ if (pcf != null) {
+ return pcf.getCurrentMembers();
}
- return retval;
+ return null;
}
+
+ /**
+ * Get max flex members of this channel family. NULL means unlimited
+ * @param orgIn org to lookup the max flex embers for
+ * @return max flex members of this channelfamily. NULL == unlimited
+ */
+ public Long getMaxFlex(Org orgIn) {
+ PrivateChannelFamily pcf = getAllocation(orgIn);
+ if (pcf != null) {
+ return pcf.getMaxFlex();
+ }
+ return null;
+ }
+
+ /**
+ * Get current flex members of this channel family.
+ * @param orgIn org to lookup the current flex members for
+ * @return currentflex Members of this channelfamily.
+ */
+ public Long getCurrentFlex(Org orgIn) {
+ PrivateChannelFamily pcf = getAllocation(orgIn);
+ if (pcf != null) {
+ return pcf.getCurrentFlex();
+ }
+ return null;
+ }
+
+
+ /**
+ * returns the channel family allocation of this channel family
+ * in the given org
+ * @param orgIn the org whose allocation is requested
+ * @return the channel allocation
+ */
+ private PrivateChannelFamily getAllocation(Org orgIn) {
+ for (PrivateChannelFamily alloc : getPrivateChannelFamilies()) {
+ if (orgIn.equals(alloc.getOrg())) {
+ return alloc;
+ }
+ }
+ return null;
+ }
/**
* @return Returns the privateChannelFamilies.
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
index 2294739..ea05a15 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
@@ -15,14 +15,18 @@
package com.redhat.rhn.frontend.action.multiorg;
import com.redhat.rhn.common.validator.ValidatorError;
+import com.redhat.rhn.common.validator.ValidatorException;
import com.redhat.rhn.domain.channel.ChannelFamily;
import com.redhat.rhn.domain.channel.ChannelFamilyFactory;
import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.org.OrgFactory;
import com.redhat.rhn.frontend.dto.ChannelOverview;
+import com.redhat.rhn.frontend.dto.OrgChannelFamily;
import com.redhat.rhn.frontend.struts.RequestContext;
import com.redhat.rhn.frontend.struts.RhnAction;
import com.redhat.rhn.frontend.struts.RhnValidationHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.ListHelper;
+import com.redhat.rhn.frontend.taglibs.list.helper.Listable;
import com.redhat.rhn.manager.channel.ChannelManager;
import com.redhat.rhn.manager.org.UpdateOrgSoftwareEntitlementsCommand;
@@ -34,10 +38,10 @@ import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
-import org.apache.struts.action.DynaActionForm;
-import java.util.Iterator;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -47,33 +51,61 @@ import javax.servlet.http.HttpServletResponse;
* OrgSoftwareSubscriptionsAction - updates the Channel subs for a single org
* @version $Rev: 1 $
*/
-public class OrgSoftwareSubscriptionsAction extends RhnAction {
-
+public class OrgSoftwareSubscriptionsAction extends RhnAction implements Listable {
+ private static final String SUBSCRIPTIONS = "subscriptions";
private static Logger log = Logger.getLogger(OrgSoftwareSubscriptionsAction.class);
+ private static String makeLabel(HttpServletRequest request) {
+ RequestContext ctx = new RequestContext(request);
+ Long oid = ctx.getParamAsLong(RequestContext.ORG_ID);
+ return "OrgSoftwareSubscriptions" + oid;
+ }
+
/** {@inheritDoc} */
public ActionForward execute(ActionMapping mapping,
ActionForm formIn,
HttpServletRequest request,
HttpServletResponse response) {
- DynaActionForm dynaForm = (DynaActionForm) formIn;
RequestContext ctx = new RequestContext(request);
Long oid = ctx.getParamAsLong(RequestContext.ORG_ID);
Org org = OrgFactory.lookupById(oid);
request.setAttribute("org", org);
- request.setAttribute("parentUrl", request.getRequestURI());
+
+ Map params = new HashMap();
+ params.put(RequestContext.ORG_ID, oid);
+ ListHelper helper = new ListHelper(this, request, params);
+ helper.execute();
+ if (!ctx.isSubmitted()) {
+ Map<String, String> subsMap = new HashMap<String, String>();
+ List <OrgChannelFamily> subs = helper.getDataSet();
+ for (OrgChannelFamily sub : subs) {
+ if (sub.getMaxAvailable() > 0) {
+ subsMap.put(sub.getKey(), sub.getMaxMembers().toString());
+ }
+ if (sub.getMaxAvailableFlex() > 0) {
+ subsMap.put(sub.getFlexKey(), sub.getMaxFlex().toString());
+ }
+ }
+ request.getSession().setAttribute(makeLabel(request), subsMap);
+ }
+ else {
+ Map <String, String> subsMap = (Map <String, String>)
+ request.getSession().getAttribute(makeLabel(request));
+ for (String id : subsMap.keySet()) {
+ if (request.getParameter(id) != null) {
+ subsMap.put(id, request.getParameter(id));
+ }
+ }
+ }
+ request.setAttribute(SUBSCRIPTIONS,
+ request.getSession().getAttribute(makeLabel(request)));
+
ActionForward retval =
- getStrutsDelegate().forwardParam(mapping.findForward("default"),
- "oid", oid.toString());
+ mapping.findForward("default");
- // Used to tell if we're submitting the form for pagination or an actual
- // form submit.
- String updateOrgs = request.getParameter("updateOrganizations");
- boolean update = (updateOrgs != null) && (!updateOrgs.equals("0"));
- if (isSubmitted(dynaForm) && update) {
-
+ if (ctx.wasDispatched("orgdetails.jsp.submit")) {
ActionErrors ae = updateSubscriptions(org, request);
if (ae != null && ae.size() > 0) {
getStrutsDelegate().saveMessages(request, ae);
@@ -81,68 +113,88 @@ public class OrgSoftwareSubscriptionsAction extends RhnAction {
"oid", oid.toString());
}
- else {
+ else {
createSuccessMessage(request, "org.entitlements.syssoft.success", null);
retval = getStrutsDelegate().forwardParam(mapping.findForward("success"),
"oid", oid.toString());
+ request.getSession().removeAttribute(makeLabel(request));
}
}
- setupFormValues(org, request);
-
return retval;
}
- void setupFormValues(Org org, HttpServletRequest request) {
- request.setAttribute("pageList", ChannelManager.
- listChannelFamilySubscriptionsFor(org));
- }
- private ActionErrors updateSubscriptions(Org org, HttpServletRequest request) {
- List entitlements = ChannelManager.entitlements(
- OrgFactory.getSatelliteOrg().getId(), null);
-
+ private ActionErrors updateSubscriptions(Org org, HttpServletRequest request) {
if (org.getId().equals(OrgFactory.getSatelliteOrg().getId())) {
return RhnValidationHelper.validatorErrorToActionErrors(
new ValidatorError("org.entitlements.system.defaultorg"));
}
ActionErrors errors = new ActionErrors();
- Iterator i = entitlements.iterator();
- while (i.hasNext()) {
- ChannelOverview co = (ChannelOverview) i.next();
+
+ Map <String, String> subsMap = (Map <String, String>)
+ request.getAttribute(SUBSCRIPTIONS);
+
+ List <ChannelOverview> entitlements = ChannelManager.entitlements(
+ OrgFactory.getSatelliteOrg().getId(), null);
+
+ for (ChannelOverview co : entitlements) {
ChannelFamily cfm = ChannelFamilyFactory.lookupById(co.getId().longValue());
- String count = (String) request.getParameter(co.getId().toString());
- // check for bad numbers
- if (count != null) {
- // check for invalid number format
- try {
- Long.parseLong(count.trim());
+ String regCountKey = OrgChannelFamily.makeKey(co.getId());
+ try {
+ Long regCount = subsMap.containsKey(regCountKey) ?
+ processCount(subsMap.get(regCountKey), errors, cfm) : 0;
+ if (regCount != null) {
+ String flexCountKey = OrgChannelFamily.makeFlexKey(co.getId());
+ Long flex = subsMap.containsKey(flexCountKey) ?
+ processCount(subsMap.get(flexCountKey), errors, cfm) : 0;
+
+ if (flex != null && regCount != null) {
+ UpdateOrgSoftwareEntitlementsCommand cmd =
+ new UpdateOrgSoftwareEntitlementsCommand(cfm.getLabel(), org,
+ regCount, flex);
+ ValidatorError ve = cmd.store();
+ if (ve != null) {
+ errors.add(
+ RhnValidationHelper.validatorErrorToActionErrors(ve));
+ }
+ }
}
- catch (NumberFormatException ex) {
- ValidatorError error = new ValidatorError(
- "orgsoftwaresubs.invalid", cfm.getName());
- return (RhnValidationHelper.validatorErrorToActionErrors(error));
- }
}
-
- if (count != null && !StringUtils.isEmpty(count)) {
- //Test id is a number
- if (!StringUtils.isNumeric(count)) {
- errors.add(ActionMessages.GLOBAL_MESSAGE,
- new ActionMessage("orgsoftwaresubs.edit.ent", cfm.getName()));
- continue;
- }
- UpdateOrgSoftwareEntitlementsCommand cmd =
- new UpdateOrgSoftwareEntitlementsCommand(cfm.getLabel(), org,
- new Long(count));
- ValidatorError ve = cmd.store();
- if (ve != null) {
- errors.add(RhnValidationHelper.validatorErrorToActionErrors(ve));
- }
+ catch (ValidatorException ve) {
+ errors.add(RhnValidationHelper.validatorErrorToActionErrors(
+ ve.getResult().getErrors().get(0)));
}
}
return errors;
}
+
+
+ private Long processCount(String count, ActionErrors errors, ChannelFamily cfm) {
+ if (!StringUtils.isBlank(count)) {
+ // check for invalid number format
+ try {
+ return Long.parseLong(count.trim());
+ }
+ catch (NumberFormatException ex) {
+ ValidatorException.raiseException("orgsoftwaresubs.invalid", cfm.getName());
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public List getResult(RequestContext contextIn) {
+ Org org = (Org)contextIn.getRequest().getAttribute("org");
+ List<OrgChannelFamily> subs = ChannelManager.
+ listChannelFamilySubscriptionsFor(org);
+ return subs;
+ }
+
+
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
index 2292227..b5841ab 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/SoftwareEntitlementSubscriptionsAction.java
@@ -223,7 +223,7 @@ public class SoftwareEntitlementSubscriptionsAction extends RhnAction {
UpdateOrgSoftwareEntitlementsCommand updateCmd = null;
try {
updateCmd = new UpdateOrgSoftwareEntitlementsCommand(channelFamily.getLabel(),
- org, newCount);
+ org, newCount, 0L);
}
catch (IllegalArgumentException e) {
ValidatorError error = new ValidatorError(
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/OrgChannelFamily.java b/java/code/src/com/redhat/rhn/frontend/dto/OrgChannelFamily.java
index 939bd79..50b4fa3 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/OrgChannelFamily.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/OrgChannelFamily.java
@@ -14,6 +14,8 @@
*/
package com.redhat.rhn.frontend.dto;
+import com.redhat.rhn.domain.org.OrgFactory;
+
/**
* OrgChannelFamily
@@ -23,8 +25,73 @@ public class OrgChannelFamily extends ChannelOverview {
private Long satelliteMaxMembers;
private Long satelliteCurrentMembers;
+ private Long satelliteMaxFlexMembers;
+ private Long satelliteCurrentFlexMembers;
+
+ /**
+ * @return the key
+ */
+ public String getKey() {
+ return makeKey(getId());
+ }
+
+ /**
+ * @return the key
+ */
+ public String getFlexKey() {
+ return makeFlexKey(getId());
+ }
+
+
+ /**
+ * @param id the id of the channel family
+ * @return the key
+ */
+ public static String makeKey(Long id) {
+ return String.valueOf(id);
+ }
/**
+ * @param id the id of the channel family
+ * @return the key
+ */
+ public static String makeFlexKey(Long id) {
+ return id + "-flex";
+ }
+
+
+ /**
+ * @return Returns the satelliteMaxFlexMembers.
+ */
+ public Long getSatelliteMaxFlex() {
+ return satelliteMaxFlexMembers;
+ }
+
+
+ /**
+ * @param satelliteMaxFlexMembersIn The satelliteMaxFlexMembers to set.
+ */
+ public void setSatelliteMaxFlex(Long satelliteMaxFlexMembersIn) {
+ satelliteMaxFlexMembers = satelliteMaxFlexMembersIn;
+ }
+
+
+ /**
+ * @return Returns the satelliteCurrentFlexMembers.
+ */
+ public Long getSatelliteCurrentFlex() {
+ return satelliteCurrentFlexMembers;
+ }
+
+
+ /**
+ * @param satelliteCurrentFlexMembersIn The satelliteCurrentFlexMembers to set.
+ */
+ public void setSatelliteCurrentFlex(Long satelliteCurrentFlexMembersIn) {
+ satelliteCurrentFlexMembers = satelliteCurrentFlexMembersIn;
+ }
+
+ /**
* @return Returns the satelliteMaxMembers.
*/
public Long getSatelliteMaxMembers() {
@@ -52,4 +119,25 @@ public class OrgChannelFamily extends ChannelOverview {
this.satelliteCurrentMembers = satelliteCurrentMembersIn;
}
+ /**
+ * the maximum number of the available slots
+ * @return the number of slots
+ */
+ public long getMaxAvailable() {
+ if (OrgFactory.getSatelliteOrg().getId().equals(getOrgId())) {
+ return getMaxMembers();
+ }
+ return getSatelliteMaxMembers() - getSatelliteCurrentMembers() + getMaxMembers();
+ }
+
+ /**
+ * the maximum number of the available flex slots
+ * @return the number of slots
+ */
+ public long getMaxAvailableFlex() {
+ if (OrgFactory.getSatelliteOrg().getId().equals(getOrgId())) {
+ return getMaxFlex();
+ }
+ return getSatelliteMaxFlex() - getSatelliteCurrentFlex() + getMaxFlex();
+ }
}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 3987ef8..d8a94a6 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7992,8 +7992,12 @@ Follow this url to see the full list of inactive systems:
<source>Entitlements successfully updated.</source>
</trans-unit>
- <trans-unit id="org.entitlements.software.toomany">
- <source>You attempted to give {0} too many {1} entitlements. Please enter a value lower than or equal to {2}</source>
+ <trans-unit id="org.entitlements.software.not_in_range">
+ <source>You attempted to give {0} too many {1} entitlements. Please enter a value between {2} and {3}</source>
+ </trans-unit>
+
+ <trans-unit id="org.entitlements.software.not_in_range.flex">
+ <source>You attempted to give {0} too many {1} flex entitlements. Please enter a value between {2} and {3}</source>
</trans-unit>
<trans-unit id="org.entitlements.software.proposedwarning">
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 205a90d..98cc570 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
@@ -4563,6 +4563,51 @@ deducted from the default organization.</source>
<context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
</context-group>
</trans-unit>
+ <trans-unit id="No Entitlements Available">
+<source>No Entitlements Available</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Regular Usage">
+<source>Regular Usage</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Regular Proposed Total">
+<source>Regular Proposed Total</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Flex Usage">
+<source>Flex Usage</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Flex Proposed Total">
+<source>Flex Proposed Total</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="Entitlement Usage Type">
+<source>Used / Total</source>
+ <context-group name="ctx">
+ <context context-type="sourcefile">/rhn/admin/multiorg/OrgSoftwareSubscriptions</context>
+ </context-group>
+ </trans-unit>
+
+
+
+
<trans-unit id="softwareEntitlementDetails.noChannelsFound">
<source>No channels found.</source>
<context-group name="ctx">
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/org/OrgHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/org/OrgHandler.java
index 482d139..7773785 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/org/OrgHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/org/OrgHandler.java
@@ -508,13 +508,12 @@ public class OrgHandler extends BaseHandler {
String channelFamilyLabel, Integer allocation) {
getSatAdmin(sessionKey);
-
Org org = verifyOrgExists(orgId);
lookupChannelFamily(channelFamilyLabel);
UpdateOrgSoftwareEntitlementsCommand cmd =
new UpdateOrgSoftwareEntitlementsCommand(channelFamilyLabel, org,
- new Long(allocation));
+ Long.valueOf(allocation), 0L);
ValidatorError ve = cmd.store();
if (ve != null) {
throw new ValidationException(ve.getMessage());
@@ -524,6 +523,50 @@ public class OrgHandler extends BaseHandler {
}
/**
+ * Set an organizations entitlement allocation for a channel family.
+ *
+ * If increasing the entitlement allocation, the default organization
+ * must have a sufficient number of free entitlements.
+ *
+ * @param sessionKey User's session key.
+ * @param orgId Organization ID to set allocation for.
+ * @param channelFamilyLabel Channel family to set allocation for.
+ * @param allocation New flex entitlement allocation.
+ * @return 1 on success.
+ *
+ * @xmlrpc.doc Set an organization's flex entitlement allocation for the given software
+ * entitlement.
+ *
+ * If increasing the flex entitlement allocation, the default organization
+ * (i.e. orgId=1) must have a sufficient number of free flex entitlements.
+ *
+ * @xmlrpc.param #param("string", "sessionKey")
+ * @xmlrpc.param #param("int", "orgId")
+ * @xmlrpc.param #param_desc("string", "label", "Software entitlement label.")
+ * @xmlrpc.param #param("int", "allocation")
+ * @xmlrpc.returntype #return_int_success()
+ */
+ public int setSoftwareFlexEntitlements(String sessionKey, Integer orgId,
+ String channelFamilyLabel, Integer allocation) {
+
+ getSatAdmin(sessionKey);
+ Org org = verifyOrgExists(orgId);
+ lookupChannelFamily(channelFamilyLabel);
+
+ UpdateOrgSoftwareEntitlementsCommand cmd =
+ new UpdateOrgSoftwareEntitlementsCommand(channelFamilyLabel, org,
+ 0L, Long.valueOf(allocation));
+ ValidatorError ve = cmd.store();
+ if (ve != null) {
+ throw new ValidationException(ve.getMessage());
+ }
+
+ return 1;
+ }
+
+
+
+ /**
* Lookup a channel family, throwing an exception if it cannot be found.
*
* @param channelFamilyLabel Channel family label to look up.
diff --git a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
index 253676b..c773824 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java
@@ -248,20 +248,28 @@ public class ChannelManager extends BaseManager {
}
for (ChannelOverview sato : satEntitlements) {
- ChannelOverview orgo = orgMap.get(sato.getId());
OrgChannelFamily ocf = new OrgChannelFamily();
+
ocf.setSatelliteCurrentMembers(sato.getCurrentMembers());
ocf.setSatelliteMaxMembers(sato.getMaxMembers());
+ ocf.setSatelliteCurrentFlex(sato.getCurrentFlex());
+ ocf.setSatelliteMaxFlex(sato.getMaxFlex());
ocf.setId(sato.getId());
ocf.setName(sato.getName());
ocf.setLabel(sato.getLabel());
+
+ ChannelOverview orgo = orgMap.get(sato.getId());
if (orgo == null) {
ocf.setCurrentMembers(new Long(0));
ocf.setMaxMembers(new Long(0));
+ ocf.setMaxFlex(0L);
+ ocf.setCurrentFlex(0L);
}
else {
ocf.setCurrentMembers(orgo.getCurrentMembers());
ocf.setMaxMembers(orgo.getMaxMembers());
+ ocf.setMaxFlex(orgo.getMaxFlex());
+ ocf.setCurrentFlex(orgo.getCurrentFlex());
}
if (ocf.getSatelliteMaxMembers() != null) {
ret.add(ocf);
@@ -272,19 +280,6 @@ public class ChannelManager extends BaseManager {
/**
* Returns a list channel entitlements for all orgs.
- * @param pc The PageControl
- * @return channel entitlements
- */
- public static DataResult<ChannelOverview> entitlementsForAllOrgs(PageControl pc) {
- SelectMode m = ModeFactory.getMode("Channel_queries",
- "channel_entitlements_for_all_orgs");
-
- Map params = new HashMap();
- return makeDataResult(params, params, pc, m);
- }
-
- /**
- * Returns a list channel entitlements for all orgs.
* @return channel entitlements for multiorgs
*/
public static DataList<MultiOrgEntitlementsDto> entitlementsForAllMOrgs() {
diff --git a/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java b/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
index 069e60b..0f67f81 100644
--- a/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/org/UpdateOrgSoftwareEntitlementsCommand.java
@@ -24,6 +24,7 @@ import com.redhat.rhn.domain.org.Org;
import com.redhat.rhn.domain.org.OrgFactory;
import org.apache.log4j.Logger;
+import org.apache.tools.ant.taskdefs.condition.IsFileSelected;
import java.util.HashMap;
import java.util.Map;
@@ -42,6 +43,7 @@ public class UpdateOrgSoftwareEntitlementsCommand {
private Org org;
private long newTotal;
+ private long newFlexTotal;
private ChannelFamily channelFamily;
/**
@@ -49,14 +51,17 @@ public class UpdateOrgSoftwareEntitlementsCommand {
* @param channelFamilyLabel label of entitlement to update
* @param orgIn to update totals for
* @param newTotalIn This is the *proposed* new total for the org you are passing in.
+ * @param newFlexTotalIn This is the *proposed* new flex total
+ * for the org you are passing in.
*/
public UpdateOrgSoftwareEntitlementsCommand(String channelFamilyLabel,
- Org orgIn, Long newTotalIn) {
+ Org orgIn, Long newTotalIn, Long newFlexTotalIn) {
if (orgIn.getId().equals(OrgFactory.getSatelliteOrg().getId())) {
throw new IllegalArgumentException("Cant update the default org");
}
this.org = orgIn;
this.newTotal = newTotalIn;
+ this.newFlexTotal = newFlexTotalIn;
this.channelFamily = ChannelFamilyFactory.lookupByLabel(channelFamilyLabel,
OrgFactory.getSatelliteOrg());
if (this.channelFamily == null) {
@@ -70,16 +75,13 @@ public class UpdateOrgSoftwareEntitlementsCommand {
* @return if we should force unentitlement if
* current members is greater then proposed entitlement count
*/
- private boolean forceUnentitlement() {
+ private boolean forceUnentitlement(Long orgCur, Long orgProposedMax) {
boolean retval = true;
-
- Long orgCur = this.channelFamily.getCurrentMembers(this.org);
-
if (orgCur == null) {
- orgCur = new Long(0);
+ orgCur = 0L;
}
- if (orgCur > this.newTotal && !ConfigDefaults.get().forceUnentitlement()) {
+ if (orgCur > orgProposedMax && !ConfigDefaults.get().forceUnentitlement()) {
retval = false;
}
return retval;
@@ -89,32 +91,62 @@ public class UpdateOrgSoftwareEntitlementsCommand {
* Update the entitlements in the DB.
* @return ValidatorError if there were any problems with the proposed total
*/
- public ValidatorError store() {
-
+ public ValidatorError store() {
+ ValidatorError err = null;
+ err = storeRegular();
+ if (err == null) {
+ return storeFlex();
+ }
+ return err;
+ }
+
+ private ValidatorError storeRegular() {
// Check available entitlements
Org satOrg = OrgFactory.getSatelliteOrg();
- Long avail = new Long(0);
- Long maxMem = this.channelFamily.getMaxMembers(satOrg);
- Long current = this.channelFamily.getMaxMembers(this.org);
-
- if (current == null) {
- current = new Long(0);
+ return store(channelFamily.getMaxMembers(satOrg),
+ channelFamily.getMaxMembers(org),
+ channelFamily.getCurrentMembers(satOrg),
+ channelFamily.getCurrentMembers(org),
+ newTotal, false);
+ }
+
+ private ValidatorError storeFlex() {
+ // Check available entitlements
+ Org satOrg = OrgFactory.getSatelliteOrg();
+ return store(channelFamily.getMaxFlex(satOrg),
+ channelFamily.getMaxFlex(org),
+ channelFamily.getCurrentFlex(satOrg),
+ channelFamily.getCurrentFlex(org),
+ newFlexTotal, true);
+ }
+
+ private ValidatorError store(Long satMax, Long orgMax,
+ Long satCurrent, Long orgCurrent,
+ Long proposed, boolean isFlex) {
+ // No sense making the call if its the same.
+ if (orgMax == proposed) {
+ return null;
}
- if (maxMem != null) {
- avail = maxMem -
- this.channelFamily.getCurrentMembers(satOrg) +
- current;
+
+ if (orgMax == null) {
+ orgMax = 0L;
+ }
+
+ Long avail = 0L;
+ if (satMax != null) {
+ avail = satMax - satCurrent + orgMax;
}
-
- if (avail < this.newTotal) {
- return new ValidatorError("org.entitlements.software.toomany",
- this.org.getName(),
- this.channelFamily.getName(),
- avail);
+
+ if (proposed == null || proposed < 0 || avail < proposed) {
+ String key = isFlex ? "org.entitlements.software.not_in_range.flex" :
+ "org.entitlements.software.not_in_range";
+
+ return new ValidatorError(key, this.org.getName(),
+ this.channelFamily.getName(), 0, avail);
}
// Proposed cannot be lower than current members
- if (!forceUnentitlement()) {
+ if (!forceUnentitlement(orgCurrent, proposed)) {
return new ValidatorError(
"org.entitlements.software.proposedwarning",
this.channelFamily.getName(),
@@ -122,25 +154,21 @@ public class UpdateOrgSoftwareEntitlementsCommand {
);
}
- // No sense making the call if its the same.
- if (current.longValue() == this.newTotal) {
- return null;
- }
-
+
Long toOrgId;
Long fromOrgId;
long actualTotal;
// If we are decreasing the # of entitlements
// we give back to the default org.
- if (current.longValue() > this.newTotal) {
+ if (orgMax.longValue() > proposed) {
fromOrgId = this.org.getId();
toOrgId = OrgFactory.getSatelliteOrg().getId();
- actualTotal = current.longValue() - this.newTotal;
+ actualTotal = orgMax.longValue() - proposed;
}
else {
toOrgId = this.org.getId();
fromOrgId = OrgFactory.getSatelliteOrg().getId();
- actualTotal = this.newTotal - current.longValue();
+ actualTotal = proposed - orgMax.longValue();
}
Map in = new HashMap();
@@ -148,12 +176,19 @@ public class UpdateOrgSoftwareEntitlementsCommand {
in.put("channel_family_label", channelFamily.getLabel());
in.put("from_org_id", fromOrgId);
in.put("to_org_id", toOrgId);
- in.put("quantity", actualTotal);
+ if (isFlex) {
+ in.put("quantity", 0);
+ in.put("flex_quantity", actualTotal);
+
+ }
+ else {
+ in.put("quantity", actualTotal);
+ in.put("flex_quantity", 0);
+
+ }
CallableMode m = ModeFactory.getCallableMode(
"Org_queries", "assign_software_entitlements");
m.execute(in, new HashMap());
return null;
}
-
-
}
diff --git a/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java b/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
index f69ab00..f75f95d 100644
--- a/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
+++ b/java/code/src/com/redhat/rhn/manager/org/test/UpdateOrgSoftwareEntitlementsTest.java
@@ -83,7 +83,7 @@ public class UpdateOrgSoftwareEntitlementsTest extends BaseTestCaseWithUser {
// Now give the remaining:
cmd = new UpdateOrgSoftwareEntitlementsCommand(fam.getLabel(), user.getOrg(),
- ChannelFamilyFactoryTest.ENTITLEMENT_ALLOCATION);
+ ChannelFamilyFactoryTest.ENTITLEMENT_ALLOCATION, 0L);
assertNull(cmd.store());
}
@@ -91,18 +91,18 @@ public class UpdateOrgSoftwareEntitlementsTest extends BaseTestCaseWithUser {
Long orig = fam.getMaxMembers(OrgFactory.getSatelliteOrg());
UpdateOrgSoftwareEntitlementsCommand cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(1));
+ fam.getLabel(), user.getOrg(), new Long(1), 0L);
assertNull(cmd.store());
reloadFamilies();
Long now = fam.getMaxMembers(OrgFactory.getSatelliteOrg()).longValue();
assertEquals(orig.longValue() - 1, now.longValue());
cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(1));
+ fam.getLabel(), user.getOrg(), new Long(1), 0L);
assertNull(cmd.store());
reloadFamilies();
assertEquals(orig.longValue() - 1, now.longValue());
cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(0));
+ fam.getLabel(), user.getOrg(), new Long(0), 0L);
cmd.store();
reloadFamilies();
now = fam.getMaxMembers(OrgFactory.getSatelliteOrg()).longValue();
@@ -114,11 +114,11 @@ public class UpdateOrgSoftwareEntitlementsTest extends BaseTestCaseWithUser {
Long origValue = fam.getMaxMembers(OrgFactory.getSatelliteOrg());
UpdateOrgSoftwareEntitlementsCommand cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(1));
+ fam.getLabel(), user.getOrg(), new Long(1), 0L);
assertNull(cmd.store());
reloadFamilies();
cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(2));
+ fam.getLabel(), user.getOrg(), new Long(2), 0L);
assertNull(cmd.store());
reloadFamilies();
assertEquals(2, fam.getMaxMembers(user.getOrg()).longValue());
@@ -135,7 +135,7 @@ public class UpdateOrgSoftwareEntitlementsTest extends BaseTestCaseWithUser {
}
}
UpdateOrgSoftwareEntitlementsCommand cmd = new UpdateOrgSoftwareEntitlementsCommand(
- fam.getLabel(), user.getOrg(), new Long(1));
+ fam.getLabel(), user.getOrg(), new Long(1), 0L);
assertNull(cmd.store());
}
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
index 58f3ee0..d2f2314 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
@@ -44,55 +44,76 @@
<rl:listset name="entitlementSet">
<rhn:submitted/>
<input type="hidden" name="oid" value="${param.oid}"/>
- <!-- Hack to get around the problem with form submitting when doing
- pagination. See javascript attached to the submit button below. -->
- <input type="hidden" name="updateOrganizations" value="0"/>
-
- <rl:list dataset="pageList"
+ <rl:list
width="100%"
- name="userList"
styleclass="list"
emptykey="orgsoftwaresubs.jsp.nochannelfams">
- <rl:column bound="false"
- sortable="false"
+ <rl:column
+ filterattr="name"
headerkey="entitlements.jsp.channel" styleclass="first-column">
<a href="/rhn/admin/multiorg/SoftwareEntitlementDetails.do?cfid=${current.id}"><c:out value="${current.name}" /></a>
</rl:column>
- <rl:column bound="false"
- sortable="false"
- headerkey="orgsystemsubs.jsp.total">
- <c:out value="${current.maxMembers}" />
- </rl:column>
- <rl:column bound="false"
- sortable="false"
- headerkey="orgsystemsubs.jsp.usage">
- <c:out value="${current.currentMembers}" />
+ <rl:column styleclass="center"
+ headertext="${rhn:localize('Regular Usage')} <br/>(${rhn:localize('Entitlement Usage Type')})">
+ <c:out value="${current.currentMembers} / ${current.maxMembers}" />
</rl:column>
- <rl:column bound="false"
- sortable="false"
- headerkey="orgsystemsubs.jsp.proposed_total" styleclass="last-column">
- <c:choose>
- <c:when test="${param.oid != 1}">
- <input name="${current.id}" value="${current.maxMembers}" type="text"
- onkeydown="return blockEnter(event)">
- <br>
- <span class="small-text"><bean:message key="orgsystemsubs.jsp.possible_vals"
- arg0="0" arg1="${current.satelliteMaxMembers - current.satelliteCurrentMembers + current.maxMembers}"/></span>
- </c:when>
- <c:otherwise>
- ${current.maxMembers}
- </c:otherwise>
- </c:choose>
+ <rl:column
+ headerkey="Regular Proposed Total">
+ <c:choose>
+ <c:when test = "${current.maxAvailable == 0}">
+ <bean:message key="No Entitlements Available"/>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="${param.oid != 1}">
+ <input name="${current.key}" value="${requestScope.subscriptions[current.key]}" type="text" size = "13"
+ onkeydown="return blockEnter(event)">
+ <br>
+ <span class="small-text"><bean:message key="orgsystemsubs.jsp.possible_vals"
+ arg0="0" arg1="${current.maxAvailable}"/></span>
+ </c:when>
+ <c:otherwise>
+ ${current.maxAvailable}
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+ <rl:column styleclass="center"
+ headertext="${rhn:localize('Flex Usage')} <br/>(${rhn:localize('Entitlement Usage Type')})">
+ <c:out value="${current.currentFlex} / ${current.maxFlex}" />
</rl:column>
+ <rl:column bound="false"
+ sortable="false"
+ headerkey="Flex Proposed Total" styleclass="last-column">
+ <c:choose>
+ <c:when test = "${current.maxAvailableFlex == 0}">
+ <bean:message key="No Entitlements Available"/>
+ </c:when>
+ <c:otherwise>
+ <c:choose>
+ <c:when test="${param.oid != 1}">
+ <input name="${current.flexKey}" value="${requestScope.subscriptions[current.flexKey]}" type="text" size = "13"
+ onkeydown="return blockEnter(event)">
+ <br>
+ <span class="small-text"><bean:message key="orgsystemsubs.jsp.possible_vals"
+ arg0="0" arg1="${current.maxAvailableFlex}"/></span>
+ </c:when>
+ <c:otherwise>
+ ${current.maxAvailableFlex}
+ </c:otherwise>
+ </c:choose>
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
</rl:list>
<c:if test="${param.oid != 1}">
<div align="right">
<hr/>
- <input type="submit" name="dispatch" value="${rhn:localize('orgdetails.jsp.submit')}"
- onclick="this.form.updateOrganizations.value = '1';return true;">
+ <input type="submit" name="dispatch" value="${rhn:localize('orgdetails.jsp.submit')}"/>
</div>
</c:if>
</rl:listset>
diff --git a/java/code/webapp/WEB-INF/struts-config.xml b/java/code/webapp/WEB-INF/struts-config.xml
index 205b830..774bee6 100644
--- a/java/code/webapp/WEB-INF/struts-config.xml
+++ b/java/code/webapp/WEB-INF/struts-config.xml
@@ -4536,7 +4536,7 @@
<forward name="success"
path="/admin/multiorg/OrgSoftwareSubscriptions.do" redirect="true" />
<forward name="error"
- path="/admin/multiorg/OrgSoftwareSubscriptions.do" redirect="true" />
+ path="/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp"/>
</action>
<action path="/admin/multiorg/SoftwareEntitlements"
diff --git a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
index 22da3ca..80d963b 100644
--- a/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/oracle/packages/rhn_entitlements.pkb
@@ -1152,8 +1152,8 @@ is
flex_in in number
)
is
- prev_ent_count number;
- prev_ent_count_flex number;
+ from_org_prev_ent_count number;
+ from_org_prev_ent_count_flex number;
new_ent_count number;
new_ent_count_flex number;
to_org_prev_ent_count number;
@@ -1165,7 +1165,7 @@ is
begin
select max_members
- into prev_ent_count
+ into from_org_prev_ent_count
from rhnChannelFamily cf,
rhnPrivateChannelFamily pcf
where pcf.org_id = from_org_id_in
@@ -1192,7 +1192,7 @@ is
begin
select fve_max_members
- into prev_ent_count_flex
+ into from_org_prev_ent_count_flex
from rhnChannelFamily cf,
rhnPrivateChannelFamily pcf
where pcf.org_id = from_org_id_in
@@ -1214,7 +1214,7 @@ is
and cf.label = channel_family_label_in;
exception
when NO_DATA_FOUND then
- to_org_prev_ent_count := 0;
+ to_org_prev_ent_count_flex := 0;
end;
begin
@@ -1228,14 +1228,14 @@ is
'invalid_channel_family');
end;
- new_ent_count := prev_ent_count - quantity_in;
- new_ent_count_flex := prev_ent_count_flex - flex_in;
+ new_ent_count := from_org_prev_ent_count - quantity_in;
+ new_ent_count_flex := from_org_prev_ent_count_flex - flex_in;
- if prev_ent_count > new_ent_count then
+ if from_org_prev_ent_count >= new_ent_count then
new_quantity := to_org_prev_ent_count + quantity_in;
end if;
- if prev_ent_count_flex > new_ent_count_flex then
+ if from_org_prev_ent_count_flex >= new_ent_count_flex then
new_flex := to_org_prev_ent_count_flex + flex_in;
end if;
13 years, 10 months
Branch 'yum-repo-sync' - java/code
by Shannon Hughes
java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java | 5 -----
java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java | 7 +------
java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java | 2 +-
3 files changed, 2 insertions(+), 12 deletions(-)
New commits:
commit 51d2ffe57f5ed3d8ccad31635923cfad8c9aa08c
Author: Shannon Hughes <shughes(a)redhat.com>
Date: Tue Jun 22 15:51:17 2010 -0400
remove call to repo task from the channel edit/update cmds
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
index c4735c2..04bffb1 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/EditChannelAction.java
@@ -169,11 +169,6 @@ public class EditChannelAction extends RhnAction implements Listable {
params);
}
- if (errors.isEmpty() && form.get("sync_repo") != null) {
- createSuccessMessage(request, "message.syncscheduled",
- form.getString("name"));
- }
-
return getStrutsDelegate().forwardParams(
mapping.findForward("success"), params);
}
diff --git a/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java b/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
index 94f5014..abd6936 100644
--- a/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
+++ b/java/code/src/com/redhat/rhn/manager/channel/UpdateChannelCommand.java
@@ -89,12 +89,7 @@ public class UpdateChannelCommand extends CreateChannelCommand {
c.setMaintainerEmail(maintainerEmail);
c.setMaintainerPhone(maintainerPhone);
c.setSupportPolicy(supportPolicy);
-
- if (syncRepo && !c.getSources().isEmpty()) {
- TaskFactory.createTask(user.getOrg(), RepoSyncTask.DISPLAY_NAME,
- c.getSources().iterator().next().getId());
- }
-
+
// need to save before calling stored proc below
ChannelFactory.save(c);
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java b/java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java
index 76dbb0a..542d67e 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/RepoSyncTask.java
@@ -70,7 +70,7 @@ public class RepoSyncTask implements Job {
continue;
}
Channel c = ChannelFactory.lookupById(task.getData());
- if (log.isInfoEnabled()) {
+ if (log.isInfoEnabled() && c != null) {
log.info("Syncing repos for channel: " + c.getName());
}
if (c == null) {
13 years, 10 months