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 {