backend/rhn-conf/rhn_server.conf | 9 +++
backend/server/connectors/__init__.py | 19 +++++++
backend/server/connectors/rhnChannelConnector.py | 23 ++++++++
backend/server/handlers/xmlrpc/registration.py | 2
backend/server/rhnChannel.py | 8 ---
web/modules/rhn/RHN/DB/Server.pm | 60 -----------------------
6 files changed, 53 insertions(+), 68 deletions(-)
New commits:
commit e351a8e13e3cfe5be858c14c03c158014616d444
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 27 20:28:11 2010 -0400
Added a nice framework hook point to handle xmlrpc stuff
diff --git a/backend/rhn-conf/rhn_server.conf b/backend/rhn-conf/rhn_server.conf
index c6808fa..5845925 100644
--- a/backend/rhn-conf/rhn_server.conf
+++ b/backend/rhn-conf/rhn_server.conf
@@ -133,3 +133,12 @@ use_taskomatic_repomd = 1
# list of checksum types, most prefered first
checksum_priority_list = sha512, sha384, sha256, sha1, md5
+
+# URL for our internal xmlrpc server
+# user for stored procedures
+internal_host = localhost
+
+#tomcat server port
+internal_port = 8080
+internal_suffix=/rhn/rpc/internal
+
diff --git a/backend/server/connectors/__init__.py
b/backend/server/connectors/__init__.py
new file mode 100644
index 0000000..9fd2aa4
--- /dev/null
+++ b/backend/server/connectors/__init__.py
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+#
+from common import initCFG, CFG
+import xmlrpclib
+initCFG('server.satellite')
+XMLRPC = xmlrpclib.Server("http://" + CFG.INTERNAL_HOST + ":" +
str(CFG.INTERNAL_PORT) + CFG.INTERNAL_SUFFIX)
diff --git a/backend/server/connectors/rhnChannelConnector.py
b/backend/server/connectors/rhnChannelConnector.py
new file mode 100644
index 0000000..53f0c21
--- /dev/null
+++ b/backend/server/connectors/rhnChannelConnector.py
@@ -0,0 +1,23 @@
+#
+# 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.
+#
+#
+from . import XMLRPC
+def subscribe(server_id, channel_id):
+ try:
+ XMLRPC.channel.subscribe_no_user(int(server_id), int(channel_id))
+ except:
+ #TODO Handle Error Code
+ pass
+
diff --git a/backend/server/rhnChannel.py b/backend/server/rhnChannel.py
index b95d5f5..ebab136 100644
--- a/backend/server/rhnChannel.py
+++ b/backend/server/rhnChannel.py
@@ -13,7 +13,6 @@
# in this software or its documentation.
#
#
-import xmlrpclib
import time
import string
import rpm
@@ -30,8 +29,7 @@ from rhnDependency import MakeEvrError
# local module
import rhnUser, rhnSQL, rhnLib
-
-XMLRPC = xmlrpclib.Server("http://localhost:8080/rhn/rpc/internal")
+from connectors import rhnChannelConnector
class NoBaseChannelError(Exception):
pass
@@ -1734,11 +1732,9 @@ def get_obsoletes_blacklist(channel):
# small wrapper around a PL/SQL function
def _subscribe_sql(server_id, channel_id, commit = 1):
log_debug(3, server_id, channel_id, commit)
-
-
try:
# don't run the EC yet
- XMLRPC.channel.subscribe_no_user(int(server_id), int(channel_id))
+ rhnChannelConnector.subscribe(server_id, channel_id)
except rhnSQL.SQLSchemaError, e:
if e.errno == 20235: # channel_family_no_subscriptions
raise SubscriptionCountExceeded(channel_id=channel_id)
commit 1b437e24616b53017d17ffa3cf2b15ed8ff39d78
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 27 20:23:29 2010 -0400
removed an unused method
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index 2163844..1bde1f5 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -1764,66 +1764,6 @@ sub can_entitle_server {
return $can ? 1 : 0;
}
-sub set_channels {
- my $self = shift;
- my %params = validate(@_, {user_id => 1, channels => 1});
- my %new_channels = map { $_ => 1 } @{$params{channels}};
- my $user_id = $params{user_id};
-
- my @remove;
- my @add;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOS;
-SELECT SC.channel_id
- FROM rhnServerChannel SC
- WHERE SC.server_id = ?
-EOS
-
- my $sth = $dbh->prepare($query);
- $sth->execute($self->id);
-
- while (my ($cid) = $sth->fetchrow) {
- if (exists $new_channels{$cid}) {
- delete $new_channels{$cid};
- }
- else {
- push @remove, $cid;
- }
- }
-
- @add = keys %new_channels;
- foreach my $add (@add) {
-
- # do quick unsubscribe + quick subscribe
- my $sth = $dbh->prepare(<<EOS);
-BEGIN
- rhn_channel.unsubscribe_server(:server_id, :cid, 0);
- rhn_channel.subscribe_server(:server_id, :cid, 0, :user_id);
-END;
-EOS
- $sth->execute_h(server_id => $self->id, cid => $add, user_id =>
$user_id);
- }
-
- foreach my $remove (@remove) {
- # do quick unsubscribes
- my $sth = $dbh->prepare(<<EOS);
-BEGIN
- rhn_channel.unsubscribe_server(:server_id, :cid, 0);
-END;
-EOS
- $sth->execute_h(server_id => $self->id, cid => $remove);
- }
-
- # manually recompute the cache so that it's immediate
- my ($add, $remove, $unc) = RHN::DB::Server->update_cache_for_server($dbh,
$self->id);
-
- $dbh->commit;
-
- return { added => [ @add ],
- removed => [ @remove ],
- };
-}
sub entitle_server {
my $self_or_class = shift;
commit a8d9a677d468b18e993dd235c021225d3d9d80f9
Author: Partha Aji <paji(a)redhat.com>
Date: Thu May 27 20:23:14 2010 -0400
removed accidental debug commit
diff --git a/backend/server/handlers/xmlrpc/registration.py
b/backend/server/handlers/xmlrpc/registration.py
index a6afe24..59f6479 100644
--- a/backend/server/handlers/xmlrpc/registration.py
+++ b/backend/server/handlers/xmlrpc/registration.py
@@ -347,8 +347,6 @@ class Registration(rhnHandler):
# let the stacked activation keys do their magic
tokens_obj.is_rereg_token = 0
rhnFlags.set("re_registration_token", 0)
-
- #import epdb; epdb.serve(port=9999)
# now if we have a token, load the extra registration
# information from the token