web/modules/pxt/PXT/Request.pm | 13 -
web/modules/rhn/RHN/DB/AppInstall/Session.pm | 18 --
web/modules/rhn/RHN/DB/Org.pm | 35 -----
web/modules/rhn/RHN/DB/SatInstall.pm | 176 ---------------------------
web/modules/rhn/RHN/Entitlements.pm | 54 --------
web/modules/rhn/RHN/ProxyInstall.pm | 39 -----
6 files changed, 335 deletions(-)
New commits:
commit 92bcc59307b399a6a5aa8fef94cdbcfe8191809b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:45:06 2010 +0100
Removal of Sniglets::MonitoringConfig made push_monitoring_config_changes unused.
diff --git a/web/modules/rhn/RHN/ProxyInstall.pm b/web/modules/rhn/RHN/ProxyInstall.pm
index 505a506..8cfe735 100644
--- a/web/modules/rhn/RHN/ProxyInstall.pm
+++ b/web/modules/rhn/RHN/ProxyInstall.pm
@@ -612,45 +612,6 @@ sub have_package {
}
-# The process to push monitoring config changes is currently:
-# 1) Find all Monitoring-enabled proxies (those with SatCluster records).
-# 2) Schedule a remote command for them: service rhn-proxy restart
-sub push_monitoring_config_changes {
- my $class = shift;
- my $user = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "scout_queries",
- -mode => 'scouts_for_org');
- my $data = $ds->execute_query(-org_id => $user->org_id);
-
- # Use a hash for uniqification
- my %server_ids = map { ($_->{SERVER_ID}, 1) }
- grep { $_->{SERVER_ID} } @{$data};
-
- return unless %server_ids;
-
- my $scheduled_time = RHN::Date->now()->long_date();
-
- my $script =<<EOQ;
-#!/bin/sh
-
-/sbin/service MonitoringScout restart
-EOQ
-
- my $script_aid = RHN::Scheduler->schedule_remote_command(-org_id =>
$user->org_id,
- -user_id => $user->id,
- -server_ids => [ keys %server_ids ],
- -earliest => $scheduled_time,
- -action_name => 'Restart Monitoring Services',
- -script => $script,
- -username => 'root',
- -group => 'root',
- -timeout => 300,
- );
-
- return $script_aid;
-}
-
sub import_ssl_cert_for_kickstarts {
my $ca_cert = shift;
my $org_id = shift;
commit 18a3790823ec64e423447d0afab58b59d98232c4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:43:24 2010 +0100
Removal of org_entitlement_choices made bunch of *_slot_name's unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index 7f017ae..5174fb3 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -654,41 +654,6 @@ sub slot_name {
return $self->{cached_slot_names}->{$ent};
}
-sub basic_slot_name {
- my $self = shift;
-
- return $self->slot_name('sw_mgr_entitled');
-}
-
-sub enterprise_slot_name {
- my $self = shift;
-
- return $self->slot_name('enterprise_entitled');
-}
-
-sub provisioning_slot_name {
- my $self = shift;
-
- return $self->slot_name('provisioning_entitled');
-}
-
-sub nonlinux_slot_name {
- my $self = shift;
-
- return $self->slot_name('nonlinux_entitled');
-}
-
-sub virtualization_slot_name {
- my $self = shift;
-
- return $self->slot_name('virtualization_host');
-}
-
-sub virtualization_platform_slot_name {
- my $self = shift;
-
- return $self->slot_name('virtualization_host_platform');
-}
sub org_channel_setting {
commit 320dec84aa761f6e323d8a645859e0c520f4258d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:39:18 2010 +0100
org_entitlement_choices and allowed_entitlement_transition are not used anywhere,
removing.
diff --git a/web/modules/rhn/RHN/Entitlements.pm b/web/modules/rhn/RHN/Entitlements.pm
index 4f62778..37d126e 100644
--- a/web/modules/rhn/RHN/Entitlements.pm
+++ b/web/modules/rhn/RHN/Entitlements.pm
@@ -91,60 +91,6 @@ sub entitlement_grants_service { # Need to refactor Tokens to remove
this entire
return 0;
}
-# given an org and a default entitlement, return the
-# selectbox-suitable choice array
-sub org_entitlement_choices {
- my $class = shift;
- my $org = shift;
- my $current_ent = shift;
-
- my @ret;
- if ($org->has_entitlement('sw_mgr_enterprise')) {
- push @ret, [ 'None', 'none' ];
- push @ret, [ $org->basic_slot_name, 'sw_mgr_entitled' ]
- if not PXT::Config->get("satellite");
- push @ret, [ $org->enterprise_slot_name, 'enterprise_entitled' ];
- push @ret, [ $org->provisioning_slot_name, 'provisioning_entitled' ]
- if $org->has_entitlement('rhn_provisioning');
- push @ret, [ $org->virtualization_slot_name, 'virtualization_host' ]
- if $org->has_entitlement('virtualization_host');
- push @ret, [ $org->virtualization_platform_slot_name,
'virtualization_host_platform' ]
- if $org->has_entitlement('virtualization_host_platform');
- push @ret, [ $org->nonlinux_slot_name, 'monitoring_entitled' ]
- if $org->has_entitlement('rhn_monitor');
- push @ret, [ $org->nonlinux_slot_name, 'nonlinux_entitled' ]
- if $org->has_entitlement('rhn_nonlinux');
- }
- else {
- @ret =
- ([ 'None', 'none' ],
- [ $org->basic_slot_name, 'sw_mgr_entitled' ]);
- }
-
- for my $ret (@ret) {
- $ret->[2] = 0;
- $ret->[2] = 1 if $ret->[1] eq $current_ent;
- }
-
- return @ret;
-}
-
-my %transitions =
- (none => [ qw/sw_mgr_entitled enterprise_entitled provisioning_entitled
nonlinux_entitled/ ],
- sw_mgr_entitled => [ qw/enterprise_entitled provisioning_entitled/ ],
- enterprise_entitled => [ qw/provisioning_entitled/ ],
- provisioning_entitled => [ ]);
-
-sub allowed_entitlement_transition {
- my $class = shift;
- my $from = shift;
- my $to = shift;
-
- return 1 if $from eq $to;
-
- return scalar grep { $to eq $_ } @{$transitions{$from}};
-}
-
# What type of feature is this? Management, provisioning, monitoring, etc.
sub feature_type {
my $class = shift;
commit 4a46f1bbf7eb8995b2c5c3d944434161a59da1cc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:37:27 2010 +0100
Removing bunch of functions from RHN::DB::SatInstall:
get_default_tablespace_name
check_db_privs
check_db_tablespace_settings
check_db_charsets
create_satellite_org
diff --git a/web/modules/rhn/RHN/DB/SatInstall.pm b/web/modules/rhn/RHN/DB/SatInstall.pm
index cee1b95..7d4e3c3 100644
--- a/web/modules/rhn/RHN/DB/SatInstall.pm
+++ b/web/modules/rhn/RHN/DB/SatInstall.pm
@@ -65,148 +65,6 @@ EOQ
return $row ? 1 : 0;
}
-# return 0 if the version is allowed, otherwise dies with the version
-
-sub check_db_version {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my ($v, $c);
-
- $dbh->call_procedure('dbms_utility.db_version', \$v, \$c);
-
- my $version = join('', (split(/\./, $v))[0 .. 2]);
-
- throw "Invalid db version: ($v, $c)" unless
- grep { $version == $_ } @allowed_db_versions;
-
- return 0;
-}
-
-# Find the default tablespace name for the given (oracle) user.
-sub get_default_tablespace_name {
- my $class = shift;
- my $db_user = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT UU.default_tablespace
- FROM user_users UU
- WHERE UU.username = upper(:uname)
-EOQ
-
- $sth->execute_h(uname => $db_user);
-
- my ($ts) = $sth->fetchrow();
- $sth->finish;
-
- throw "No tablespace found for user '$db_user'"
- unless $ts;
-
- return $ts;
-}
-
-sub check_db_privs {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT DISTINCT privilege
- FROM (
- SELECT USP.privilege
- FROM user_sys_privs USP
- UNION
- SELECT RSP.privilege
- FROM role_sys_privs RSP,
- user_role_privs URP
- WHERE RSP.role = URP.granted_role
- UNION
- SELECT RSP.privilege
- FROM role_sys_privs RSP,
- role_role_privs RRP,
- user_role_privs URP1,
- user_role_privs URP2
- WHERE URP1.granted_role = RRP.role
- AND RRP.role = URP2.granted_role
- AND URP2.granted_role = RSP.role
- )
- WHERE privilege = :priv
-EOQ
-
- my @required_privs =
- ('ALTER SESSION',
- 'CREATE SEQUENCE',
- 'CREATE SYNONYM',
- 'CREATE TABLE',
- 'CREATE VIEW',
- 'CREATE PROCEDURE',
- 'CREATE TRIGGER',
- 'CREATE TYPE',
- 'CREATE SESSION',
- );
-
- foreach my $priv (@required_privs) {
- $sth->execute_h(priv => $priv);
- my ($got_priv) = $sth->fetchrow();
-
- unless ($got_priv) {
- throw "Missing privilege: $priv";
- }
-
- $sth->finish;
- }
-
- return 0;
-}
-
-# returns 0 if the tablespace settings are good, dies with error(s) otherwise
-sub check_db_tablespace_settings {
- my $class = shift;
-
- my $oracle_user = shift;
- my $tablespace_name = $class->get_default_tablespace_name($oracle_user);
-
- $class->check_db_privs();
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT UT.status, UT.contents, UT.logging
- FROM user_tablespaces UT
- WHERE UT.tablespace_name = :tname
-EOQ
-
- $sth->execute_h(tname => $tablespace_name);
- my $row = $sth->fetchrow_hashref;
- $sth->finish;
-
- unless (ref $row eq 'HASH' and (%{$row})) {
- throw "tablespace $tablespace_name does not appear to exist";
- }
-
- my %expectations = (STATUS => 'ONLINE',
- CONTENTS => 'PERMANENT',
- LOGGING => 'LOGGING',
- );
- my @errs = ();
-
- foreach my $column (keys %expectations) {
- if ($row->{$column} ne $expectations{$column}) {
- push @errs, sprintf("tablespace %s has %s set to %s where %s is
expected",
- $tablespace_name, $column, $row->{$column}, $expectations{$column});
- }
- }
-
- if (@errs) {
- throw "Tablespace errors: " . join(';', @errs);
- }
-
- return 0;
-}
-
sub get_nls_database_parameters {
my $class = shift;
@@ -228,23 +86,6 @@ EOQ
return %nls_database_parameters;
}
-my @ALLOWED_CHARSETS = qw/UTF8 AL32UTF8/;
-
-# returns 0 if the db is using UTF8, dies with actual character set otherwise.
-sub check_db_charsets {
- my $class = shift;
-
- my %nls_database_parameters = $class->get_nls_database_parameters();
-
- unless (exists $nls_database_parameters{NLS_CHARACTERSET} and
- grep { $nls_database_parameters{NLS_CHARACTERSET} eq $_ } @ALLOWED_CHARSETS) {
- throw "DB is using an invalid (non-UTF8) character set: (NLS_CHARACTERSET =
"
- . $nls_database_parameters{NLS_CHARACTERSET} . ")";
- }
-
- return 0;
-}
-
sub clear_db {
my $class = shift;
@@ -334,23 +175,6 @@ EOQ
return;
}
-sub create_satellite_org {
- my $class = shift;
- my $org_name = shift;
-
- my $dbh = RHN::DB->connect;
-
- my ($org_id) = $class->get_satellite_org_id;
-
- if (defined $org_id) {
- throw "Attempt create an org on satellite when one already exists";
- }
-
- $dbh->call_procedure("create_first_org", $org_name,
PXT::Utils->random_password(16));
-
- return;
-}
-
sub get_satellite_org_id {
my $class = shift;
my $dbh = RHN::DB->connect;
commit a2592029f62bb769856df2379b22386472c86fd3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:32:40 2010 +0100
get_instance_id and set_instance_id are not referenced, removing.
diff --git a/web/modules/rhn/RHN/DB/AppInstall/Session.pm
b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
index 7c4e7c4..25b300c 100644
--- a/web/modules/rhn/RHN/DB/AppInstall/Session.pm
+++ b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
@@ -470,24 +470,6 @@ foreach my $field (keys %valid_fields) {
}
}
-sub get_instance_id {
- my $self = shift;
-
- return $self->get_app_instance->get_id()
-}
-
-sub set_instance_id {
- my $self = shift;
- my $id = shift;
-
- my $app = RHN::AppInstall::Instance->lookup(-id => $id);
-
- $self->set_app_instance($app);
- $self->{":modified:"}->{instance_id} = 1;
-
- return;
-}
-
sub get_user_id {
my $self = shift;
commit d26bd966f2bfd41db566df427e21d18b01a01cf1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:28:21 2010 +0100
Removal of rpc_fault made %fault_messages unused, removing.
diff --git a/web/modules/pxt/PXT/Request.pm b/web/modules/pxt/PXT/Request.pm
index 18a674a..2a1f0d0 100644
--- a/web/modules/pxt/PXT/Request.pm
+++ b/web/modules/pxt/PXT/Request.pm
@@ -530,19 +530,6 @@ sub encode_rpc_result {
return $self->xml_request->encode_rpc_result(@_);
}
-my %fault_messages =
- ( unknown_error => 'Unknown internal error',
- server_security => 'No server perms/server does not exist',
- invalid_login => 'Invalid username/password',
- old_client => 'Your client does not support this version of PXT. Contact
rhn-feedback(a)redhat.com',
- invalid_certificate => 'Invalid server certificate',
- invalid_sat_certificate => 'Invalid entitlement certificate',
- satellite_already_activated => 'Satellite has already been activated',
- no_sat_chan_for_version => 'No Satellite channel exists for specified
version',
- no_access_to_sat_channel => 'Account does not have access to any Satellite
channels',
- insufficient_channel_entitlements => 'All entitlements to the required channel
are currently in use.',
- );
-
sub touch_session {
$_[0]->{session_touched} = 1;
}