15 commits - web/modules web/spacewalk-web.spec
by Jan Pazdziora
web/modules/rhn/RHN/DB/Action.pm | 14 -
web/modules/rhn/RHN/DB/ChannelEditor.pm | 27 --
web/modules/rhn/RHN/DB/Downloads.pm | 94 -------
web/modules/rhn/RHN/DB/Kickstart/Session.pm | 78 -----
web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm | 317 ------------------------
web/modules/rhn/RHN/DB/Probe.pm | 54 ----
web/modules/rhn/RHN/DB/Profile.pm | 134 ----------
web/modules/rhn/RHN/DB/SatCluster.pm | 13
web/modules/rhn/RHN/DB/ServerActions.pm | 18 -
web/modules/rhn/RHN/DB/TableClass.pm | 37 --
web/modules/rhn/RHN/DB/TemplateString.pm | 25 -
web/modules/rhn/RHN/DB/TinyURL.pm | 41 ---
web/modules/rhn/RHN/MonitoringConfigMacro.pm | 47 ---
web/modules/rhn/RHN/TokenGen/Local.pm | 3
web/spacewalk-web.spec | 3
15 files changed, 905 deletions(-)
New commits:
commit a8de1044838c6a68b82db228afc12f91b0b1225f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:51:29 2010 +0100
Removal of mark_failed made delete_systems_from_action unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Action.pm b/web/modules/rhn/RHN/DB/Action.pm
index 0dc0e0b..a23d56f 100644
--- a/web/modules/rhn/RHN/DB/Action.pm
+++ b/web/modules/rhn/RHN/DB/Action.pm
@@ -199,20 +199,6 @@ EOQ
}
}
-sub delete_systems_from_action {
- my $class = shift;
- my $aid = shift;
- my @systems = @_;
-
- my $dbh = RHN::DB->connect;
-
- foreach my $sid (@systems) {
- $dbh->call_procedure('rhn_server.remove_action', $sid, $aid);
- }
-
- $dbh->commit;
-}
-
sub delete_set_from_action {
my $class = shift;
commit 8ba2f77d5bd6b997da5bb34c68f96d2dcba35fef
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:50:17 2010 +0100
Removal of get_tiny_url made tinify_path unused, removing.
diff --git a/web/modules/rhn/RHN/DB/TinyURL.pm b/web/modules/rhn/RHN/DB/TinyURL.pm
index c3f141a..1fabbd8 100644
--- a/web/modules/rhn/RHN/DB/TinyURL.pm
+++ b/web/modules/rhn/RHN/DB/TinyURL.pm
@@ -92,29 +92,4 @@ sub random_url_string {
return $result;
}
-# Take a (local-to-this-server) path and return a tiny url for it and
-# the token string.
-sub tinify_path {
- my $class = shift;
- my %params = validate(@_, { path => 1,
- expiration => 0,
- scheme => { default => 'http' },
- host => 0,
- } );
-
- $params{host} ||= PXT::Config->get('base_domain');
-
- throw "(invalid_url_scheme) $params{scheme} should be 'http' or 'https'"
- unless (grep { $_ eq $params{scheme} } qw/http https/);
-
- my $token = $class->create($params{path}, $params{expiration});
-
- my $tiny_url = new URI::URL;
- $tiny_url->scheme($params{scheme});
- $tiny_url->host($params{host});
- $tiny_url->path('/ty/' . $token);
-
- return ($tiny_url->as_string, $token);
-}
-
1;
commit e778d5e7b747568e219dedc28b6139fe8e7e73d5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:49:03 2010 +0100
Removing bunch of unused methods from RHN::DB::Kickstart::Session:
get_tiny_url
fail_inprogress
mark_failed
set_history_message
last_history_event
diff --git a/web/modules/rhn/RHN/DB/Kickstart/Session.pm b/web/modules/rhn/RHN/DB/Kickstart/Session.pm
index 8c56423..b4dee17 100644
--- a/web/modules/rhn/RHN/DB/Kickstart/Session.pm
+++ b/web/modules/rhn/RHN/DB/Kickstart/Session.pm
@@ -269,39 +269,6 @@ sub get_url {
return $url;
}
-sub get_tiny_url {
- my $self = shift;
- my %params = validate(@_, { expected_time => 0 });
-
- my $url = $self->get_url;
- my $host = $self->system_rhn_host;
-
- my ($tu, $token) =
- RHN::TinyURL->tinify_path(-path => $url->full_path,
- -host => $host,
- -expiration => $params{expected_time});
-
- return ($tu, $token);
-}
-
-sub fail_inprogress {
- my $class = shift;
- my %params = validate(@_, {org_id => 1, sid => 1});
-
- my $ds = new RHN::DataSource::General(-mode => 'kickstart_sessions_for_system');
- my $data = $ds->execute_full(-sid => $params{sid});
-
- foreach my $row (@{$data}) {
- next if (grep { $row->{STATE_LABEL} eq $_ } qw/failed complete/);
- next if ($row->{NEW_SERVER_ID} and $row->{NEW_SERVER_ID} != $params{sid});
-
- my $session = $class->lookup(-id => $row->{ID});
- $session->mark_failed('A new kickstart session was initiated for this system.');
- }
-
- return;
-}
-
sub action {
my $self = shift;
@@ -343,30 +310,6 @@ sub activation_keys {
return @tokens;
}
-sub mark_failed {
- my $self = shift;
- my $message = shift;
-
- my $action = $self->action;
-
- if ($action) {
-
- while ($action->prerequisite) {
- $action = $action->prerequisite_action;
- }
-
- if ($self->current_server) {
- RHN::Action->delete_systems_from_action($action->id, $self->current_server->id);
- }
- }
-
- $self->update_state('failed');
- $self->action_id('');
- $self->commit;
-
- $self->set_history_message($message) if $message;
-}
-
sub old_server {
my $self = shift;
@@ -397,25 +340,4 @@ sub kstree {
return RHN::KSTree->lookup(-id => $self->kstree_id);
}
-sub set_history_message {
- my $self = shift;
- my $message = shift;
-
- my $dbh = RHN::DB->connect;
-
- $dbh->call_procedure("set_ks_session_history_message", $self->id, $self->session_state_label, $message);
- $dbh->commit;
-
- return;
-}
-
-sub last_history_event {
- my $self = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => 'General_queries', -mode => 'kickstart_session_history');
- my $data = $ds->execute_query(-kssid => $self->id);
-
- return $data->[-1];
-}
-
1;
commit 4a31fefab3a31de381806d322bc8deaf882e8c0f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:47:10 2010 +0100
None of the (remaining) three functions is used, making RHN::DB::Downloads obsolete, removing.
diff --git a/web/modules/rhn/RHN/DB/Downloads.pm b/web/modules/rhn/RHN/DB/Downloads.pm
deleted file mode 100644
index cd30bf8..0000000
--- a/web/modules/rhn/RHN/DB/Downloads.pm
+++ /dev/null
@@ -1,94 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-package RHN::DB::Downloads;
-
-use strict;
-use RHN::DB;
-use Params::Validate;
-Params::Validate::validation_options(strip_leading => "-");
-
-sub record_download {
- my $class = shift;
- my %params = validate(@_, { file_id => 1, location => 1, token => 1, ip => 1, user_id => 1 });
-
- my $dbh = RHN::DB->connect();
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnFileDownload
- (file_id, location, token, requestor_ip, start_time, user_id)
-VALUES
- (:file_id, :location, :token, :ip, sysdate, :user_id)
-EOQ
- $sth->execute_h(map { $_ => $params{$_} } keys %params);
- $dbh->commit;
-}
-
-# bump the order of a given category up in the list
-sub bump_channel_category {
- my $class = shift;
- my %params = validate(@_, { channel_id => 1, category => 1 });
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT 1
- FROM rhnDownloads D
- WHERE D.id IN (SELECT CD.downloads_id
- FROM rhnChannelDownloads CD
- WHERE CD.channel_id = :cid)
- AND D.category = :category
-EOQ
-
- $sth->execute_h(cid => $params{channel_id}, category => $params{category});
- my ($row) = $sth->fetchrow;
-
- unless ($row) {
- die sprintf('Could not find a category named "%s" for channel id "%d"',
- $params{category}, $params{channel_id});
- }
-
- $sth = $dbh->prepare(<<EOQ);
-UPDATE rhnDownloads D
- SET D.ordering = D.ordering + 50
- WHERE D.id IN (SELECT CD.downloads_id
- FROM rhnChannelDownloads CD
- WHERE CD.channel_id = :cid)
- AND NOT D.category = :category
-EOQ
-
- $sth->execute_h(cid => $params{channel_id}, category => $params{category});
- $dbh->commit;
-
- return;
-}
-
-sub get_file_id {
- my $class = shift;
- my $file_path = shift;
-
- my $dbh = RHN::DB->connect();
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT id FROM rhnFile WHERE path = :file_path
-EOQ
-
- $sth->execute_h(file_path => $file_path);
- my ($file_id) = $sth->fetchrow;
- $sth->finish;
-
- return $file_id;
-}
-
-1;
diff --git a/web/modules/rhn/RHN/TokenGen/Local.pm b/web/modules/rhn/RHN/TokenGen/Local.pm
index a3c1472..e0c13bd 100644
--- a/web/modules/rhn/RHN/TokenGen/Local.pm
+++ b/web/modules/rhn/RHN/TokenGen/Local.pm
@@ -16,14 +16,11 @@
package RHN::TokenGen::Local;
use strict;
-use RHN::DB::Downloads;
use URI::URL;
use PXT::Utils;
use PXT::Config;
-our @ISA = qw/RHN::DB::Downloads/;
-
use Params::Validate;
Params::Validate::validation_options(strip_leading => "-");
commit beff100b5f246c2e33f850f10f8710aefe6f4ee8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:43:04 2010 +0100
Removing bunch of unused methods from RHN::DB::Profile:
compatible_servers_in_set
compatible_servers
package_info_for_match_action
create_from_profile
remove_packages_by_id_combo
diff --git a/web/modules/rhn/RHN/DB/Profile.pm b/web/modules/rhn/RHN/DB/Profile.pm
index 5bdfae1..1cbff0e 100644
--- a/web/modules/rhn/RHN/DB/Profile.pm
+++ b/web/modules/rhn/RHN/DB/Profile.pm
@@ -159,63 +159,6 @@ sub commit {
delete $self->{":modified:"};
}
-sub compatible_servers_in_set {
- my $self = shift;
- my $user_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
-SELECT S.id,
- S.name
- FROM rhnServer S
- WHERE S.org_id = ?
- AND S.id IN (SELECT element FROM rhnSet WHERE user_id = ? AND label = 'system_list')
- AND EXISTS (SELECT 1
- FROM rhnServerChannel SC
- WHERE SC.server_id = S.id
- AND SC.channel_id = ?)
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute($self->org_id, $user_id, $self->base_channel);
-
- my @ret;
- while (my @data = $sth->fetchrow) {
- push @ret, [ @data ];
- }
-
- return @ret;
-}
-
-
-sub compatible_servers {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
-SELECT S.id,
- S.name
- FROM rhnServer S
- WHERE S.org_id = ?
- AND EXISTS (SELECT 1
- FROM rhnServerChannel SC
- WHERE SC.server_id = S.id
- AND SC.channel_id = ?)
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute($self->org_id, $self->base_channel);
-
- my @ret;
- while (my @data = $sth->fetchrow) {
- push @ret, [ @data ];
- }
-
- return @ret;
-}
-
sub copy_from {
my $self = shift;
my %params = validate(@_, { sid => 0, prid => 0, transaction => 0 });
@@ -267,42 +210,6 @@ EOQ
$dbh->commit unless $params{transaction};
}
-sub package_info_for_match_action {
- my $class = shift;
- my %params = @_;
-
- my ($action_id, $lower, $upper, $total_ref) =
- map { $params{"-" . $_} } qw/action_id lower upper total_rows/;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT PN.name || '-' || PE.evr.as_vre_simple(), AP.parameter
- FROM rhnPackageName PN,
- rhnPackageEVR PE,
- rhnActionPackage AP
- WHERE AP.action_id = ?
- AND AP.name_id = PN.id
- AND AP.evr_id = PE.id
-ORDER BY upper(PN.name), PE.evr, AP.parameter
-EOS
- $sth->execute($action_id);
-
- $$total_ref = 0;
-
- my @result;
- my $i = 1;
- while (my @data = $sth->fetchrow) {
- $$total_ref = $i;
-
- if ($i >= $lower and $i <= $upper) {
- push @result, [ @data ];
- }
- $i++;
- }
- $sth->finish;
- return @result;
-}
-
sub compatible_with_server {
my $class = shift;
my $server_id = shift;
@@ -445,47 +352,6 @@ sub create_from_system {
return $profile;
}
-sub create_from_profile {
- my $class = shift;
- my %params = validate(@_, { prid => 1, org_id => 1, name => 1, description => 1, type => 1, transaction => 0 });
-
- my $old_profile = RHN::Profile->lookup(-id => $params{prid});
- my $profile = RHN::Profile->create;
-
- $profile->org_id($params{org_id});
-
- $profile->base_channel($old_profile->base_channel);
- $profile->name($params{name});
- $profile->description($params{description});
- $profile->set_profile_type($params{type});
-
- $profile->commit($params{transaction});
- $profile->copy_from(-prid => $params{prid}, -transaction => $params{transaction});
-
- return $profile;
-}
-
-sub remove_packages_by_id_combo {
- my $self = shift;
- my @id_combos = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-DELETE
- FROM rhnServerProfilePackage SPP
- WHERE SPP.server_profile_id = :id
- AND SPP.name_id = :name_id
- AND SPP.evr_id = :evr_id
-EOQ
-
- foreach my $combo (@id_combos) {
- my ($name_id, $evr_id) = split /\|/, $combo;
- $sth->execute_h(id => $self->id, evr_id => $evr_id, name_id => $name_id);
- }
-
- $dbh->commit;
-}
-
# goofy, but useful
sub base_channel_id {
my $self = shift;
commit 4bff54343ba87928adb921df11ef451af7283b6f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:40:31 2010 +0100
update_query_lob and insert_query_lob not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/TableClass.pm b/web/modules/rhn/RHN/DB/TableClass.pm
index b42cae7..ebfd4b7 100644
--- a/web/modules/rhn/RHN/DB/TableClass.pm
+++ b/web/modules/rhn/RHN/DB/TableClass.pm
@@ -156,43 +156,6 @@ sub insert_query {
return $ret;
}
-sub update_query_lob {
- my $self = shift;
- my %changed_fields = map { $_ => 1 } @_;
-
- return '' unless grep { exists $changed_fields{$_} } $self->column_names;
-
- my $ret;
- my $n = 0;
-
- $ret .= "UPDATE $self->{name} $self->{alias}\nSET ";
- $ret .= join(", ", map { $n++; "$_ = " . $self->type_to_placeholder($_, ":q$n") }
- grep { exists $changed_fields{$_} } map { "$_" } $self->column_names);
-
- $ret .= "\nWHERE ";
-
- return $ret;
-}
-
-sub insert_query_lob {
- my $self = shift;
- my %changed_fields = map { $_ => 1 } @_;
-
- return '' unless grep { exists $changed_fields{$_} } $self->column_names;
-
- my $ret;
- my $n = 0;
-
- $ret .= "INSERT INTO $self->{name} $self->{alias}\n (";
- $ret .= join(", ", grep { exists $changed_fields{$_} } $self->column_names);
- $ret .= ") VALUES (";
- $ret .= join(", ", map { $n++; $self->type_to_placeholder($_, ":q$n") }
- grep { exists $changed_fields{$_} } map { "$_" } $self->column_names);
- $ret .= ")";
-
- return $ret;
-}
-
sub column_names {
my $self = shift;
commit 2968db6b908ac1849327e4d7801343a623cbb542
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:40:03 2010 +0100
change_set_base_channel not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/ServerActions.pm b/web/modules/rhn/RHN/DB/ServerActions.pm
index 8bb24ed..79de043 100644
--- a/web/modules/rhn/RHN/DB/ServerActions.pm
+++ b/web/modules/rhn/RHN/DB/ServerActions.pm
@@ -174,22 +174,4 @@ EOQ
return $dbh;
}
-sub change_set_base_channel {
- my $class = shift;
- my $set = shift;
- my $channel_id = shift;
-
- my $query = <<EOQ;
-BEGIN
- rhn_channel.bulk_server_base_change(?, ?, ?);
-END;
-EOQ
-
- my $dbh = RHN::DB->connect();
- my $sth = $dbh->prepare($query);
- $sth->execute($channel_id, $set->label, $set->uid);
-
- $dbh->commit;
-}
-
1;
commit 56a365bed47edb01132383e562d44ad16ba98e2d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:38:31 2010 +0100
Removal of RHN::MonitoringConfigMacro made RHN::DB::MonitoringConfigMacro unused, removing.
diff --git a/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm b/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm
deleted file mode 100644
index 4987671..0000000
--- a/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm
+++ /dev/null
@@ -1,210 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-package RHN::DB::MonitoringConfigMacro;
-
-use strict;
-use Carp;
-use Data::Dumper;
-use RHN::DataSource::Simple;
-use RHN::DB;
-
-our $VERSION = (split(/s+/, q$Id$, 4))[2];
-
-
-# Generated getter/setter methods (per Chip)
-{
-
- my @fields = qw(
- name definition description environment
- last_update_user last_update_date
- );
-
- my $tmpl = q|
- sub [[field]] {
- my $self = shift;
- if (@_) {
- $self->{__[[field]]__} = shift;
- }
- return $self->{__[[field]]__};
- };
- |;
-
- foreach my $field (@fields) {
-
- (my $sub = $tmpl) =~ s/\[\[field\]\]/$field/g;
-
- eval $sub;
-
- croak $@ if($@);
- }
-
-}
-
-
-#########
-sub new {
-#########
- my $class = shift;
- my %args = @_;
- my $self = {};
- bless($self, $class);
-
- foreach my $arg (keys %args) {
- $self->$arg($args{$arg});
- }
-
- return $self;
-}
-
-
-##########################
-sub load_editable_macros {
-##########################
- my $class = shift;
- my @macros;
-
- my $data = RHN::DataSource::Simple->new(
- -querybase => 'probe_queries',
- -mode => 'editable_config_macros',
- )->execute_full();
-
- foreach my $record (@$data) {
- my $macro = $class->new();
- foreach my $field (keys %$record) {
- my $meth = lc($field);
- my $value = defined($record->{$field}) ? $record->{$field} : '';
- $macro->$meth($value);
- }
- push(@macros, $macro);
- }
-
- return \@macros;
-}
-
-############
-sub update {
-############
- my $self = shift;
- my $login = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sql = q{
- UPDATE rhn_config_macro
- SET definition = :definition,
- last_update_user = :luser,
- last_update_date = sysdate
- WHERE name = :name
- AND environment = :environment
- };
-
- my $sth = $dbh->prepare($sql);
- $sth->execute_h(
- definition => $self->definition,
- name => $self->name,
- environment => $self->environment,
- luser => $login,
- );
-
-}
-
-
-1;
-
-
-__END__
-=head1 NAME
-
-RHN::DB::MonitoringConfigMacro - Monitoring commands
-
-=head1 SYNOPSIS
-
- use RHN::DB::MonitoringConfigMacro;
-
- my $macros = RHN::DB::MonitoringConfigMacro->load_editable_macros();
-
- my $macro = $macros->[0];
- $macro->definition($new_definition);
- $macro->update($username);
-
-=head1 DESCRIPTION
-
-RHN::DB::MonitoringConfigMacro provides access to RHN monitoring
-configuration macros (the RHN_CONFIG_MACRO table).
-
-=head1 CLASS METHODS
-
-=over 8
-
-=item new()
-
-Construct a new RHN::DB::MonitoringConfigMacro object.
-
-=item load_editable_macros()
-
-Loads editable macros from the database.
-
-=back
-
-=head1 INSTANCE METHODS
-
-=over 8
-
-=item update($username)
-
-Updates a changed macro in the database. $username will be recorded
-as the last person to edit the macro.
-
-=back
-
-=head1 INSTANCE VARIABLES
-
-=over 8
-
-=item name()
-
-The macro name.
-
-=item definition()
-
-The macro definition. Macros may refer to other macros using
-%{MACRONAME} syntax.
-
-=item description()
-
-The human-readable macro description.
-
-=item environment()
-
-The environment for which the macro is intended.
-
-=item last_update_user()
-
-The last person to update the macro.
-
-=item last_update_date()
-
-The last time the macro was updated.
-
-=back
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
-
-
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 3bfa31d..fd0aae5 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -218,7 +218,6 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/RHN::DB::Command.3pm.gz
%{_mandir}/man3/RHN::DB::ContactGroup.3pm.gz
%{_mandir}/man3/RHN::DB::ContactMethod.3pm.gz
-%{_mandir}/man3/RHN::DB::MonitoringConfigMacro.3pm.gz
%{_mandir}/man3/RHN::DB::Probe.3pm.gz
%{_mandir}/man3/RHN::DB::SatCluster.3pm.gz
%{_mandir}/man3/RHN::DB::SatNode.3pm.gz
commit 01260b5badc70fb85de4bf583e6d5feb6d898a3d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:37:46 2010 +0100
Removal of Sniglets::MonitoringConfig made RHN::MonitoringConfigMacro unused, removing.
diff --git a/web/modules/rhn/RHN/MonitoringConfigMacro.pm b/web/modules/rhn/RHN/MonitoringConfigMacro.pm
deleted file mode 100644
index 110fcf3..0000000
--- a/web/modules/rhn/RHN/MonitoringConfigMacro.pm
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-use strict;
-
-package RHN::MonitoringConfigMacro;
-
-use RHN::DB::MonitoringConfigMacro;
-
-our @ISA = qw/RHN::DB::MonitoringConfigMacro/;
-
-
-
-1;
-
-__END__
-=head1 NAME
-
-RHN::MonitoringConfigMacro - Wrapper class for RHN::DB::MonitoringConfigMacro
-
-=head1 DESCRIPTION
-
-Wrapper class for RHN::DB::MonitoringConfigMacro. This wrapper
-decorates RHN::DB::MonitoringConfigMacro with methods that provide a
-more intuitive API to some of the underlying data.
-
-=head1 SEE ALSO
-
-L<RHN::DB::MonitoringConfigMacro>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index c60a656..3bfa31d 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -177,7 +177,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/Kickstart/
%{perl_vendorlib}/RHN/Mail.pm
%{perl_vendorlib}/RHN/Manifest.pm
-%{perl_vendorlib}/RHN/MonitoringConfigMacro.pm
%{perl_vendorlib}/RHN/Org.pm
%{perl_vendorlib}/RHN/Package.pm
%{perl_vendorlib}/RHN/Package/
@@ -224,7 +223,6 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/RHN::DB::SatCluster.3pm.gz
%{_mandir}/man3/RHN::DB::SatNode.3pm.gz
%{_mandir}/man3/RHN::DB::ServerGroup.3pm.gz
-%{_mandir}/man3/RHN::MonitoringConfigMacro.3pm.gz
%{_mandir}/man3/RHN::Probe.3pm.gz
%{_mandir}/man3/RHN::SCDB.3pm.gz
%{_mandir}/man3/RHN::SatCluster.3pm.gz
commit de1a7c080df2c6c3bc7e655676931f3a588b7fcc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:35:07 2010 +0100
are_notifications_squelched, squelch_notifications, and unsquelch_notifications not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm b/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm
index 840e38b..4987671 100644
--- a/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm
+++ b/web/modules/rhn/RHN/DB/MonitoringConfigMacro.pm
@@ -54,113 +54,6 @@ our $VERSION = (split(/s+/, q$Id$, 4))[2];
}
-# this is a horrid place for this function, but I don't think
-# there is a better spot for right now... :/
-sub are_notifications_squelched {
- my $class = shift;
-
- my $sql = q{
-SELECT recid
- FROM redirects
- WHERE redirect_type = 'BLACKHOLE'
- AND description = 'Global Squelch'
- AND reason = 'Someone turned off all notifications via the website'
- };
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare($sql);
- $sth->execute;
-
- my ($am_squelched) = $sth->fetchrow;
- $sth->finish;
-
- return $am_squelched;
-}
-
-# this is a pretty sucky "off" switch. :(
-sub squelch_notifications {
- my $class = shift;
- my $user = shift;
-
- my $dbh = RHN::DB->connect;
-
-my $sql = <<EOP;
-DECLARE
-
-redirect_id number;
-
-cursor contacts is
-SELECT recid
- FROM rhn_contact_monitoring;
-
-BEGIN
-for contact in contacts loop
- select rhn_redirects_recid_seq.nextval into redirect_id from dual;
-
- insert into redirects (
- recid,
- customer_id,
- contact_id,
- redirect_type,
- description,
- reason,
- start_date,
- expiration,
- last_update_user,
- last_update_date
- ) values (
- redirect_id,
- :org_id,
- contact.recid,
- 'BLACKHOLE',
- 'Global Squelch',
- 'Someone turned off all notifications via the website',
- sysdate,
- sysdate + (365 * 10),
- :user_login,
- sysdate
- );
-
- insert into redirect_criteria (
- recid,
- redirect_id,
- match_param,
- match_value
- )
- values (
- redirect_criteria_recid_seq.nextval,
- redirect_id,
- 'CUSTOMER_ID',
- :org_id
- );
-end loop;
-END;
-EOP
-
- my $sth = $dbh->prepare($sql);
- $sth->execute_h(org_id => $user->org_id,
- user_login => $user->login,
- );
- $dbh->commit;
-}
-
-sub unsquelch_notifications {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sql = q{
-DELETE FROM redirects
- WHERE redirect_type = 'BLACKHOLE'
- AND description = 'Global Squelch'
- AND reason = 'Someone turned off all notifications via the website'
- };
-
- my $sth = $dbh->prepare($sql);
- $sth->execute;
- $dbh->commit;
-}
-
#########
sub new {
#########
commit 94b7085620f2d1a4b9956acfb6a4456638cfb5b0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:34:08 2010 +0100
channel_edit_list not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index d84a281..5ea0bff 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -63,33 +63,6 @@ EOS
}
-sub channel_edit_list {
- my $class = shift;
- my $org_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT AC.channel_name, AC.channel_id, AC.channel_depth, AC.channel_arch_id
- FROM rhnAvailableChannels AC
- WHERE AC.org_id = ?
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @channels;
-
- while (my @row = $sth->fetchrow) {
- push @channels, [ @row ];
- }
-
- return @channels;
-}
-
sub channel_base_arch_map {
my $self = shift;
commit 231a3511a177f47310bce9b2fffc0a136569b4b1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:33:03 2010 +0100
list_scouts_by_org not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/SatCluster.pm b/web/modules/rhn/RHN/DB/SatCluster.pm
index d5f1975..9822dbf 100644
--- a/web/modules/rhn/RHN/DB/SatCluster.pm
+++ b/web/modules/rhn/RHN/DB/SatCluster.pm
@@ -310,19 +310,6 @@ sub lookup {
}
-########################
-sub list_scouts_by_org {
-########################
- my $self = shift;
- my $org_id = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => 'scout_queries',
- -mode => 'scouts_for_org');
-
- return $ds->execute_query(-org_id => $org_id);
-
-}
-
#################
sub push_config {
#################
commit 4e53215e5cea8e648ac88c59ff8a757055bb3db6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:31:25 2010 +0100
lookup_consume not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/TinyURL.pm b/web/modules/rhn/RHN/DB/TinyURL.pm
index 9beb625..c3f141a 100644
--- a/web/modules/rhn/RHN/DB/TinyURL.pm
+++ b/web/modules/rhn/RHN/DB/TinyURL.pm
@@ -46,22 +46,6 @@ EOS
return $result;
}
-sub lookup_consume {
- my $class = shift;
- my %params = validate(@_, {token => 1});
- my $token = $params{token};
-
- my $ret = $class->lookup(-token => $token);
- if ($ret) {
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("UPDATE rhnTinyURL SET enabled = 'N' WHERE token = :token");
- $sth->execute_h(token => $token);
- $dbh->commit;
- }
-
- return $ret;
-}
-
sub create {
my $class = shift;
my $url = shift;
commit 9995ad33a5a2c79e6d1f71fbd375e23a6d9e364b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:30:54 2010 +0100
delete_probe and scout_for_probe not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Probe.pm b/web/modules/rhn/RHN/DB/Probe.pm
index 1609666..2008a8c 100644
--- a/web/modules/rhn/RHN/DB/Probe.pm
+++ b/web/modules/rhn/RHN/DB/Probe.pm
@@ -295,50 +295,6 @@ sub list_scouts {
return $ds->execute_query(-customer_id => $customer_id);
}
-##################
-sub delete_probe {
-##################
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my ($sth, $query);
- my $probe_id = $class->{__recid__};
-
- $query = <<EOQ;
-DELETE FROM rhn_probe
- WHERE recid = :probe_id
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(probe_id => $probe_id);
- $dbh->commit;
-}
-
-
-#####################
-sub scout_for_probe {
-#####################
- my $class = shift;
- my $probe_id = shift;
-
- my $dbh = RHN::DB->connect;
- my ($sth, $query);
-
- $query = <<EOF;
-SELECT SC.description
- FROM sat_cluster SC, check_probe CP
- WHERE CP.probe_id = :probe_id
- AND CP.sat_cluster_id = SC.recid
-EOF
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(probe_id => $probe_id);
- my $scout_description = $sth->fetchrow;
-
- return $scout_description;
-}
-
-
1;
@@ -376,16 +332,6 @@ Look up probe by probe ID
-=item scout_for_probe(probe_id)
-
-Use this method to find the description of the monitoring scout on
-which probe_id is configured to run.
-
-EXAMPLE:
-
-my $scout_description = $probe->scout_for_probe($probe_id);
-$form->add_widget( new RHN::Form::Widget::Literal(name => 'Monitoring Scout', value => $scout_description) );
-
=back
=head1 SEE ALSO
commit ae9c107fd50aa10b101453e75dd6cfdc77861e26
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:29:23 2010 +0100
get_category_id and create_template_string not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/TemplateString.pm b/web/modules/rhn/RHN/DB/TemplateString.pm
index f897117..8a1b892 100644
--- a/web/modules/rhn/RHN/DB/TemplateString.pm
+++ b/web/modules/rhn/RHN/DB/TemplateString.pm
@@ -89,31 +89,6 @@ sub lookup {
return $ret;
}
-sub get_category_id {
- my $class = shift;
- my $label = shift;
- die "no label!" unless ($label);
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare("SELECT id FROM rhnTemplateCategory WHERE label = :label");
- $sth->execute_h(label => $label);
-
- my ($value) = $sth->fetchrow;
- $sth->finish;
-
- return $value;
-}
-
-sub create_template_string {
- my $class = shift;
-
- my $template = $class->_blank_templatestring();
- $template->{__id__} = -1;
-
- return $template;
-}
-
sub _blank_templatestring {
my $class = shift;
14 years, 3 months
2 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/User.pm | 33 ---------------------------------
1 file changed, 33 deletions(-)
New commits:
commit 21c625d8a28ee5bb5218ee66f9cb43d63a916b02
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:24:38 2010 +0100
Removal of approve and banish made remove_from_group unused.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 2b04f51..501f883 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -1722,28 +1722,6 @@ EOQ
}
-sub remove_from_group {
- my $self = shift;
- my $label = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT UG.id
- FROM rhnUserGroupType UGT,
- rhnUserGroup UG
- WHERE UG.org_id = ?
- AND UG.group_type = UGT.id
- AND UGT.label = ?
-EOQ
-
- $sth->execute($self->org_id, $label);
- my ($ugid) = $sth->fetchrow;
- $sth->finish;
-
- $dbh->call_procedure("rhn_user.delete_from_usergroup", $self->id, $ugid);
- $dbh->commit;
-}
-
sub has_incomplete_info {
my $self = shift;
commit 86195f264d1d55ea651c66ce89659699e3f36f8b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:23:33 2010 +0100
approve not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index d45c4b9..2b04f51 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -1759,17 +1759,6 @@ sub has_incomplete_info {
return 0;
}
-sub approve {
- my $self = shift;
-
- $self->set_password(PXT::Utils->random_password(10));
- $self->remove_from_group('org_applicant');
-
- $self->commit;
-
- return $self->password;
-}
-
sub grant_servergroup_permission {
my $self = shift;
my $uid;
14 years, 3 months
4 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/Org.pm | 499 -----------------------------------------
web/modules/rhn/RHN/DB/User.pm | 121 ---------
2 files changed, 620 deletions(-)
New commits:
commit 83d401ad4eb1a8f92ea2ec129eefc45253e26e36
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:19:16 2010 +0100
Removal of create_new_user and banish made create_new_org unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index 756e49f..7f017ae 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -306,42 +306,6 @@ EOQ
return @result;
}
-sub create_new_org {
- my $class = shift;
- my %params = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-BEGIN
- CREATE_NEW_ORG(name_in => :org_name, password_in => :org_password,
- oracle_customer_number_in => :oracle_customer_number,
- oracle_customer_id_in => :oracle_customer_id,
- customer_type_in => :customer_type,
- org_id_out => :org_id, org_admin_group_out => :org_admin_group,
- org_app_group_out => :org_app_group,
- creation_location => 'rhn');
-END;
-EOQ
-
- $sth->bind_param(":org_name" => $params{"-org_name"});
- $sth->bind_param(":org_password" => $params{"-org_password"});
-
- $sth->bind_param(":${_}" => $params{"-$_"})
- foreach qw/oracle_customer_number oracle_customer_id customer_type/;
-
- my ($org_id, $org_admin_group, $org_app_group);
- $sth->bind_param_inout(':org_id' => \$org_id, 4096);
- $sth->bind_param_inout(':org_admin_group' => \$org_admin_group, 4096);
- $sth->bind_param_inout(':org_app_group' => \$org_app_group, 4096);
- $sth->execute;
-
- if ($params{-commit}) {
- $dbh->commit;
- }
-
- return ($org_id, $org_admin_group, $org_app_group);
-}
-
sub entitlement_counts {
my $self = shift;
my $entitlement = shift;
commit e75e940b96150699ab32dfc36a1bcafb0ba1d604
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:18:19 2010 +0100
banish not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index db148f3..d45c4b9 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -1759,23 +1759,6 @@ sub has_incomplete_info {
return 0;
}
-sub banish {
- my $self = shift;
-
- my ($org_id) = RHN::Org->create_new_org(-org_name => "Rejection Org for " . $self->login,
- -org_password => PXT::Utils->random_password(16),
- -customer_type => 'P');
-
- $self->remove_from_group('org_applicant');
-
- $self->org_id($org_id);
- delete $self->{__orgobj__};
- $self->set_password(PXT::Utils->random_password(16));
- $self->login(substr($self->id . '-' . $self->login, 0, 63));
-
- $self->commit;
-}
-
sub approve {
my $self = shift;
commit 696baaf25196850b6a3291ee70b415667577689b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:16:56 2010 +0100
create_new_user not used in Perl stack, removing.
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index bf76172..db148f3 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -322,110 +322,6 @@ sub _blank_user {
return $self;
}
-sub create_new_user {
- my $class = shift;
- my %params = @_;
-
- my $dbh = RHN::DB->connect;
- my $commit_org = 0;
-
- # type 'S' (a placeholder for the first satellite user)
- if (exists $params{-customer_type} and $params{-customer_type} eq 'S') {
-
- # check to be sure we really are running in satellite mode
- die "Attempt to create satellite user when not running a satellite" unless
- PXT::Config->get('satellite');
-
- # check to be sure the one and only org for this satellite was created
- my $sth = $dbh->prepare('SELECT id FROM web_customer');
- $sth->execute;
- my ($org_id) = $sth->fetchrow;
- if (not defined $org_id) {
- die "Attempt to create satellite user when no orgs exist";
- }
-
- if ($sth->fetchrow) {
- die "Attempt to create satellite user when more than one org exists";
- }
-
- $sth->finish;
-
- # check to be sure there are no other users on this satellite
- $sth = $dbh->prepare('SELECT id FROM web_contact');
- $sth->execute;
- my ($existing_user) = $sth->fetchrow;
- $sth->finish;
-
- if ($existing_user) {
- die "Attempt to create satellite user when a user already exists";
- }
-
- $params{-customer_type} = 'P';
- $params{-org_id} = $org_id;
- }
-
- if (not $params{-org_id} or $params{-org_id} < 1) {
- @params{'-org_id', '-org_admin_group', '-org_app_group'} =
- RHN::Org->create_new_org(-org_name => $params{-org_name} || "$params{-first_names} $params{-last_name}",
- -org_password => $params{-org_password} || PXT::Utils->random_password(16),
- -oracle_customer_number => $params{-oracle_customer_number},
- -oracle_customer_id => $params{-oracle_customer_id},
- -customer_type => $params{-customer_type} || 'P',
- -commit => 0);
- $commit_org = 1;
- }
-
-
- if (PXT::Config->get('encrypted_passwords')) {
- my $salt = '$1$' . PXT::Utils->generate_salt(8);
-
- $params{-password} = crypt($params{-password}, $salt);
- }
-
- my $sth = $dbh->prepare(<<EOQ);
-BEGIN
- :user_id := CREATE_NEW_USER(org_id_in => :org_id, login_in => :login, password_in => :password,
- oracle_contact_id_in => :oracle_contact_id, prefix_in => :prefix,
- first_names_in => :first_names, last_name_in => :last_name, genqual_in => :genqual,
- parent_company_in => :parent_company, company_in => :company, title_in => :title,
- phone_in => :phone, fax_in => :fax, email_in => :email, pin_in => :pin,
- first_names_ol_in => :first_names_ol, last_name_ol_in => :last_name_ol,
- address1_in => :address1, address2_in => :address2, address3_in => :address3,
- city_in => :city, state_in => :state, zip_in => :zip, country_in => :country,
- alt_first_names_in => :alt_first_names, alt_last_name_in => :alt_last_name,
- contact_call_in => :contact_call,
- contact_mail_in => :contact_mail,
- contact_email_in => :contact_email,
- contact_fax_in => :contact_fax);
-END;
-EOQ
-
-# warn "Param dump for new user: " . Data::Dumper->Dump([\%params]);
- foreach (qw/org_id login password oracle_contact_id prefix/,
- qw/first_names last_name genqual parent_company company title phone/,
- qw/fax email pin first_names_ol last_name_ol contact_call/,
- qw/contact_mail contact_email contact_fax address1 address2 address3/,
- qw/city state zip country alt_first_names alt_last_name/) {
- $sth->bind_param(":${_}" => $params{"-$_"});
- }
-
- my $user_id;
- $sth->bind_param_inout(':user_id' => \$user_id, 4096);
- $sth->execute;
-
- my $ret = RHN::User->lookup(-id => $user_id);
- $dbh->commit;
-
- if ($commit_org) {
- my $org = RHN::Org->lookup(-id => $params{-org_id});
- $org->oai_customer_sync();
- }
-
- $ret->oai_contact_sync();
-
- return $ret;
-}
-
sub create {
my $class = shift;
commit 9ca64d80bd5bc57e53f573c51bd3257d983ce347
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:15:05 2010 +0100
Removing bunch of unused methods from RHN::DB::Org:
satellite_org
create_org
random_org_admin
servers_in_org
usergroups_in_org
servergroups_in_org
user_count
user_group_id
user_applicant_group
user_applet_overview
owns_servers
support_user_overview
orders_for_org
products_for_org
pending_users
find_responsible_user
entitlement_history
rename_customer
monitoring_slot_name
quota_data
available_cert_channels
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index a776387..756e49f 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -38,28 +38,6 @@ my @skip_cert_channels = qw/%%-beta%% %%-staging%% rhn-satellite%%/;
my $o = new RHN::DB::TableClass("web_customer", "O", "", @org_fields);
-# loads the org for a satellite, dies if called in non-satellite context
-sub satellite_org {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- $sth = $dbh->prepare("SELECT is_satellite() FROM DUAL");
- $sth->execute();
- my ($is_satellite)= $sth->fetchrow;
- $sth->finish;
-
- die 'not a satellite!' unless $is_satellite;
-
- $sth = $dbh->prepare("SELECT id FROM web_customer");
- $sth->execute;
- my ($org_id) = $sth->fetchrow;
- $sth->finish;
-
- return $class->lookup(-id => $org_id);
-}
-
sub lookup {
my $class = shift;
my %params = validate(@_, { id => 0, customer_number => 0, customer_name => 0 });
@@ -160,15 +138,6 @@ sub blank_org {
return $self;
}
-sub create_org {
- my $class = shift;
-
- my $org = $class->blank_org;
- $org->{__id__} = -1;
-
- return $org;
-}
-
# build some accessors
foreach my $field ($o->method_names) {
my $sub = q {
@@ -237,36 +206,6 @@ sub commit {
delete $self->{":modified:"};
}
-sub random_org_admin {
- my $self_or_class = shift;
- my $oid;
-
- if (ref $self_or_class) {
- $oid = $self_or_class->id;
- }
- else {
- $oid = shift;
- }
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOSQL;
-SELECT UGM.user_id
- FROM rhnUserGroupMembers UGM,
- rhnUserGroup UG
- WHERE UG.id = UGM.user_group_id
- AND UG.org_id = ?
- AND UG.group_type = (SELECT id FROM rhnUserGroupType WHERE label = 'org_admin')
-EOSQL
-
- my $sth = $dbh->prepare($query);
- $sth->execute($oid);
-
- my ($id) = $sth->fetchrow;
- $sth->finish;
-
- return $id;
-}
-
sub users_in_org {
my $class = shift;
my $org_id = shift;
@@ -291,102 +230,6 @@ EOSQL
return @ret;
}
-# calling convention:
-# RHN::DB::Org->servers_in_org(org_id, [upper, lower], columns to display)
-# TODO: make servergroups_in_org, users_in_org, usergroups_in_org act like servers_in_org
-
-sub servers_in_org {
- my $class = shift;
- my $org_id = shift;
- my $bounds = shift;
- my @columns = @_;
-
- if (not ref $bounds or ref $bounds ne 'ARRAY') {
- unshift @columns, $bounds;
- $bounds = [ 1, 1_000_000 ];
- }
-
- @columns = ('S.ID') unless @columns;
-
- my $dbh = RHN::DB->connect;
- my $query = sprintf <<EOSQL, join(", ", map { "S.$_" } @columns);
-SELECT %s
-FROM rhnServer S
-WHERE S.org_id = ?
-ORDER BY UPPER(S.name), S.id
-EOSQL
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @ret;
-
- my $i = 1;
- while (my @row = $sth->fetchrow) {
- if ($i >= $bounds->[0] and $i <= $bounds->[1]) {
- push @ret, [ @row ];
- } else {
- last;
- }
- $i++;
- }
- $sth->finish;
-
- return @ret;
-}
-
-sub usergroups_in_org {
- my $class = shift;
- my $org_id = shift;
- my @columns = @_;
-
- my $dbh = RHN::DB->connect;
- my $query = sprintf <<EOSQL, join(", ", map { "UG.$_" } @columns);
-SELECT %s
-FROM rhnUserGroup UG
-WHERE UG.org_id = ?
-EOSQL
-
-# warn "q: $query";
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @ret;
-
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub servergroups_in_org {
- my $class = shift;
- my $org_id = shift;
- my @columns = @_ ? @_ : ("ID");
-
- my $dbh = RHN::DB->connect;
- my $query = sprintf <<EOSQL, join(", ", map { "SG.$_" } @columns);
-SELECT %s
-FROM rhnServerGroup SG
-WHERE SG.org_id = ?
- AND SG.group_type is NULL
-EOSQL
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @ret;
-
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-
sub users_in_org_overview {
my $class = shift;
my %params = @_;
@@ -463,45 +306,6 @@ EOQ
return @result;
}
-sub user_count {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT COUNT(id) FROM web_contact WHERE org_id = ?');
- $sth->execute($self->id);
- my ($count) = $sth->fetchrow;
- $sth->finish;
-
- return $count;
-}
-
-sub user_group_id {
- my $self = shift;
- my $label = shift;
-
- die "No label" unless $label;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT UG.id FROM rhnUserGroupType UGT, rhnUserGroup UG WHERE UG.org_id = ? AND UG.group_type = UGT.id AND UGT.label = ?');
- $sth->execute($self->id, $label);
- my ($id) = $sth->fetchrow;
- $sth->finish;
-
- return $id;
-}
-
-sub user_applicant_group {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT UG.id FROM rhnUserGroupType UGT, rhnUserGroup UG WHERE UG.org_id = ? AND UG.group_type = UGT.id AND UGT.label = ?');
- $sth->execute($self->id, 'org_applicant');
- my ($id) = $sth->fetchrow;
- $sth->finish;
-
- return $id;
-}
-
sub create_new_org {
my $class = shift;
my %params = @_;
@@ -538,30 +342,6 @@ EOQ
return ($org_id, $org_admin_group, $org_app_group);
}
-sub user_applet_overview {
- my $class = shift;
- my $user_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare("SELECT COUNT(server_id) FROM rhnUserServerPerms WHERE user_id = ?");
- $sth->execute($user_id);
- my ($count) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOSQL);
-SELECT security_count, bug_count, enhancement_count
- FROM rhnUserAppletOverview
- WHERE user_id = ?
-EOSQL
- $sth->execute($user_id);
-
- my ($sec, $bug, $enh) = $sth->fetchrow;
- $sth->finish;
-
- return ($count, $sec, $bug, $enh);
-}
-
sub entitlement_counts {
my $self = shift;
my $entitlement = shift;
@@ -642,25 +422,6 @@ EOS
return $tot;
}
-sub owns_servers {
- my $self = shift;
- my @server_ids = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("SELECT org_id FROM rhnServer WHERE id = ?");
-
- foreach my $server (@server_ids) {
- $sth->execute($server);
- my ($org_id) = $sth->fetchrow;
- $sth->finish;
-
- return 0 if not defined $org_id;
- return 0 if $org_id != $self->id;
- }
-
- return 1;
-}
-
sub owns_server_groups {
my $self = shift;
my @sg_ids = @_;
@@ -738,107 +499,6 @@ EOQ
return 0;
}
-sub support_user_overview {
- my $class = shift;
- my %params = @_;
-
- my $org_id;
-
- if (exists $params{-org_id}) {
- $org_id = $params{-org_id};
- }
- elsif (exists $params{-custnum}) {
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT id FROM web_customer WHERE oracle_customer_number = ?');
-
- $sth->execute($params{-custnum});
- ($org_id) = $sth->fetchrow;
- $sth->finish;
- }
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT id, login FROM web_contact WHERE org_id = ?');
-
- $sth->execute($org_id);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub orders_for_org {
- my $class = shift;
- my $oid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT CUSTOMER_NUMBER, WEB_ORDER_NUMBER, LINE_ID, PRODUCT_ITEM_CODE, PRODUCT_NAME, QUANTITY
- FROM user_orders
- WHERE customer_number = (SELECT oracle_customer_id FROM web_customer cu WHERE cu.id = ?)
-EOS
-
- $sth->execute($oid);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub products_for_org {
- my $class = shift;
- my $oid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT REGISTRATION_USER_ID, REG_NUMBER, SERVICE_TAG, PRODUCT_DESCRIPTION, PRODUCT_ITEM_CODE,
- PRODUCT_START_DATE, PRODUCT_END_DATE, PRODUCT_ACTIVE_FLAG, PRODUCT_QUANTITY,
- SERVICE_DESCRIPTION, SERVICE_ITEM_CODE, SERVICE_START_DATE, SERVICE_END_DATE,
- SERVICE_ACTIVE_FLAG
- FROM user_products
- WHERE org_id = ?
-EOS
-
- $sth->execute($oid);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub pending_users {
- my $class = shift;
- my $org_id = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT wc.id, wc.login, wupi.first_names, wupi.last_name, wupi.title, wupi.email
- FROM web_user_personal_info wupi,
- web_contact wc,
- rhnUserGroupMembers UGM
- WHERE UGM.user_group_id = (SELECT id
- FROM rhnUserGroup
- WHERE org_id = ?
- AND group_type = (SELECT id FROM rhnUserGroupType WHERE label = 'org_applicant'))
- AND UGM.user_id = wc.id
- AND wupi.web_user_id = wc.id
-EOS
-
- $sth->execute($org_id);
-
- my @ret = $sth->fullfetch;
-
- return @ret;
-}
-
sub org_admins {
my $self = shift;
@@ -864,20 +524,6 @@ EOS
return @ret;
}
-# find a user who is responsible (org admin; current policy is org
-# admin with lowest id)
-sub find_responsible_user {
- my $self = shift;
-
- my @ret = $self->org_admins;
- if (@ret) {
- return RHN::User->lookup(-id => $ret[0]);
- }
- else {
- return undef;
- }
-}
-
sub entitled_satellite_families {
my $self = shift;
@@ -909,50 +555,6 @@ EOS
return $ret;
}
-sub entitlement_history {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT wce.customer_id,
- wce.active_flag,
- TO_CHAR(wce.start_date_active, 'YYYY-MM-DD'),
- TO_CHAR(wce.end_date_active, 'YYYY-MM-DD'),
- wce.product_name,
- wce.service_name,
- wce.product_item_code,
- wce.service_item_code,
- wce.group_label,
- wce.quantity,
- wce.customer_product_id,
- wce.paid
- FROM web_customer_entitlements wce
- WHERE wce.customer_id = ?
-EOS
-
- $sth->execute($self->id);
-
- my @ret = $sth->fullfetch;
-
- return @ret;
-}
-
-sub rename_customer {
- my $self = shift;
- my $name = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("UPDATE web_customer SET name = ? WHERE id = ?");
- $sth->execute($name, $self->id);
-
- $sth = $dbh->prepare("UPDATE web_user_personal_info SET company = ? WHERE web_user_id IN (SELECT id FROM web_contact WHERE org_id = ?)");
- $sth->execute($name, $self->id);
-
- $self->name($name);
-
- $self->oai_customer_sync();
-}
-
sub oai_customer_sync {
my $self = shift;
@@ -1106,12 +708,6 @@ sub provisioning_slot_name {
return $self->slot_name('provisioning_entitled');
}
-sub monitoring_slot_name {
- my $self = shift;
-
- return $self->slot_name('monitoring_entitled');
-}
-
sub nonlinux_slot_name {
my $self = shift;
@@ -1306,29 +902,6 @@ sub channel_entitlements {
return $channels;
}
-sub quota_data {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT OQ.total, OQ.bonus, OQ.used
- FROM rhnOrgQuota OQ
- WHERE OQ.org_id = :org_id
-EOQ
-
- $sth->execute_h(org_id => $self->id);
- my $data = $sth->fetchrow_hashref;
-
- $sth->finish;
-
- return unless (ref $data eq 'HASH');
-
- $data->{LIMIT} = $data->{TOTAL} + $data->{BONUS};
- $data->{AVAILABLE} = $data->{LIMIT} - $data->{USED};
-
- return $data;
-}
-
sub validate_cert {
my $self = shift;
@@ -1359,42 +932,6 @@ EOQ
}
-sub available_cert_channels {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $stmt = <<EOQ;
-SELECT
- cf.id id,
- cf.name name,
- cf.label label
-FROM rhnChannelFamily cf
-WHERE 1=1
- and cf.org_id is null
-EOQ
-
- foreach my $skip_clause (@skip_cert_channels) {
- $stmt .= " and cf.label not like '$skip_clause'";
- }
- $stmt .= " order by cf.label";
-
- my $sth = $dbh->prepare($stmt);
-
- $sth->execute_h();
-
- my @result;
-
- while ( my (@data) = $sth->fetchrow ) {
- push ( @result, \@data );
- }
-
- $sth->finish;
-
- return @result;
-
-}
-
-
# Get options defined for this Org's list of monitoring Scouts
sub get_scout_options {
my $self = shift;
14 years, 3 months
3 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/Action.pm | 30 --
web/modules/rhn/RHN/DB/KSTree.pm | 72 -------
web/modules/rhn/RHN/DB/User.pm | 398 ---------------------------------------
3 files changed, 500 deletions(-)
New commits:
commit 24b10d40889a0bd1fdd8b8f4c358f3ac404f72c6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:04:41 2010 +0100
associated_errata and create_action not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Action.pm b/web/modules/rhn/RHN/DB/Action.pm
index d7498b7..0dc0e0b 100644
--- a/web/modules/rhn/RHN/DB/Action.pm
+++ b/web/modules/rhn/RHN/DB/Action.pm
@@ -161,29 +161,6 @@ sub get_full_server_status {
}
-sub associated_errata {
- my $self = shift;
- die "action $self->id is not an errata.update action" unless $self->action_type_label eq 'errata.update';
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT errata_id FROM rhnActionErrataUpdate WHERE action_id = ?
-EOQ
- $sth = $dbh->prepare($query);
- $sth->execute($self->id);
-
- my @ret;
- while (my @data = $sth->fetchrow) {
- push @ret, @data;
- }
-
- return @ret;
-}
-
sub cancel_pending_for_system {
my $class = shift;
@@ -365,13 +342,6 @@ sub blank_action {
bless { }, shift;
}
-sub create_action {
- my $class = shift;
- my $action = $class->blank_action;
- $action->{__id__} = -1;
- return $action;
-}
-
sub commit {
my $self = shift;
commit 3ec3d752a96bd9cd7ed47d7f92f9a6503dae118f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:01:44 2010 +0100
Removing bunch of unused methods from RHN::DB::KSTree:
best_kstree_for_server
compatible_tree
is_rhn_tree
is_selinux_capable
diff --git a/web/modules/rhn/RHN/DB/KSTree.pm b/web/modules/rhn/RHN/DB/KSTree.pm
index 380092d..454218e 100644
--- a/web/modules/rhn/RHN/DB/KSTree.pm
+++ b/web/modules/rhn/RHN/DB/KSTree.pm
@@ -207,34 +207,6 @@ EOQ
$dbh->commit;
}
-sub best_kstree_for_server {
- my $class = shift;
- my $user = shift;
- my $server = shift;
-
- my $base_channel = RHN::Server->base_channel_id($server->id);
- my $base_channel_cloned_from = RHN::Channel->channel_cloned_from($base_channel) || 0;
-
- my $ds = new RHN::DataSource::General(-mode => 'kstrees_for_user');
- my $forest = $ds->execute_query(-user_id => $user->id);
-
- my $id;
- for my $tree (@$forest) {
- if ($tree->{CHANNEL_ID} == $base_channel or
- $tree->{CHANNEL_ID} == $base_channel_cloned_from) {
- $id = $tree->{ID};
- last;
- }
- }
-
- if ($id) {
- return $class->lookup(-id => $id);
- }
- else {
- return;
- }
-}
-
sub kstrees_for_user {
my $class = shift;
my $uid = shift;
@@ -251,49 +223,5 @@ sub name {
return sprintf('%s (%s)', $channel->name, $self->label);
}
-sub compatible_tree {
- my $self = shift;
- my $kstid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT 1
- FROM rhnKickstartableTree KST1, rhnKickstartableTree KST2,
- rhnChannel C1, rhnChannel C2
- WHERE KST1.id = :kstid1
- AND KST2.id = :kstid2
- AND C1.id = KST1.channel_id
- AND C2.id = KST2.channel_id
- AND KST1.install_type = KST2.install_type
- AND C1.channel_arch_id = C2.channel_arch_id
-EOQ
-
- $sth->execute_h(kstid1 => $self->id, kstid2 => $kstid);
- my ($truth) = $sth->fetchrow;
- $sth->finish;
-
- return $truth;
-}
-
-# If org_id is NULL, then the KSTree is an RHN kstree, hosted on the
-# satellite. Otherwise it is user-hosted.
-sub is_rhn_tree {
- my $self = shift;
-
- return ($self->org_id ? 0 : 1);
-}
-
-# If we add more is_{foo}_capable functions, we should probably move the
-# data to the database.
-sub is_selinux_capable {
- my $self = shift;
-
- if ($self->install_type_label eq 'rhel_4') {
- return 1;
- }
-
- return 0;
-}
-
1;
commit 4fa41e4d5bc382617f27c2180f1d3afca6e3c0f7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 16:59:34 2010 +0100
Removing bunch of unused methods from RHN::DB::User:
create_custom_data_key
role_labels
users_like_email
full_opt_out
action_list_overview
verify_transaction_access
get_server_pref
system_summary
orders_for_user
products_for_user
uids_by_login_prefix
email_addresses
delete_nonverified_addresses
can_modify_user
diff --git a/web/modules/rhn/RHN/DB/User.pm b/web/modules/rhn/RHN/DB/User.pm
index 5dac40f..bf76172 100644
--- a/web/modules/rhn/RHN/DB/User.pm
+++ b/web/modules/rhn/RHN/DB/User.pm
@@ -264,25 +264,6 @@ sub delete_user {
}
-sub create_custom_data_key {
- my $self = shift;
- my %params = validate(@_, {label => 1, description => 1});
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnCustomDataKey (id, org_id, label, description, created_by, last_modified_by)
-VALUES (rhn_cdatakey_id_seq.nextval, :org_id, :label, :description, :user_id, :user_id)
-EOQ
- $sth->execute_h(user_id => $self->id,
- org_id => $self->org_id,
- label => $params{label},
- description => $params{description},
- );
-
- $dbh->commit;
-}
-
-
sub roles {
my $self = shift;
@@ -333,16 +314,6 @@ sub is {
}
}
-sub role_labels {
- my $self = shift;
-
- if (not keys %role_cache) {
- $self->rebuild_role_cache;
- }
-
- return map { $role_cache{$_} } $self->roles;
-}
-
sub _blank_user {
my $class = shift;
@@ -524,31 +495,6 @@ sub users_by_email {
return $sth->fullfetch;
}
-# NOTE: do not use this unless you know you have cleansed any Oracle
-# regexps from the input pattern
-sub users_like_email {
- my $class = shift;
- my $pattern = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT web_user_id FROM web_user_personal_info WHERE email LIKE ?');
- $sth->execute($pattern);
-
- return $sth->fullfetch;
-}
-
-sub full_opt_out {
- my $self = shift;
-
- $self->contact_email('N');
- $self->contact_mail('N');
- $self->contact_call('N');
- $self->contact_fax('N');
- $self->set_pref('email_notify', '0');
-
- $self->commit;
-}
-
sub set_password {
my $self = shift;
my $new_pw = shift;
@@ -717,95 +663,6 @@ sub convert_time {
return $rv;
}
-my %server_action_names = (
- 'Package List Refresh' => 'package_list_refresh',
- 'Hardware List Refresh' => 'hardware_list_refresh',
- 'Package Install' => 'package_install',
- 'Package Removal' => 'package_removal',
- 'Errata Update' => 'errata_update',
- 'Profile Match' => 'profile_match'
- );
-
-sub action_list_overview {
- my $self = shift;
- my %params = @_;
-
- my ($lower, $upper, $total_ref, $mode, $all_ids) =
- map { $params{"-" . $_} } qw/lower upper total_rows mode all_ids/;
-
- $lower ||= 1;
- $upper ||= 100000;
-
-
- my $dbh = RHN::DB->connect;
-
- my $query;
-
- if ($mode eq 'pending_actions') {
- $query = <<EOQ;
-SELECT AO.type_name, TO_CHAR(AO.earliest_action, 'YYYY-MM-DD HH24:MI:SS') EARLIEST, AO.total_count, AO.successful_count, AO.failed_count, AO.in_progress_count, AO.action_id, DECODE(AO.name, NULL, AO.type_name, AO.name)
- FROM rhnActionOverview AO
- WHERE AO.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnServerAction SA WHERE SA.action_id = AO.action_id AND status IN (0, 1))
- AND AO.archived = 0
-ORDER BY EARLIEST DESC
-EOQ
- }
- elsif ($mode eq 'completed_actions') {
- $query = <<EOQ;
-SELECT AO.type_name, TO_CHAR(AO.earliest_action, 'YYYY-MM-DD HH24:MI:SS') EARLIEST, AO.total_count, AO.successful_count, AO.failed_count, AO.in_progress_count, AO.action_id, DECODE(AO.name, NULL, AO.type_name, AO.name)
- FROM rhnActionOverview AO
- WHERE AO.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnServerAction SA WHERE SA.action_id = AO.action_id AND status = 2)
- AND AO.archived = 0
-ORDER BY EARLIEST DESC
-EOQ
- }
- elsif ($mode eq 'failed_actions') {
- $query = <<EOQ;
-SELECT AO.type_name, TO_CHAR(AO.earliest_action, 'YYYY-MM-DD HH24:MI:SS') EARLIEST, AO.total_count, AO.successful_count, AO.failed_count, AO.in_progress_count, AO.action_id, DECODE(AO.name, NULL, AO.type_name, AO.name)
- FROM rhnActionOverview AO
- WHERE AO.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnServerAction SA WHERE SA.action_id = AO.action_id AND status = 3)
- AND AO.archived = 0
-ORDER BY EARLIEST DESC
-EOQ
- }
- elsif ($mode eq 'archived_actions') {
- $query = <<EOQ;
-SELECT AO.type_name, TO_CHAR(AO.earliest_action, 'YYYY-MM-DD HH24:MI:SS') EARLIEST, AO.total_count, AO.successful_count, AO.failed_count, AO.in_progress_count, AO.action_id, DECODE(AO.name, NULL, AO.type_name, AO.name)
- FROM rhnActionOverview AO
- WHERE AO.org_id = ?
- AND AO.archived = 1
-ORDER BY EARLIEST DESC
-EOQ
- }
- else {
- croak 'no supported mode! mode == '.$mode;
- }
-
-# warn "Action list query: $query\n".$self->org_id.", ".$self->login;
-
- my $sth = $dbh->prepare($query);
- $sth->execute($self->org_id);
-
- $$total_ref = 0;
- my $i = 1;
- my @actions;
- while (my @action = $sth->fetchrow) {
- $$total_ref = $i;
- push @$all_ids, $action[6] if $all_ids;
- if ($i >= $lower and $i <= $upper) {
-# push @actions, [@action, $server_action_names{$action[0]}];
- $action[1] = $self->convert_time($action[1]);
- push @actions, [ @action ];
- }
- $i++;
- }
-
- return @actions;
-}
-
sub commit {
my $self = shift;
my $dbh = RHN::DB->connect;
@@ -1377,31 +1234,6 @@ EOQ
return 1;
}
-sub verify_transaction_access {
- my $self = shift;
- my @transaction_ids = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT 1
- FROM rhnTransaction T
- WHERE T.id = :tid
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = :user_id AND USP.server_id = T.server_id)
-EOQ
-
- foreach my $tid (@transaction_ids) {
- $sth->execute_h(tid => $tid, user_id => $self->id);
-
- my ($first_row) = $sth->fetchrow;
-
- $sth->finish;
-
- return 0 unless $first_row;
- }
-
- return 1;
-}
-
sub verify_errata_access {
my $self = shift;
my @errata_ids = @_;
@@ -1874,21 +1706,6 @@ sub get_pref {
return $val;
}
-sub get_server_pref {
- my $self = shift;
- my $server_id = shift;
- my $pref = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("SELECT value FROM rhnUserServerPrefs WHERE user_id = ? AND server_id = ? AND name = ?");
-
- $sth->execute($self->id, $server_id, $pref);
- my ($val) = $sth->fetchrow;
- $sth->finish;
-
- return $val;
-}
-
sub set_pref {
my $self = shift;
my $pref = shift;
@@ -1912,86 +1729,6 @@ sub set_pref {
$dbh->commit;
}
-# applicant info:
-# $sth = $dbh->prepare(<<EOS);
-# SELECT UG.id,
-# (SELECT COUNT(*) FROM rhnUserGroupMembers WHERE user_group_id = UG.id)
-# FROM rhnUserGroupType UGT,
-# rhnUserGroup UG
-# WHERE UG.org_id = ?
-# AND UG.group_type = UGT.id
-# AND UGT.label = 'org_applicant'
-# EOS
-# $sth->execute($self->org_id);
-# my ($applicant_group, $applicant_count) = $sth->fetchrow;
-# $sth->finish;
-
-sub system_summary {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- $sth = $dbh->prepare(<<EOS);
-SELECT COUNT(S.id)
- FROM rhnServer S
- WHERE S.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = ? AND USP.server_id = S.id)
- AND NOT EXISTS (SELECT 1 FROM rhnEntitledServers ES where ES.id = S.id)
-EOS
- $sth->execute($self->org_id, $self->id);
- my ($unentitled) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOS);
-SELECT COUNT(S.id)
- FROM rhnServer S
- WHERE S.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = ? AND USP.server_id = S.id)
- AND NOT EXISTS (SELECT 1
- FROM rhnServerGroup SG, rhnServerGroupMembers SGM
- WHERE SGM.server_id = S.id
- AND SG.id = SGM.server_group_id
- AND SG.group_type IS NULL)
-EOS
- $sth->execute($self->org_id, $self->id);
- my ($ungrouped) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOS);
-SELECT COUNT(USP.server_id)
- FROM rhnUserServerPerms USP
- WHERE USP.user_id = ?
-EOS
- $sth->execute($self->id);
- my ($total_servers) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOS);
-SELECT COUNT(USP.server_id)
- FROM rhnUserServerPerms USP
- WHERE USP.user_id = ?
- AND EXISTS (SELECT 1 FROM rhnServerNeededPackageCache WHERE server_id = USP.server_id)
-EOS
- $sth->execute($self->id);
- my ($servers_needing_attention) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOS);
-SELECT COUNT(USP.server_id)
- FROM rhnUserServerPerms USP
- WHERE USP.user_id = ?
- AND EXISTS (SELECT 1 FROM rhnServerInfo WHERE server_id = USP.server_id AND checkin < sysdate - ?)
-EOS
-
- $sth->execute($self->id, PXT::Config->get('system_checkin_threshold'));
- my ($inactive_server_count) = $sth->fetchrow;
- $sth->finish;
-
-
- return [ $total_servers, $servers_needing_attention, $unentitled, $ungrouped, $inactive_server_count ];
-}
-
sub action_summary {
my $self = shift;
# my $days = shift or die "No days argument to action_summary";
@@ -2126,72 +1863,6 @@ sub has_incomplete_info {
return 0;
}
-sub orders_for_user {
- my $class = shift;
- my $uid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT CUSTOMER_NUMBER, WEB_ORDER_NUMBER, LINE_ID, PRODUCT_ITEM_CODE, PRODUCT_NAME, QUANTITY
- FROM user_orders
- WHERE customer_number = (SELECT oracle_customer_number FROM web_customer cu, web_contact co WHERE co.id = ? and co.org_id = cu.id)
-EOS
-
- $sth->execute($uid);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub products_for_user {
- my $class = shift;
- my $uid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT REGISTRATION_USER_ID, REG_NUMBER, SERVICE_TAG, PRODUCT_DESCRIPTION, PRODUCT_ITEM_CODE,
- PRODUCT_START_DATE, PRODUCT_END_DATE, PRODUCT_ACTIVE_FLAG, PRODUCT_QUANTITY,
- SERVICE_DESCRIPTION, SERVICE_ITEM_CODE, SERVICE_START_DATE, SERVICE_END_DATE,
- SERVICE_ACTIVE_FLAG
- FROM user_products
- WHERE user_id = ?
-EOS
-
- $sth->execute($uid);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub uids_by_login_prefix {
- my $class = shift;
- my $login = uc shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOS);
-SELECT id, login
- FROM web_contact
- WHERE login_uc LIKE ?
-EOS
-
- $sth->execute("$login%");
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
sub banish {
my $self = shift;
@@ -2367,54 +2038,6 @@ EOQ
return @sids;
}
-sub email_addresses {
- my $self_or_class = shift;
- my $id;
-
- if (ref $self_or_class) {
- $id = $self_or_class->id;
- }
- else {
- $id = shift;
- }
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT id
- FROM rhnEmailAddress
- WHERE user_id = :user_id
-ORDER BY MODIFIED DESC
-EOQ
-
- $sth->execute_h(user_id => $id);
-
- my @ret;
-
- while (my ($id) = $sth->fetchrow) {
- push @ret, RHN::EmailAddress->lookup(-id => $id);
- }
-
- return @ret;
-}
-
-sub delete_nonverified_addresses {
- my $self = shift;
- my %params = validate(@_, {transaction => 0});
- my $dbh = $params{transaction} || RHN::DB->connect;
-
- my $query = <<EOQ;
-DELETE
- FROM rhnEmailAddress
- WHERE user_id = :user_id
- AND state_id != (SELECT id FROM rhnEmailAddressState WHERE label = 'verified')
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(user_id => $self->id);
-
- $dbh->commit unless $params{transaction};
-}
-
#lock the user's row in web_contact -- $dbh must be committed or rolled back at some point
sub lock_web_contact {
my $class = shift;
@@ -2472,27 +2095,6 @@ EOQ
return 1;
}
-# can this user modify the target user?
-sub can_modify_user {
- my $self = shift;
- my $target = shift;
-
- die "'$target' is not a user object"
- unless (ref $target and $target->isa('RHN::DB::User'));
-
- if ($self->org_id != $target->org_id) {
- warn "Orgs for admin user edit mistatch (admin: @{[$self->org_id]} != @{[$target->org_id]}";
- return 0;
- }
-
- if ($target->id != $self->id and not $self->is('org_admin')) {
- warn "Non-orgadmin attempting to edit another's record";
- return 0;
- }
-
- return 1;
-}
-
sub manages_a_channel {
my $self = shift;
14 years, 3 months
4 commits - web/modules web/spacewalk-web.spec
by Jan Pazdziora
web/modules/rhn/RHN/ConfigFile.pm | 24 ---------
web/modules/rhn/RHN/DB/ConfigFile.pm | 82 -------------------------------
web/modules/rhn/RHN/DB/FileList.pm | 70 --------------------------
web/modules/sniglets/Sniglets/Servers.pm | 1
web/spacewalk-web.spec | 1
5 files changed, 178 deletions(-)
New commits:
commit b195c1fa009989b0cb8a341ead21cc568c292c0d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 16:53:00 2010 +0100
Previous removals made RHN::ConfigFile and RHN::DB::ConfigFile empty, likely not needed, removing.
diff --git a/web/modules/rhn/RHN/ConfigFile.pm b/web/modules/rhn/RHN/ConfigFile.pm
deleted file mode 100644
index 277bb71..0000000
--- a/web/modules/rhn/RHN/ConfigFile.pm
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-use strict;
-
-package RHN::ConfigFile;
-
-use RHN::DB::ConfigFile;
-our @ISA = qw/RHN::DB::ConfigFile/;
-
-1;
-
diff --git a/web/modules/rhn/RHN/DB/ConfigFile.pm b/web/modules/rhn/RHN/DB/ConfigFile.pm
deleted file mode 100644
index c2d60e1..0000000
--- a/web/modules/rhn/RHN/DB/ConfigFile.pm
+++ /dev/null
@@ -1,21 +0,0 @@
-#
-# Copyright (c) 2008 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.
-#
-
-use strict;
-
-package RHN::DB::ConfigFile;
-use RHN::DB;
-
-1;
diff --git a/web/modules/sniglets/Sniglets/Servers.pm b/web/modules/sniglets/Sniglets/Servers.pm
index e836214..3d287a5 100644
--- a/web/modules/sniglets/Sniglets/Servers.pm
+++ b/web/modules/sniglets/Sniglets/Servers.pm
@@ -40,7 +40,6 @@ use RHN::Form;
use RHN::Form::Widget::Select;
use RHN::Form::Widget::CheckboxGroup;
use RHN::SatelliteCert;
-use RHN::ConfigFile;
use RHN::Kickstart::Session;
use Sniglets::Forms;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 4710799..c60a656 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -152,7 +152,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/Cleansers.pm
%{perl_vendorlib}/RHN/Command.pm
%{perl_vendorlib}/RHN/ConfigChannel.pm
-%{perl_vendorlib}/RHN/ConfigFile.pm
%{perl_vendorlib}/RHN/ConfigRevision.pm
%{perl_vendorlib}/RHN/ContactGroup.pm
%{perl_vendorlib}/RHN/ContactMethod.pm
commit d19a1ac5019da509554dad3add81742154c5be73
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 16:50:39 2010 +0100
Removal of set_file_list made path_to_id unused, removing.
diff --git a/web/modules/rhn/RHN/DB/ConfigFile.pm b/web/modules/rhn/RHN/DB/ConfigFile.pm
index 0012f4b..c2d60e1 100644
--- a/web/modules/rhn/RHN/DB/ConfigFile.pm
+++ b/web/modules/rhn/RHN/DB/ConfigFile.pm
@@ -18,12 +18,4 @@ use strict;
package RHN::DB::ConfigFile;
use RHN::DB;
-# given a path, return the rhnConfigFileName id
-sub path_to_id {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- return $dbh->call_function('lookup_config_filename', @_);
-}
-
1;
commit b879dfd0c1a6567b45a3f29b41a39937dfc3c9d7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 16:49:49 2010 +0100
get_file_list, set_file_list, and delete_list not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/FileList.pm b/web/modules/rhn/RHN/DB/FileList.pm
index 95c8dc4..925f5e3 100644
--- a/web/modules/rhn/RHN/DB/FileList.pm
+++ b/web/modules/rhn/RHN/DB/FileList.pm
@@ -31,65 +31,6 @@ my @filelist_fields = qw/ID LABEL ORG_ID CREATED MODIFIED/;
my $fl = new RHN::DB::TableClass("rhnFileList", "FL", "", @filelist_fields);
-sub get_file_list {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOQ;
-SELECT CFN.path
- FROM rhnConfigFileName CFN,
- rhnFileListMembers FLM
- WHERE CFN.id = FLM.config_file_name_id
- AND FLM.file_list_id = :id
-EOQ
- my $sth;
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(id => $self->id);
-
- my @flist;
- while (my @row = $sth->fetchrow) {
- push @flist, $row[0];
- }
-
- return \@flist;
-}
-
-sub set_file_list {
- my $self = shift;
- my %params = validate(@_, { file_list => { type => ARRAYREF }});
-
- my $dbh = RHN::DB->connect;
- my $query;
- my $sth;
- my @file_list = grep {$_} @{$params{file_list}};
-
- $query = <<EOQ;
-DELETE FROM rhnFileListMembers FLM
- WHERE FLM.FILE_LIST_ID = :flid
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(flid => $self->id);
-
- $query = <<EOQ;
-INSERT INTO rhnFileListMembers
- (file_list_id, config_file_name_id)
- VALUES (:flid, :cfnid)
-EOQ
- $sth = $dbh->prepare($query);
-
- foreach my $path (@file_list) {
- my $cfnid = RHN::ConfigFile->path_to_id($path);
- $sth->execute_h(flid => $self->id, cfnid =>$cfnid);
- }
-
- $sth->finish;
- $dbh->commit;
-
- return;
-}
-
# build some accessors
foreach my $field ($fl->method_names) {
my $sub = q {
@@ -196,15 +137,4 @@ sub commit {
delete $self->{":modified:"};
}
-sub delete_list {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare("DELETE FROM rhnFileList WHERE id = :flid");
- $sth->execute_h(flid => $self->id);
- $sth->finish;
- $dbh->commit;
-}
-
1;
commit 5c171de052a3b6fc2b5f25c46937e47f1d2eb89a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 16:00:45 2010 +0100
Removing bunch of unused methods from RHN::DB::ConfigFile:
id_to_latest_revision_crid
file_name_id_to_path
delete_file_path
file_id_to_path
diff --git a/web/modules/rhn/RHN/DB/ConfigFile.pm b/web/modules/rhn/RHN/DB/ConfigFile.pm
index 7ea4a20..0012f4b 100644
--- a/web/modules/rhn/RHN/DB/ConfigFile.pm
+++ b/web/modules/rhn/RHN/DB/ConfigFile.pm
@@ -18,22 +18,6 @@ use strict;
package RHN::DB::ConfigFile;
use RHN::DB;
-# given a config file id, return the crid of the latest revision, if any
-sub id_to_latest_revision_crid {
- my $class = shift;
- my $cf_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare('SELECT CFt.latest_config_revision_id FROM rhnConfigFile CFt WHERE CFT.id = :cf_id');
- $sth->execute_h(cf_id => $cf_id);
-
- my ($ret) = $sth->fetchrow;
- $sth->finish;
-
- return $ret;
-}
-
# given a path, return the rhnConfigFileName id
sub path_to_id {
my $class = shift;
@@ -42,41 +26,4 @@ sub path_to_id {
return $dbh->call_function('lookup_config_filename', @_);
}
-# given an id, return the rhnConfigFileName path
-sub file_name_id_to_path {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("SELECT path FROM rhnConfigFileName WHERE id = ?");
- $sth->execute(@_);
-
- my ($ret) = $sth->fetchrow;
- $sth->finish;
-
- return $ret;
-}
-
-# given an rhnConfigFile id, delete it
-sub delete_file_path {
- my $self = shift;
- my $cfid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->call_procedure('rhn_config.delete_file', $cfid);
- $dbh->commit;
-}
-
-# given a config file id, find the path
-sub file_id_to_path {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("SELECT config_file_name_id FROM rhnConfigFile WHERE id = ?");
- $sth->execute(@_);
-
- my ($ret) = $sth->fetchrow;
- $sth->finish;
- return $class->file_name_id_to_path($ret);
-}
-
1;
14 years, 3 months
Changes to 'refs/tags/spacewalk-backend-0.8.16-1'
by Michael Mraka
Tag 'spacewalk-backend-0.8.16-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-01-05 15:07 +0000
Tagging package [spacewalk-backend] version [0.8.16-1] in directory [backend/].
Changes since spacewalk-backend-0.8.15-1:
Jan Pazdziora (30):
Removal from PXT::ApacheHandler makes parse_exceptions unused as well.
parse_interface is not used anywhere, removing.
Since we have removed RHN::API::Parser->parse_exceptions, use'ing RHN::API::Parser is not needed.
Since the RHN::API::ExceptionBox is empty, calling RHN::API::Exception->throw_named does not bring any benefit, just call RHN::Exception::throw directly.
RHN::API::* namespace is not used from anywhere now (except RHN::API::* itself), removing.
execute_one not used, removing as dead code.
get_query_params not used, removing as dead code.
available_datasource_files not used, removing as dead code.
lookup_note and server_notes are not used anywhere, removing.
Removal of server_notes made notes_by_col unused, removing.
lookup_value not used anywhere, removing.
set_min_search_length, valid_search_string, and add_category not referenced, removing.
Removal of add_category mad parse_mode unused, removing.
inline_template, hide_tag, and unhide_tag not referenced, removing.
Removing bunch of unused methods from RHN::DB::Errata:
Removing bunch of unused methods from RHN::DBD::Server:
Remove the (deprecated and) unused lookup_channel, lookup_errata, and lookup_package methods.
Remove four unused methods in RHN::DB::ConfigChannel:
Removing bunch of unused methods from RHN::DB::Kickstart:
org_activation_keys is not called from anywhere, removing.
Removing bunch of unused methods from RHN::DB::Package:
is_xml_data_cached, %xml_cache_time, and load_data_file are not used, removing.
lookup_hw_device is not used anywhere, removing.
lookup_storage_device is not used anywhere, removing.
lookup_net_interface is not used anywhere, removing.
lookup_net_info is not used anywhere, removing.
lookup_cd_device is not used anywhere, removing.
Removed bunch of unused methods from RHN::DB::Scheduler:
diff_config_revisions, sibling_revisions, and lookup_action_data not called from anywhere, removing.
Removed bunch of unused methods from RHN::DB::Channel:
Michael Mraka (4):
fixed order of classes
fixed rhn-satellite-exporter to export sha256 content properly
added channel checksum type to export
Automatic commit of package [spacewalk-backend] release [0.8.16-1].
Tomas Lestach (1):
adding "Yum Repository Checksum Type" info to the channels/ChannelDetail.do page
---
backend/rhn-conf/rhn_server_iss.conf | 3
backend/rhn-conf/rhn_server_satellite.conf | 2
backend/satellite_tools/disk_dumper/dumper.py | 760 +++++++--------
backend/satellite_tools/exporter/exportLib.py | 51 -
backend/spacewalk-backend.spec | 5
java/code/webapp/WEB-INF/pages/channel/channeldetail.jsp | 11
rel-eng/packages/spacewalk-backend | 2
web/modules/pxt/PXT/ApacheHandler.pm | 1
web/modules/rhn/RHN/API/Exception.pm | 88 -
web/modules/rhn/RHN/API/ExceptionBox.pm | 83 -
web/modules/rhn/RHN/API/Interface.pm | 76 -
web/modules/rhn/RHN/API/Method.pm | 205 ----
web/modules/rhn/RHN/API/Parser.pm | 159 ---
web/modules/rhn/RHN/API/TypeHandler.pm | 70 -
web/modules/rhn/RHN/API/Types.pm | 262 -----
web/modules/rhn/RHN/Channel.pm | 8
web/modules/rhn/RHN/DB/Channel.pm | 393 -------
web/modules/rhn/RHN/DB/ConfigChannel.pm | 58 -
web/modules/rhn/RHN/DB/ConfigRevision.pm | 71 -
web/modules/rhn/RHN/DB/DataSource.pm | 25
web/modules/rhn/RHN/DB/Errata.pm | 345 ------
web/modules/rhn/RHN/DB/Kickstart.pm | 324 ------
web/modules/rhn/RHN/DB/Notes.pm | 30
web/modules/rhn/RHN/DB/Package.pm | 477 ---------
web/modules/rhn/RHN/DB/Scheduler.pm | 329 ------
web/modules/rhn/RHN/DB/Server.pm | 608 ------------
web/modules/rhn/RHN/DB/Server/CdDevice.pm | 30
web/modules/rhn/RHN/DB/Server/HwDevice.pm | 30
web/modules/rhn/RHN/DB/Server/NetInfo.pm | 33
web/modules/rhn/RHN/DB/Server/NetInterface.pm | 30
web/modules/rhn/RHN/DB/Server/StorageDevice.pm | 29
web/modules/rhn/RHN/DB/Token.pm | 10
web/modules/rhn/RHN/DataSource.pm | 48
web/modules/rhn/RHN/Errata.pm | 8
web/modules/rhn/RHN/Exception.pm | 1
web/modules/rhn/RHN/Form.pm | 11
web/modules/rhn/RHN/Package.pm | 8
web/modules/rhn/RHN/Postal.pm | 21
web/modules/rhn/RHN/SearchTypes.pm | 46
web/modules/rhn/RHN/ServerNotes.pm | 22
web/spacewalk-web.spec | 1
41 files changed, 435 insertions(+), 4339 deletions(-)
---
14 years, 3 months
backend/spacewalk-backend.spec rel-eng/packages
by Michael Mraka
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit b567a86368fb804a4999936833f82ce553e3cdc0
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Jan 5 16:07:40 2010 +0100
Automatic commit of package [spacewalk-backend] release [0.8.16-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 23ac2a2..47e3dae 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.15
+Version: 0.8.16
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -588,6 +588,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Tue Jan 05 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.16-1
+- made rhn-satellite-exporter SHA256 ready
+
* Tue Jan 05 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.15-1
- merged satellite_exporter/exporter into satellite_tools/disk_dumper
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 1abd8db..06bfebf 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.15-1 backend/
+0.8.16-1 backend/
14 years, 3 months
7 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/Channel.pm | 393 -------------------------
web/modules/rhn/RHN/DB/ConfigRevision.pm | 71 ----
web/modules/rhn/RHN/DB/Scheduler.pm | 329 --------------------
web/modules/rhn/RHN/DB/Server/CdDevice.pm | 30 -
web/modules/rhn/RHN/DB/Server/NetInfo.pm | 33 --
web/modules/rhn/RHN/DB/Server/NetInterface.pm | 30 -
web/modules/rhn/RHN/DB/Server/StorageDevice.pm | 29 -
7 files changed, 915 deletions(-)
New commits:
commit b58a968cf7d243a943a952aa83a83988b02e727a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:58:50 2010 +0100
Removed bunch of unused methods from RHN::DB::Channel:
systems_to_be_subscribed
compat_channels
server_set_channel_set_true_actions
org_base_channel_list
channel_arch_id_by_label
channel_owned
errata_pkg_vers_in_channels
package_list_modified
family_details
package_by_filename
get_rhn_extras_channel
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index 6956425..19a9a2f 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -425,47 +425,6 @@ sub tri_state_channel_list {
return @$channels;
}
-sub systems_to_be_subscribed {
- my $class = shift;
- my $org_id = shift;
- my $channel_id = shift;
- my $user_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT COUNT(ES.id)
- FROM rhnChannel C,
- rhnServerChannel SC,
- rhnEntitledServers ES
- WHERE ES.org_id = ?
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = ? AND USP.server_id = ES.id)
- AND ES.id = SC.server_id
- AND C.id = ?
- AND SC.channel_id = C.parent_channel
- AND NOT EXISTS (SELECT 1 FROM rhnServerChannel WHERE server_id = ES.id AND channel_id = C.id)
- AND EXISTS (SELECT 1 FROM rhnSet WHERE user_id = ? AND label = 'system_list' AND element = ES.id)
-ORDER BY UPPER(NVL(ES.NAME, '(none)')), ES.ID
-EOQ
-
- $sth = $dbh->prepare($query);
-
- $sth->execute($org_id, $user_id, $channel_id, $user_id);
-
- my @row = $sth->fetchrow;
- $sth->finish;
-
- if (@row) {
- return $row[0];
- }
- else {
- return 0;
- }
-}
-
sub subscribable_channels {
my $class = shift;
my %params = validate(@_, {server_id => 1, user_id => 1, base_channel_id => 1});
@@ -524,35 +483,6 @@ EOQ
return @channels;
}
-sub compat_channels {
- my $class = shift;
- my $channel_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = <<EOQ;
- SELECT C1.name, C1.id
- FROM rhnChannel C2, rhnChannel C1
- WHERE C2.id = ?
- AND C1.channel_arch_id = C2.channel_arch_id
-ORDER BY C1.org_id DESC, C1.name
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($channel_id);
-
- my @channels;
-
- while (my @row = $sth->fetchrow) {
- push @channels, [ $row[0], 'channel_' . $row[1] ];
- }
-
- return @channels;
-}
-
sub channels_owned_by_org {
my $class = shift;
my $org_id = shift;
@@ -644,86 +574,6 @@ EOQ
return @channels;
}
-sub server_set_channel_set_true_actions {
- my $class = shift;
- my %params = @_;
-# my $user_id = shift;
-
- my ($user_id, $lower, $upper, $total_ref) =
- map { $params{"-" . $_} } qw/user_id lower upper total_rows/;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
-SELECT S.id
- FROM rhnChannel CHANNELS_TO_ADD, rhnAvailableChannels AC, rhnServerChannel SC, rhnServer S, rhnSet ST
- WHERE ST.user_id = ?
- AND ST.label = 'system_list'
- AND ST.element = SC.server_id
- AND ST.element = S.id
- AND S.org_id = AC.org_id
- AND ((AC.available_members > 0) OR (AC.available_members IS NULL))
- AND CHANNELS_TO_ADD.id = AC.channel_id
- AND CHANNELS_TO_ADD.id IN (SELECT ST2.element FROM rhnSet ST2 WHERE user_id = ? AND label = 'channel_list' AND ST2.element_two = 1)
- AND CHANNELS_TO_ADD.id NOT IN (SELECT SC.channel_id FROM rhnServerChannel SC WHERE SC.server_id = S.id)
- AND CHANNELS_TO_ADD.parent_channel = SC.channel_id
-UNION
-SELECT S.id
- FROM rhnChannel CHANNELS_TO_REMOVE, rhnServer S, rhnSet ST
- WHERE ST.user_id = ?
- AND ST.label = 'system_list'
- AND ST.element = S.id
- AND CHANNELS_TO_REMOVE.id IN (SELECT ST2.element FROM rhnSet ST2 WHERE user_id = ? AND label = 'channel_list' AND ST2.element_two = 2)
- AND CHANNELS_TO_REMOVE.id IN (SELECT SC.channel_id FROM rhnServerChannel SC WHERE SC.server_id = S.id)
-EOQ
- my $sth = $dbh->prepare($query);
- $sth->execute($user_id, $user_id, $user_id, $user_id);
-
- $$total_ref = 0;
- my $i = 1;
- my @ids;
- while (my @row = $sth->fetchrow) {
- $$total_ref = $i;
- if ($i >= $lower and $i <= $upper) {
- push @ids, @row;
- }
- $i++;
- }
-
- if (!@ids) {
- return;
- }
-
- $query = sprintf(<<EOQ, join(", ", ("?") x @ids), join(", ", ("?") x @ids));
-SELECT S.id, S.name, CHANNELS_TO_ADD.id, CHANNELS_TO_ADD.name, 'subscribe'
- FROM rhnChannel CHANNELS_TO_ADD, rhnAvailableChannels AC, rhnServerChannel SC, rhnServer S
- WHERE S.id IN (%s)
- AND S.id = SC.server_id
- AND S.org_id = AC.org_id
- AND ((AC.available_members > 0) OR (AC.available_members IS NULL))
- AND CHANNELS_TO_ADD.id = AC.channel_id
- AND CHANNELS_TO_ADD.id IN (SELECT ST2.element FROM rhnSet ST2 WHERE user_id = ? AND label = 'channel_list' AND ST2.element_two = 1)
- AND CHANNELS_TO_ADD.id NOT IN (SELECT SC2.channel_id FROM rhnServerChannel SC2 WHERE SC2.server_id = S.id)
- AND CHANNELS_TO_ADD.parent_channel = SC.channel_id
-UNION
-SELECT S.id, S.name, CHANNELS_TO_REMOVE.id, CHANNELS_TO_REMOVE.name, 'unsubscribe'
- FROM rhnChannel CHANNELS_TO_REMOVE, rhnServer S
- WHERE S.id IN (%s)
- AND CHANNELS_TO_REMOVE.id IN (SELECT ST2.element FROM rhnSet ST2 WHERE user_id = ? AND label = 'channel_list' AND ST2.element_two = 2)
- AND CHANNELS_TO_REMOVE.id IN (SELECT SC.channel_id FROM rhnServerChannel SC WHERE SC.server_id = S.id)
-EOQ
- $sth = $dbh->prepare($query);
- $sth->execute(@ids, $user_id, @ids, $user_id);
-
- my @ret;
-
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
sub user_subscribable_base_channels {
my $self = shift;
@@ -757,35 +607,6 @@ EOQ
return @channels;
}
-# base channels owned by org
-sub org_base_channel_list {
- my $class = shift;
- my $org_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query =<<EOQ;
-SELECT C.id, C.name
- FROM rhnChannel C, rhnAvailableChannels AC
- WHERE AC.org_id = ?
- AND AC.channel_depth = 1
- AND AC.channel_id = C.id
- AND C.org_id = AC.org_id
-ORDER BY C.id
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @channels;
-
- while (my @row = $sth->fetchrow) {
- push @channels, [ @row ];
- }
-
- return RHN::Utils->parameterize(\@channels, 'id', 'name');
-}
-
sub package_groups {
my $class = shift;
my $channel_id = shift;
@@ -885,20 +706,6 @@ sub channel_id_by_label {
return $id;
}
-sub channel_arch_id_by_label {
- my $class = shift;
- my $label = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare('SELECT CA.id FROM rhnChannelArch CA WHERE CA.label = ?');
- $sth->execute($label);
-
- my ($id) = $sth->fetchrow;
- $sth->finish;
-
- return $id;
-}
-
sub channel_entitlement_overview {
my $self = shift;
@@ -920,46 +727,6 @@ EOQ
return @ret;
}
-#returns true if channel is owned by org.
-sub channel_owned {
-
- my $self = shift;
- my $org_id = shift;
- my $cid;
-
- if (ref $self) {
- $cid = $self->id;
- }
- else {
- $cid = shift;
- }
-
- undef $self;
- die "No org_id" unless defined $org_id;
- die "No channel_id" unless defined $cid;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOQ;
-SELECT C.org_id
- FROM rhnChannel C
- WHERE C.id = ?
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute($cid);
-
- my $oid = $sth->fetchrow || 0;
-
- $sth->finish;
-
- if ($org_id == $oid) {
- return 1;
- }
- else {
- return 0;
- }
-}
-
#adopt channel into channel_famil(y|ies)
sub adopt_into_family {
my $self = shift;
@@ -1041,90 +808,6 @@ EOQ
return @ret;
}
-sub errata_pkg_vers_in_channels {
- my $class = shift;
- my $eid = shift;
- my @ids = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- my $query = <<EOQ;
-SELECT DISTINCT C.label,
- PA.name,
- PN.id,
- PN.name,
- PE.epoch,
- PE.version,
- PE.release,
- E.advisory_name,
- C.name,
- Csum.checksum OUTDATED_PACKAGE_MD5SUM,
- P.path
- FROM rhnPackageArch PA,
- rhnChannel C,
- rhnPackageEVR PE,
- rhnPackageName PN,
- rhnErrata E,
- rhnErrataPackage EP2,
- rhnChannelPackage CP,
- rhnChannelErrata CE2,
- rhnChannelErrata CE,
- rhnPackage P2,
- rhnPackage P,
- rhnErrataPackage EP,
- rhnChecksum Csum
- WHERE EP.errata_id = ?
- AND EP.package_id = P.id
- AND P.name_id = P2.name_id
- AND P.package_arch_id = P2.package_arch_id
- AND CE.errata_id = ?
- AND CE.channel_id = CP.channel_id
- AND CP.package_id = P2.id
- AND P2.id = EP2.package_id
- AND EP2.errata_id = CE2.errata_id
- AND CE.channel_id = CE2.channel_id
- AND CE2.errata_id = E.id
- AND P.name_id = PN.id
- AND P2.evr_id = PE.id
- AND P2.package_arch_id = PA.id
- AND CE2.channel_id = C.id
- AND P.checksum_id = Csum.id
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($eid, $eid);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-sub package_list_modified {
- my $class = shift;
- my $cid = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- my $query = <<EOQ;
-SELECT TO_CHAR(MAX(CP.modified), 'YYYY-MM-DD HH24:MI:SS')
- FROM rhnChannelPackage CP
- WHERE CP.channel_id = ?
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($cid);
-
- my ($date) = $sth->fetchrow;
- $sth->finish;
-
- return $date;
-}
-
sub distros {
my $self = shift;
my $cid;
@@ -1259,28 +942,6 @@ EOQ
return $row;
}
-# details about a channel family, given the rhnChannelFamily.id
-sub family_details {
- my $class = shift;
- my $cfid = shift;
-
- die "No channel family id" unless defined $cfid;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT CF.id, CF.name, CF.label, CF.product_url, CF.org_id
- FROM rhnChannelFamily CF
- WHERE CF.id = :cfid
-EOQ
-
- $sth->execute_h(cfid => $cfid);
- my ($row) = $sth->fetchrow_hashref;
-
- $sth->finish;
-
- return $row;
-}
-
sub packages {
@@ -1517,33 +1178,6 @@ sub installable {
return -d $path;
}
-sub package_by_filename {
- my $self = shift;
- my $filename = shift;
-
- die "Invalid filename: contains naughty bits" if $filename =~ m(/);
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT P.id
- FROM rhnPackage P,
- rhnChannelPackage CP
- WHERE CP.channel_id = :cid
- AND CP.package_id = P.id
- AND P.path LIKE :pathlike
-EOQ
-
- $sth->execute_h(cid => $self->id, pathlike => "%/$filename");
- my ($pid) = $sth->fetchrow;
-
- # we got a pid for the first hit... can we get another?
- if ($pid and $sth->fetchrow) {
- die "Multiple returns for package '$filename' in channel " . $self->label;
- }
-
- return $pid;
-}
-
sub package_by_filename_in_tree {
my $self = shift;
my $filename = shift;
@@ -1605,33 +1239,6 @@ EOQ
return map { @$_ } $sth->fullfetch;
}
-sub get_rhn_extras_channel {
- my $class = shift;
- my $cid = shift;
- my $org_id = shift;
-
- my @children = RHN::Channel->children($cid);
-
- my $pid;
- my $extras_cid;
-
- my $org = RHN::Org->lookup(-id => $org_id);
-
- foreach my $child_cid (@children) {
- next unless $org->has_channel_permission($child_cid);
-
- my @pids = RHN::Channel->latest_package_like($child_cid, 'auto-kickstart-');
-
- if (@pids) {
- $extras_cid = $child_cid;
- $pid = $pids[0];
- last;
- }
- }
-
- return $extras_cid;
-}
-
sub packaging_type {
my $class_or_self = shift;
commit 1cec4ed0df4186bd2970b69d6cc692b12ec38276
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:53:58 2010 +0100
diff_config_revisions, sibling_revisions, and lookup_action_data not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/ConfigRevision.pm b/web/modules/rhn/RHN/DB/ConfigRevision.pm
index 0f84dc5..3d720f0 100644
--- a/web/modules/rhn/RHN/DB/ConfigRevision.pm
+++ b/web/modules/rhn/RHN/DB/ConfigRevision.pm
@@ -266,40 +266,6 @@ EOQ
return $ret;
}
-sub diff_config_revisions {
- my $class = shift;
- my %params = validate(@_, {user => 1, file_1 => 1, file_2 => 1, style => { default => 'Unified' }});
-
- my $user = $params{user}; # needed for time conversion
-
- my ($file_1, $file_2) = @params{qw/file_1 file_2/};
-
- my $contents_1 = $file_1->contents || '';
- my $contents_2 = $file_2->contents || '';
- $contents_1 .= "\n" if $contents_1 !~ /\n\Z/;
- $contents_2 .= "\n" if $contents_2 !~ /\n\Z/;
-
- my %diff_options = ( STYLE => $params{style},
- FILENAME_A => $file_1->path,
- FILENAME_B => $file_2->path,
- MTIME_A => str2time($file_1->modified),
- MTIME_B => str2time($file_2->modified)
- );
- my $diff = diff(\$contents_1, \$contents_2, \%diff_options);
-
- return $diff;
-}
-
-# give other revisions of same file in same namespace
-sub sibling_revisions {
- my $self = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "config_queries", -mode => 'revisions_of_configfile');
- my $data = $ds->execute_query(-crid => $self->id);
-
- return $data;
-}
-
sub next_revision {
my $self = shift;
@@ -319,41 +285,4 @@ EOS
}
-sub lookup_action_data {
- my $class = shift;
- my %params = validate(@_, {acrid => 1} );
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT ACR.id,
- ACR.action_id,
- ACR.server_id,
- ACR.config_revision_id,
- CF.config_channel_id,
- CR.revision,
- ACRR.result AS RESULT,
- CC.name as config_channel_name,
- CR.config_file_id,
- CFN.path
- FROM rhnActionConfigRevision ACR,
- rhnActionConfigRevisionResult ACRR,
- rhnConfigRevision CR,
- rhnConfigChannel CC,
- rhnConfigFile CF,
- rhnConfigFileName CFN
- WHERE ACR.id = :acrid
- AND ACR.id = ACRR.action_config_revision_id (+)
- AND ACR.config_revision_id = CR.id
- AND CR.config_file_id = CF.id
- AND CF.config_channel_id = CC.id
- AND CF.config_file_name_id = CFN.id
-EOQ
-
- $sth->execute_h(acrid => $params{acrid});
- my ($data) = $sth->fetchrow_hashref;
- $sth->finish;
-
- return $data;
-}
-
1;
commit 1db924811fd948d497dba8b75b67e177c9223571
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:50:21 2010 +0100
Removed bunch of unused methods from RHN::DB::Scheduler:
schedule_sat_applet
schedule_mtime_upload
schedule_rollback
schedule_rollback_refresh
schedule_rollback_config
schedule_errata_update_for_all_affected_systems
schedule_kickstart_inject
schedule_activate_proxy
schedule_rhnsd_config
diff --git a/web/modules/rhn/RHN/DB/Scheduler.pm b/web/modules/rhn/RHN/DB/Scheduler.pm
index 744c412..6f890e3 100644
--- a/web/modules/rhn/RHN/DB/Scheduler.pm
+++ b/web/modules/rhn/RHN/DB/Scheduler.pm
@@ -168,90 +168,6 @@ EOQ
}
-sub schedule_sat_applet {
- my $class = shift;
- my %params = validate(@_, { org_id => 1,
- user_id => 1,
- earliest => 1,
- server_id => 1,});
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $params{org_id},
- -user_id => $params{user_id},
- -type_label => 'rhn_applet.use_satellite',
- -earliest => $params{earliest},
- );
-
- $class->add_servers_to_action($action_id, $stat_id, $params{user_id}, undef, $params{server_id});
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
-sub schedule_mtime_upload {
- my $class = shift;
- my %params = validate(@_, { org_id => 1,
- user_id => 1,
- earliest => 1,
- after => 1,
- before => 0,
- server_id => 1,
- action_name => 0,
- white_list => 1,
- black_list => 0,
- import_contents => 0,
- });
-
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $params{org_id},
- -user_id => $params{user_id},
- -type_label => 'configfiles.mtime_upload',
- -earliest => $params{earliest},
- );
-
- $class->add_servers_to_action($action_id, $stat_id, $params{user_id}, undef, $params{server_id});
-
- my $dbh = RHN::DB->connect();
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionConfigDate (action_id, start_date, end_date, import_contents)
-VALUES (:action_id, TO_DATE(:start_date, 'YYYY-MM-DD HH24:MI:SS'), TO_DATE(:end_date, 'YYYY-MM-DD HH24:MI:SS'), :import_contents)
-EOQ
-
- $sth->execute_h(action_id => $action_id,
- start_date => $params{after},
- end_date => $params{before},
- import_contents => ($params{import_contents} ? 'Y' : 'N'),
- );
-
- my $upload_chan_id = RHN::ConfigChannel->vivify_server_config_channel($params{server_id}, 'server_import');
-
- $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionConfigChannel (action_id, server_id, config_channel_id)
-VALUES (:action_id, :server_id, :config_channel_id)
-EOQ
- $sth->execute_h(action_id => $action_id, server_id => $params{server_id}, config_channel_id => $upload_chan_id);
-
- # file_type/path_type: 'w' for whitelist, 'b' for blacklist, so sayeth pjones :)
- $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionConfigDateFile (action_id, file_name, file_type)
-VALUES (:action_id, :path, :path_type)
-EOQ
-
- for my $w (@{$params{white_list}}) {
- $sth->execute_h(action_id => $action_id, path => $w, path_type => 'W');
- }
-
- for my $b (@{$params{black_list}}) {
- $sth->execute_h(action_id => $action_id, path => $b, path_type => 'B');
- }
-
- $dbh->commit();
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
sub schedule_reboot {
my $class = shift;
my %params = @_;
@@ -309,87 +225,6 @@ sub sscd_schedule_reboot {
return $action_id;
}
-sub schedule_rollback {
- my $class = shift;
- my %params = @_;
-
- my ($org_id, $user_id, $server_set, $server_id, $earliest, $from_tid, $to_tid) =
- map { $params{"-" . $_} } qw/org_id user_id server_set server_id earliest from_tid to_tid/;
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $org_id,
- -user_id => $user_id,
- -type_label => 'rollback.rollback',
- -earliest => $earliest);
-
- $class->add_servers_to_action($action_id, $stat_id, $user_id, $server_set, $server_id);
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionTransactions
- (action_id, from_trans_id, to_trans_id)
-VALUES
- (?, ?, ?)
-EOQ
- $sth->execute($action_id, $from_tid, $to_tid);
- $dbh->commit;
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
-sub schedule_rollback_refresh {
- my $class = shift;
- my %params = @_;
-
- my ($org_id, $user_id, $server_set, $server_id, $earliest) =
- map { $params{"-" . $_} } qw/org_id user_id server_set server_id earliest/;
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $org_id,
- -user_id => $user_id,
- -type_label => 'rollback.listTransactions',
- -earliest => $earliest
- );
-
- $class->add_servers_to_action($action_id, $stat_id, $user_id, $server_set, $server_id);
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
-sub schedule_rollback_config {
- my $class = shift;
- my %params = @_;
-
- die "not yet implemented";
-
- my ($org_id, $user_id, $server_set, $server_id, $earliest, $flag) =
- map { $params{"-" . $_} } qw/org_id user_id server_set server_id earliest flag/;
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $org_id,
- -user_id => $user_id,
- -type_label => 'rollback.listTransactions',
- -earliest => $earliest
- );
-
- $class->add_servers_to_action($action_id, $stat_id, $user_id, $server_set, $server_id);
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionRollbackConfig
- (action_id, flag)
-VALUES
- (?, ?)
-EOQ
- $sth->execute($action_id, $flag);
- $dbh->commit;
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
sub sscd_schedule_package_refresh {
my $class = shift;
my %params = @_;
@@ -1441,57 +1276,6 @@ EOQ
return @action_ids;
}
-# 1 errata
-sub schedule_errata_update_for_all_affected_systems {
- my $class = shift;
- my %params = @_;
-
- my ($org_id, $user_id, $earliest, $errata_id) =
- map { $params{"-" . $_} } qw/org_id user_id earliest errata_id/;
-
- die "no errata!" unless $errata_id;
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- my $errata = RHN::Errata->lookup(-id => $errata_id);
-
- die "errata lookup failed!" if !$errata;
-
- my $action_name = "Errata Update: " . $errata->advisory . ' - ' . $errata->synopsis;
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $org_id,
- -user_id => $user_id,
- -type_label => 'errata.update',
- -earliest => $earliest,
- -action_name => $action_name,
- );
-
-# warn "org_id == $org_id, errata id == $errata_id, action id == $action_id, status id == $stat_id";
-
- $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnServerAction (server_id, action_id, status)
-(
-SELECT DISTINCT SNEC.server_id, ?, ?
- FROM rhnServerNeededErrataCache SNEC
- WHERE SNEC.org_id = ?
- AND SNEC.errata_id = ?
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = ? AND USP.server_id = SNEC.server_id)
- AND EXISTS (SELECT 1 FROM rhnEntitledServers ES WHERE ES.id = SNEC.server_id)
-)
-EOQ
- $sth->execute($action_id, $stat_id, $org_id, $errata_id, $user_id);
-
- $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionErrataUpdate (action_id, errata_id) VALUES (?, ?)
-EOQ
- $sth->execute($action_id, $errata_id);
-
- $dbh->commit;
-
- osa_wakeup_tickle();
-}
-
sub schedule_package_sync {
my $class = shift;
my %params = validate(@_, { org_id => 1,
@@ -1718,56 +1502,6 @@ EOQ
}
-sub schedule_kickstart_inject {
- my $class = shift;
- my %params = validate(@_, { org_id => 1, user_id => 1, server_id => 1, earliest => 1, kstree_id => 1, append_string => 1, prerequisite => 0, transaction => 0, static_device => 1, ksid => 0});
-
- my $dbh = $params{transaction} || RHN::DB->connect;
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $params{org_id},
- -user_id => $params{user_id},
- -type_label => 'kickstart.initiate',
- -earliest => $params{earliest},
- -action_name => 'Kickstart',
- -prerequisite => $params{prerequisite},
- -transaction => $dbh,
- );
-
- $class->add_servers_to_action($action_id, $stat_id, $params{user_id}, undef, $params{server_id});
-
- my $server = RHN::Server->lookup(-id => $params{server_id});
-
- my $query =<<EOQ;
-INSERT
- INTO rhnActionKickstart
- (id, action_id, append_string, kstree_id, static_device)
-VALUES (rhn_actionks_id_seq.nextval, :aid, :append, :kstid, :static_device)
-EOQ
-
- my $sth = $dbh->prepare($query);
-
- $sth->execute_h(aid => $action_id, append => $params{append_string}, kstid => $params{kstree_id}, static_device => $params{static_device});
-
- if ($params{ksid}) {
- $sth = $dbh->prepare("SELECT rhn_actionks_id_seq.currval FROM DUAL");
- $sth->execute;
- my ($action_ks_id) = $sth->fetchrow;
- $sth->finish;
-
- $sth = $dbh->prepare(<<EOQ);
-INSERT
- INTO rhnActionKickstartFileList
- (action_ks_id, file_list_id)
- (SELECT :action_ks_id, KSPFL.file_list_id
- FROM rhnKickstartPreserveFileList KSPFL
- WHERE KSPFL.kickstart_id = :ksid)
-EOQ
- $sth->execute_h(action_ks_id => $action_ks_id, ksid => $params{ksid});
- }
-
- $dbh->commit unless $params{transaction};osa_wakeup_tickle(); return $action_id;
-}
-
sub associate_answer_files_with_action {
my $class = shift;
my $action_id = shift;
@@ -1903,67 +1637,4 @@ EOQ
return $action_id;
}
-sub schedule_activate_proxy {
- my $class = shift;
- my %params = validate(@_, { org_id => 1,
- user_id => 1,
- server_id => 1,
- earliest => 1,
- action_name => 0,
- prerequisite => 0,
- });
-
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $params{org_id},
- -user_id => $params{user_id},
- -type_label => 'rhn_proxy.activate',
- -earliest => $params{earliest},
- -action_name => $params{action_name},
- -prerequisite => $params{prerequisite},
- );
-
- my $dbh = RHN::DB->connect;
- my $sth;
-
- $class->add_servers_to_action($action_id,
- $stat_id,
- $params{user_id},
- undef,
- $params{server_id});
-
- osa_wakeup_tickle();
-
- return $action_id;
-}
-
-sub schedule_rhnsd_config {
- my $class = shift;
- my %params = @_;
-
- my ($org_id, $user_id, $server_set, $server_id, $earliest, $prerequisite, $transaction, $interval, $reboot_flag) =
- map { $params{"-" . $_} } qw/org_id user_id server_set server_id earliest prerequisite transaction interval reboot_flag/;
-
- my $dbh = $transaction || RHN::DB->connect;
- my ($action_id, $stat_id) = $class->make_base_action(-org_id => $org_id,
- -user_id => $user_id,
- -type_label => 'rhnsd.configure',
- -earliest => $earliest,
- -transaction => $transaction);
-
- $class->add_servers_to_action($action_id, $stat_id, $user_id, $server_set, $server_id);
-
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnActionDaemonConfig
- (action_id, interval, restart)
-VALUES
- (?, ?, ?)
-EOQ
- $sth->execute($action_id, $interval, $reboot_flag);
- $dbh->commit
- unless $params{-transaction};
-
- # XXX FIXME: trace and percolate up?
- osa_wakeup_tickle();
- return $action_id;
-}
-
1;
commit cbb6cc7c2e148eb175cef5dd795d45ad395aea84
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:45:18 2010 +0100
lookup_cd_device is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Server/CdDevice.pm b/web/modules/rhn/RHN/DB/Server/CdDevice.pm
index 4bf7419..82fa6a6 100644
--- a/web/modules/rhn/RHN/DB/Server/CdDevice.pm
+++ b/web/modules/rhn/RHN/DB/Server/CdDevice.pm
@@ -44,36 +44,6 @@ sub _blank_cd_device {
return $self;
}
-# returns one cddevice object from it's key
-sub lookup_cd_device {
- my $class = shift;
- my $id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = $c->select_query("C.ID = ?");
- $sth = $dbh->prepare($query);
- $sth->execute($id);
-
- my @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_cd_device;
- $ret->{"__".$_."__"} = shift @columns foreach $c->method_names;
- }
- else {
- local $" = ", ";
- die "Error loading cddevice $id; no ID? (@columns)";
- }
-
- return $ret;
-}
-
# returns an array of cddevice objects given a server id
#
# TODO: find a server in the database w/ more than 1 cd device attached to test
commit 0d0f825f08e10f74ccdefd2446c333a2c89c9d99
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:44:58 2010 +0100
lookup_net_info is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Server/NetInfo.pm b/web/modules/rhn/RHN/DB/Server/NetInfo.pm
index f29f4f9..ff70e5c 100644
--- a/web/modules/rhn/RHN/DB/Server/NetInfo.pm
+++ b/web/modules/rhn/RHN/DB/Server/NetInfo.pm
@@ -41,39 +41,6 @@ sub _blank_net_info {
return $self;
}
-# returns one net info object from it's key
-sub lookup_net_info {
- my $class = shift;
- my $id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = $n->select_query("N.ID = ?");
- $sth = $dbh->prepare($query);
- $sth->execute($id);
-
- my @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_net_info;
- $ret->{"__".$_."__"} = shift @columns foreach $n->method_names;
- }
- else {
- local $" = ", ";
- die "Error loading net info $id; no ID? (@columns)";
- }
-
- # bretm - fix ipaddr, all seem to length==16 w/ whitespace padding in db
- $ret->{__ipaddr__} =~ s/^\s*(.*?)\s*$/$1/e; # strip leading and following ws
-
- return $ret;
-}
-
# returns an array of net info objects given a server id
sub lookup_net_info_by_server {
my $class = shift;
commit a015fcbe2caae33e5960b30d4a8a4dee69d7d260
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:44:36 2010 +0100
lookup_net_interface is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Server/NetInterface.pm b/web/modules/rhn/RHN/DB/Server/NetInterface.pm
index 800a7d7..1a2a680 100644
--- a/web/modules/rhn/RHN/DB/Server/NetInterface.pm
+++ b/web/modules/rhn/RHN/DB/Server/NetInterface.pm
@@ -37,36 +37,6 @@ sub _blank_net_interface {
return $self;
}
-# returns one net info object from it's key
-sub lookup_net_interface {
- my $class = shift;
- my $id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = $n->select_query("N.ID = ?");
- $sth = $dbh->prepare($query);
- $sth->execute($id);
-
- my @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_net_interface;
- $ret->{"__".$_."__"} = shift @columns foreach $n->method_names;
- }
- else {
- local $" = ", ";
- die "Error loading net info $id; no ID? (@columns)";
- }
-
- return $ret;
-}
-
# returns an array of net info objects given a server id
sub lookup_net_interface_by_server {
my $class = shift;
commit 409d3c8eabd4e6239627ab5b0394933c7014c5fc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:44:00 2010 +0100
lookup_storage_device is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Server/StorageDevice.pm b/web/modules/rhn/RHN/DB/Server/StorageDevice.pm
index 10c5d73..281bf7d 100644
--- a/web/modules/rhn/RHN/DB/Server/StorageDevice.pm
+++ b/web/modules/rhn/RHN/DB/Server/StorageDevice.pm
@@ -43,35 +43,6 @@ sub _blank_storage_device {
return $self;
}
-# returns one storage device object from it's key
-sub lookup_storage_device {
- my $class = shift;
- my $id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = $s->select_query("S.ID = ?");
- $sth = $dbh->prepare($query);
- $sth->execute($id);
-
- my @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_storage_device;
- $ret->{"__".$_."__"} = shift @columns foreach $s->method_names;
- }
- else {
- local $" = ", ";
- croak "Error loading storage device $id; no ID? (@columns)";
- }
-
- return $ret;
-}
# returns an array of storage device objects given a server id
sub lookup_storage_devices_by_server {
14 years, 3 months
web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/Server/HwDevice.pm | 30 ------------------------------
1 file changed, 30 deletions(-)
New commits:
commit 2cff7c3333222568b674af76669aa2ace6bfeac3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:42:25 2010 +0100
lookup_hw_device is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Server/HwDevice.pm b/web/modules/rhn/RHN/DB/Server/HwDevice.pm
index 6b0db3e..4a87b4d 100644
--- a/web/modules/rhn/RHN/DB/Server/HwDevice.pm
+++ b/web/modules/rhn/RHN/DB/Server/HwDevice.pm
@@ -49,36 +49,6 @@ sub _blank_hw_device {
return $self;
}
-# returns one hwdevice object from it's key
-sub lookup_hw_device {
- my $class = shift;
- my $id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = $h->select_query("H.ID = ?");
- $sth = $dbh->prepare($query);
- $sth->execute($id);
-
- my @columns = $sth->fetchrow;
- $sth->finish;
-
- my $ret;
- if ($columns[0]) {
- $ret = $class->_blank_hw_device;
- $ret->{"__".$_."__"} = shift @columns foreach $h->method_names;
- }
- else {
- local $" = ", ";
- die "Error loading hw device $id; no ID? (@columns)";
- }
-
- return $ret;
-}
-
# returns an array of hwdevice objects given a server id
sub lookup_hw_devices_by_server {
my $class = shift;
14 years, 3 months
3 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/DataSource.pm | 25 -
web/modules/rhn/RHN/DB/Package.pm | 477 -----------------------------------
web/modules/rhn/RHN/DB/Token.pm | 10
3 files changed, 512 deletions(-)
New commits:
commit 3bca6916f2af8418a19ddb9f05f4c16d6c0f2919
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:37:20 2010 +0100
is_xml_data_cached, %xml_cache_time, and load_data_file are not used, removing.
diff --git a/web/modules/rhn/RHN/DB/DataSource.pm b/web/modules/rhn/RHN/DB/DataSource.pm
index 938e0f3..f2bc749 100644
--- a/web/modules/rhn/RHN/DB/DataSource.pm
+++ b/web/modules/rhn/RHN/DB/DataSource.pm
@@ -186,31 +186,6 @@ sub parse {
return $mode_data;
}
-sub is_xml_data_cached { #just for testing
- my $self = shift;
-
- return scalar keys %{$self->mode_data()};
-}
-
-my %xml_cache_time;
-
-sub load_data_file {
- my $class = shift;
- my $filename = shift;
-
- my $xml_dir = $INC{"RHN/DB/DataSource.pm"};
- $xml_dir =~ s/\.pm$/\//;
-
- my $path = File::Spec->catfile($xml_dir, 'xml');
- my $fc = RHN::Cache::File->new(-name => $filename, -directory => $path, -no_cache => 1);
-
- if ($fc->is_up2date) {
- return;
- }
-
- return $fc->contents;
-}
-
sub data_file {
my $self = shift;
commit 8dd7c15db9e15819bf3918693c363a9f74785be5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:34:08 2010 +0100
Removing bunch of unused methods from RHN::DB::Package:
package_names_by_provide
package_channel_names
source_rpm
package_fields
package_list_overview
packages_available_to_server
system_set_server_package_names
delta_canonical_lists
target_systems_in_set
diff --git a/web/modules/rhn/RHN/DB/Package.pm b/web/modules/rhn/RHN/DB/Package.pm
index 52d92e8..1fb338e 100644
--- a/web/modules/rhn/RHN/DB/Package.pm
+++ b/web/modules/rhn/RHN/DB/Package.pm
@@ -143,15 +143,6 @@ EOQ
return @ret;
}
-sub package_names_by_provide {
- my $class = shift;
- my %params = validate(@_, {org_id => 1, cap_name => 1});
-
- my $ds = new RHN::DataSource::Package(-mode => 'name_by_provide');
-
- return $ds->execute_query(-org_id => $params{org_id}, -cap_name => $params{cap_name});
-}
-
sub package_set_channels {
my $class = shift;
my $set_label = shift;
@@ -182,69 +173,6 @@ EOQ
return @ret;
}
-#grab channel names for package id.
-sub package_channel_names {
- my $class = shift;
- my $pid = shift;
- my $org_id = shift;
-
- return unless $pid;
-
- my $dbh = RHN::DB->connect;
-
- my $query = <<EOQ;
- SELECT AC.channel_name
- FROM rhnChannelPackage CP, rhnAvailableChannels AC
- WHERE AC.org_id = ?
- AND CP.package_id = ?
- AND AC.channel_id = CP.channel_id
-ORDER BY UPPER(AC.channel_name)
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id, $pid);
-
- my @ret;
-
- while (my ($data) = $sth->fetchrow) {
- push @ret, $data;
- }
-
- unless (@ret) {
- @ret = (' ');
- }
-
- return @ret;
-
-}
-
-sub source_rpm {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT SR.name
- FROM rhnSourceRPM SR
- WHERE SR.id = ?
-EOQ
-
-# warn "source rpm query:\n$query\n".$self->source_rpm_id;
-
- $sth = $dbh->prepare($query);
- $sth->execute($self->source_rpm_id);
-
- my @columns;
- my $ret;
- if(@columns = $sth->fetchrow) {
- $ret = $columns[0];
- }
- $sth->finish;
- return $ret;
-}
-
sub change_log {
my $self = shift;
@@ -605,10 +533,6 @@ sub create_package {
return $package;
}
-sub package_fields {
- return @pkg_fields;
-}
-
sub arch_fields {
return @arch_fields;
}
@@ -667,256 +591,6 @@ foreach my $field ($tc->method_names) {
croak $@ if($@);
}
-sub package_list_overview {
- my $class = shift;
- my %params = @_;
-
- my ($user_id, $lower, $upper, $total_rows, $view_mode, $mode_params, $like, $alphabar) =
- map {$params{'-'.$_}} qw/user_id lower upper total_rows view_mode mode_params like alphabar/;
- my $query;
- my @res;
- my @row;
-
- my $i = 1;
- $$total_rows = 0;
-
- my $dbh = RHN::DB->connect;
-
- if ($view_mode eq 'set') {
- $query = <<EOQ;
-SELECT
- PN.name, PE.evr.as_vre_simple(), PN.id || '|' || PE.id
-FROM
- rhnPackageName PN,
- rhnPackageEVR PE,
- rhnSet S
-WHERE S.label = ?
-AND S.user_id = ?
-AND S.element = PN.id
-AND S.element_two = PE.id
-ORDER BY UPPER(PN.name)
-EOQ
- }
- elsif ($view_mode eq 'channel') {
- $query = <<EOQ;
-SELECT
- PN.name, CPO.evr.as_vre_simple(), PN.id || '|' || LOOKUP_EVR(CPO.evr.epoch, CPO.evr.version, CPO.evr.release)
-FROM
- rhnPackageName PN,
- rhnChannelPackageOverview CPO
-WHERE
- CPO.channel_id = ?
- AND PN.id = CPO.name_id
-ORDER BY UPPER(PN.name)
-EOQ
- }
- elsif ($view_mode eq 'channel_name_search') {
- $query = <<EOQ;
-SELECT
- PN.name, CPO.evr.as_vre_simple(), PN.id || '|' || LOOKUP_EVR(CPO.evr.epoch, CPO.evr.version, CPO.evr.release)
-FROM
- rhnPackageName PN,
- rhnChannelPackageOverview CPO
-WHERE
- CPO.channel_id = ?
- AND PN.id = CPO.name_id
- AND UPPER(PN.name) LIKE UPPER(?)
-ORDER BY UPPER(PN.name)
-EOQ
- }
- elsif ($view_mode eq 'name_search') {
- $query = <<EOQ;
-SELECT
- PN.name, CPO.evr.as_vre_simple(), PN.id || '|' || LOOKUP_EVR(CPO.evr.epoch, CPO.evr.version, CPO.evr.release)
-FROM
- rhnPackageName PN,
- rhnChannelPackageOverview CPO
-WHERE
- CPO.channel_id = ?
- AND PN.id = CPO.name_id
- AND UPPER(name) LIKE UPPER(?)
-ORDER BY UPPER(name)
-EOQ
- }
- elsif ($view_mode eq 'install_action') {
- $query = <<EOQ;
-SELECT
- PN.name, PE.evr.as_vre_simple(), PN.id || '|' || PE.id
-FROM
- rhnPackageName PN,
- rhnPackageEVR PE,
- rhnActionPackage AP
-WHERE
- AP.action_id = ?
- AND PN.id = AP.name_id
- AND PE.id = AP.evr_id
-ORDER BY UPPER(name)
-EOQ
- }
- elsif ($view_mode eq 'removal_action') {
- $query = <<EOQ;
-SELECT
- PN.name, PE.evr.as_vre_simple(), PN.id || '|' || PE.id
-FROM
- rhnPackageName PN,
- rhnPackageEVR PE,
- rhnActionPackage AP
-WHERE
- AP.action_id = ?
- AND PN.id = AP.name_id
- AND PE.id = AP.evr_id
-ORDER BY UPPER(name)
-EOQ
- }
- elsif ($view_mode eq 'any_channel') {
- $query = <<EOQ;
- SELECT PN.name, PE.evr.as_vre_simple(), P.id
- FROM rhnPackageName PN, rhnPackageEVR PE, rhnPackage P
- WHERE P.org_id = ?
- AND PN.id = P.name_id
- AND PE.id = P.evr_id
-ORDER BY UPPER(PN.name)
-EOQ
- }
- elsif ($view_mode eq 'no_channels') {
- $query = <<EOQ;
- SELECT PN.name, PE.evr.as_vre_simple(), P.id
- FROM rhnPackageName PN, rhnPackageEVR PE, rhnPackage P
- WHERE P.org_id = ?
- AND PN.id = P.name_id
- AND PE.id = P.evr_id
- AND NOT EXISTS (SELECT 1
- FROM rhnChannelPackage CP
- WHERE P.id = CP.package_id)
-ORDER BY UPPER(PN.name)
-EOQ
- }
- elsif ($view_mode eq 'view_channel') {
- $query = <<EOQ;
- SELECT PN.name, PE.evr.as_vre_simple(), P.id
- FROM rhnPackageName PN, rhnPackageEVR PE, rhnPackage P, rhnChannelPackage CP
- WHERE CP.channel_id = ?
- AND P.id = CP.package_id
- AND PN.id = P.name_id
- AND PE.id = P.evr_id
-ORDER BY UPPER(PN.name)
-EOQ
- }
- else {
- croak "No supported view_mode specified, view_mode == $view_mode";
- }
-
- my $sth = $dbh->prepare($query);
- $sth->execute(@$mode_params, $like ? "%$like%" : ());
-
- my $lastalpha = '';
- while (@row = $sth->fetchrow) {
- my $alpha = lc(substr $row[0], 0, 1);
- if ($alpha ne $lastalpha) {
- $alphabar->{$alpha} = $i;
- $lastalpha = $alpha;
- }
-
- if ($i <= $upper and $i >= $lower) {
- push @res, [ @row ];
- }
- $$total_rows++;
- $i++;
- }
-
- return @res;
-}
-
-sub packages_available_to_server {
- my $class = shift;
- my $sid = shift;
- my $like = shift;
-
- my $query;
- my @res;
- my @row;
-
-# TODO: convert the hideous formatting of these queries
-
- if (defined $like and $like ne '') {
- $query = <<EOQ;
-select
- pn.name,
- full_list.evr.version || '-' || full_list.evr.release || DECODE(full_list.evr.epoch, NULL, '', ':' || full_list.evr.epoch),
- pn.id || '|' || lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release)
-from (
- select
- p.name_id name_id,
- max(pe.evr) evr
- from
- rhnPackageEVR PE,
- rhnPackage P,
- rhnChannelPackage CP,
- rhnServerChannel SC
- where
- sc.server_id = ?
- and sc.channel_id = cp.channel_id
- and cp.package_id = p.id
- and p.evr_id = pe.id
- group by
- p.name_id
- ) full_list,
- rhnPackageName pn
-where
- full_list.name_id = pn.id
- and full_list.name_id NOT IN (SELECT SP.name_id
- FROM rhnServerPackage SP
- WHERE SP.server_id = ? )
- and UPPER(PN.name) like UPPER(?)
-order by
- UPPER(pn.name)
-EOQ
- }
- else {
- $query = <<EOQ;
-select
- pn.name,
- full_list.evr.version || '-' || full_list.evr.release || DECODE(full_list.evr.epoch, NULL, '', ':' || full_list.evr.epoch),
- pn.id || '|' || lookup_evr(full_list.evr.epoch, full_list.evr.version, full_list.evr.release)
-from (
- select
- p.name_id name_id,
- max(pe.evr) evr
- from
- rhnPackageEVR PE,
- rhnPackage P,
- rhnChannelPackage CP,
- rhnServerChannel SC
- where
- sc.server_id = ?
- and sc.channel_id = cp.channel_id
- and cp.package_id = p.id
- and p.evr_id = pe.id
- group by
- p.name_id
- ) full_list,
- rhnPackageName pn
-where
- full_list.name_id = pn.id
- and full_list.name_id NOT IN (SELECT SP.name_id
- FROM rhnServerPackage SP
- WHERE SP.server_id = ? )
-order by
- UPPER(pn.name)
-EOQ
- }
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare($query);
- $sth->execute($sid, $sid, $like ? "%$like%" : ());
-
- while (my @row = $sth->fetchrow) {
- push @res, [ @row ];
- }
-
- return @res;
-}
-
sub source_rpm_path {
my $self = shift;
@@ -984,114 +658,6 @@ EOS
return @ret;
}
-sub system_set_server_package_names {
- my $class = shift;
- my %params = @_;
-
- my ($user_id, $lower, $upper, $total_rows, $all_ids) =
- map {$params{'-'.$_}} qw/user_id lower upper total_rows all_ids/;
-
- my @res;
- my $row;
-
- my $i = 1;
- $$total_rows = 0;
-
-
- my $dbh = RHN::DB->connect;
-
- # the 1 just makes life easier come pagination time, since we do a bit of post processing...
- my $query = <<EOQ;
-SELECT PN.id id, PN.name name, COUNT(SP.server_id) num_systems
- FROM rhnPackageName PN, rhnServerPackage SP, rhnSet S
- WHERE S.user_id = ?
- AND S.label = 'system_list'
- AND S.element = SP.server_id
- AND SP.name_id = PN.id
-GROUP BY PN.id, PN.name
-ORDER BY UPPER(PN.name)
-EOQ
- my $sth = $dbh->prepare($query);
-
- $sth->execute($user_id);
-
- my @ret;
- my @ids;
- while ($row = $sth->fetchrow_hashref) {
- if ($all_ids) {
- push @ids, $row->{ID};
- }
-
- if ($i <= $upper and $i >= $lower) {
- push @ret, $row;
- }
- $$total_rows++;
- $i++;
- }
-
- return (data => \@ret, ids =>\@ids);
-}
-
-
-sub delta_canonical_lists {
- my $class = shift;
- my $s1 = shift;
- my $s2 = shift;
-
- my %s1_names;
- my %s2_names;
-
- foreach my $pkg (@$s1) {
- $s1_names{$pkg->[0]} = $pkg;
- }
-
- foreach my $pkg (@$s2) {
- $s2_names{$pkg->[0]} = $pkg;
- }
-
- my @names;
- @names = keys %s1_names;
-
- foreach my $name (keys %s2_names) {
- push @names, $name
- unless exists $s1_names{$name};
- }
-
- my @data = map {
- ({ name_id => $_,
- name => $s1_names{$_}->[1] || $s2_names{$_}->[1],
- s1 => { evr_id => $s1_names{$_}->[2],
- evr => $s1_names{$_}->[3],
- epoch => $s1_names{$_}->[4],
- version => $s1_names{$_}->[5],
- release => $s1_names{$_}->[6]
- },
- s2 => { evr_id => $s2_names{$_}->[2],
- evr => $s2_names{$_}->[3],
- epoch => $s2_names{$_}->[4],
- version => $s2_names{$_}->[5],
- release => $s2_names{$_}->[6]
- },
- comparison => 0
- }) } @names;
-
- my @ret;
- foreach my $row (@data) {
- my $p1 = $s1_names{$row->{name_id}};
- my $p2 = $s2_names{$row->{name_id}};
-
- push @ret, $row
- unless $p1->[2] and $p2->[2] and
- $p1->[2] == $p2->[2];
-
- $row->{comparison} = $class->vercmp($row->{s1}->{epoch}, $row->{s1}->{version}, $row->{s1}->{release},
- $row->{s2}->{epoch}, $row->{s2}->{version}, $row->{s2}->{release})
- if $row->{s1}->{evr} and $row->{s2}->{evr};
- }
-
- return \@ret;
-}
-
sub delta_canonical_lists_hashref {
my $class = shift;
my $s1 = shift;
@@ -1188,49 +754,6 @@ sub vercmp {
}
-sub target_systems_in_set {
- my $self = shift;
- my %params = @_;
-
- my ($org_id, $user_id) =
- map { $params{"-" . $_} } qw/org_id user_id/;
-
-
- my $rhn_class = '';
- $rhn_class = 'RHN.' unless PXT::Config->get('satellite');
-
- my $query = <<EOQ;
-SELECT S.id
- FROM rhnPackage P, rhnChannelPackage CP, rhnServerChannel SC, rhnServer S
- WHERE S.org_id = ?
- AND S.id IN (SELECT element FROM rhnSet WHERE user_id = ? AND label = 'system_list')
- AND EXISTS (SELECT 1 FROM rhnUserServerPerms USP WHERE USP.user_id = ? AND USP.server_id = S.id)
- AND EXISTS (SELECT 1 FROM rhnEntitledServers ES WHERE ES.id = S.id)
- AND SC.server_id = S.id
- AND SC.channel_id = CP.channel_id
- AND CP.package_id = ?
- AND CP.package_id = P.id
- AND NVL((SELECT MAX(PE.evr)
- FROM rhnServerPackage SP, rhnPackageEvr PE
- WHERE SP.name_id = P.name_id
- AND SP.server_id = S.id
- AND SP.evr_id = PE.id), ${rhn_class}EVR_T(NULL, 0, 0))
- <
- (SELECT EVR FROM rhnPackageEVR PE WHERE PE.id = P.evr_id)
-EOQ
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id, $user_id, $user_id, $self->id);
-
- my @ret;
- while (my $row = $sth->fetchrow) {
- push @ret, $row ;
- }
-
- return @ret;
-}
-
sub org_permission_check {
my $class = shift;
my $pid = shift;
commit 0d7b0511b414a05daed5c2635ffd994df3b58963
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 15:10:29 2010 +0100
org_activation_keys is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Token.pm b/web/modules/rhn/RHN/DB/Token.pm
index 96cf778..240652e 100644
--- a/web/modules/rhn/RHN/DB/Token.pm
+++ b/web/modules/rhn/RHN/DB/Token.pm
@@ -516,16 +516,6 @@ EOQ
delete $self->{":modified:"};
}
-sub org_activation_keys {
- my $class = shift;
- my $org_id = shift;
-
- my $ds = new RHN::DataSource::General(-mode => 'activation_keys');
- my $data = $ds->execute_query(-org_id => $org_id);
-
- return @{$data};
-}
-
sub generate_random_key {
my $class = shift;
14 years, 3 months