12 commits - web/html web/modules
by Jan Pazdziora
web/html/network/systems/ssm/channels/base_channel_alteration.pxt | 50 --
web/modules/rhn/RHN/Channel.pm | 22 -
web/modules/rhn/RHN/DB/Channel.pm | 32 -
web/modules/rhn/RHN/DB/Server.pm | 107 -----
web/modules/rhn/RHN/DB/ServerActions.pm | 40 -
web/modules/rhn/RHN/DB/Set.pm | 46 --
web/modules/rhn/RHN/SatInstall.pm | 17
web/modules/sniglets/Sniglets/Channel.pm | 211 ----------
web/modules/sniglets/Sniglets/Servers.pm | 40 -
9 files changed, 565 deletions(-)
New commits:
commit 7c018be53accfb901099dae94c93f84d51ec9388
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 22:03:29 2010 +0100
Removal of sscd_base_channel_alteration made user_subscribable_base_channels unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index 19a9a2f..4403efa 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -575,38 +575,6 @@ EOQ
}
-sub user_subscribable_base_channels {
- my $self = shift;
- my %params = validate(@_, {user_id => 1, org_id => 1});
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT C.id, C.name
- FROM rhnChannel C,
- rhnUserChannel UC
- WHERE UC.user_id = :user_id
- AND UC.role = 'subscribe'
- AND UC.channel_id = C.id
- AND C.parent_channel IS NULL
- AND C.org_id = :org_id
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(user_id => $params{user_id}, org_id => $params{org_id});
-
- my @channels;
-
- while (my @row = $sth->fetchrow) {
- push @channels, [ @row ];
- }
-
- return @channels;
-}
-
sub package_groups {
my $class = shift;
my $channel_id = shift;
commit 21f29fa394037d8b9f9e9315f20f14043496f0ae
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 22:02:41 2010 +0100
Removal of sscd_base_channel_alteration made system_set_base_channels unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index 58e326b..f4174cc 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -2107,39 +2107,6 @@ sub _blank_server {
}
-sub system_set_base_channels {
- my $class = shift;
- my $user_id = shift;
-
- my $dbh = RHN::DB->connect();
- my $query;
- my $sth;
-
- $query = <<EOQ;
-SELECT C.id, C.name, COUNT(C.id)
- FROM rhnChannel C,
- rhnServerChannel SC,
- rhnSet ST
- WHERE ST.user_id = ?
- AND ST.label = 'system_list'
- AND ST.element = SC.server_id
- AND SC.channel_id = C.id
- AND C.parent_channel IS NULL
-GROUP BY C.id, C.name
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute($user_id);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-
# retrieve a server given its unique id.
sub lookup {
commit 7d344b867a1186d81b452ca8b14a8bc9e9c5a7b1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 22:00:03 2010 +0100
Removal of sscd_change_base_channels_cb made schedule_errata_cache_update unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index d3726bc..58e326b 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -2541,31 +2541,6 @@ EOS
return (\@p_added_rows, \@p_deleted_rows, $p_unchanged);
}
-sub schedule_errata_cache_update {
- my $class = shift;
-
- my $org_id = shift;
- my $sid = shift;
- my $delay = shift || 0;
-
- die "Org id and Server id required"
- unless ($org_id && $sid);
-
- my $now = RHN::Date->now->long_date;
- $delay = $delay / (24*60*60);
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-INSERT INTO rhnTaskQueue
- (org_id, task_name, task_data, priority, earliest)
-VALUES (?, 'update_server_errata_cache', ?, 0, TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') + ?)
-EOQ
-
- $sth->execute($org_id, $sid, $now, $delay);
-
- $dbh->commit;
-}
-
# eids of applicable errata for which the server does not have a
# pending update action
#
commit 40806d8b96fcc2621dd8c9105f2a6a7d40b7efaa
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:57:36 2010 +0100
Removal of sscd_change_base_channels_cb made system_set_change_base_channels unused, removing.
diff --git a/web/modules/rhn/RHN/DB/ServerActions.pm b/web/modules/rhn/RHN/DB/ServerActions.pm
index 79de043..0ccceed 100644
--- a/web/modules/rhn/RHN/DB/ServerActions.pm
+++ b/web/modules/rhn/RHN/DB/ServerActions.pm
@@ -92,46 +92,6 @@ sub remove_set_from_group {
}
-sub system_set_change_base_channels {
- my $class = shift;
- my $user_id = shift;
- my $to_defaults_ref = shift; # array of base id's to go to default RH base channel
- my $from_to_ref = shift; # array of [ from_id, to_id ]'s...
- my $transaction;
-
-
- my $dbh = $transaction || RHN::DB->connect();
-
- my $query = <<EOQ;
-BEGIN
- rhn_channel.bulk_guess_server_base_from(?, ?, ?);
-END;
-EOQ
-
- my $sth = $dbh->prepare($query);
-
- foreach my $from (@{$to_defaults_ref}) {
- $sth->execute('system_list', $user_id, $from);
- }
-
- $query = <<EOQ;
-BEGIN
- rhn_channel.bulk_server_basechange_from(?, ?, ?, ?);
-END;
-EOQ
-
- $sth = $dbh->prepare($query);
-
- foreach my $from_to (@{$from_to_ref}) {
- $sth->execute('system_list', $user_id, $from_to->[0], $from_to->[1]);
- }
-
- $dbh->commit unless $transaction;
-
- return $dbh;
-}
-
-
sub subscribe_set_to_channel {
my $class = shift;
my $set = shift;
commit 19011f94b49a1c8a17ef2d8d6ae17fd3c6276985
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:53:44 2010 +0100
Removal of sscd_change_base_channels_cb made num_proxies_in_set and num_satellites_in_set unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Set.pm b/web/modules/rhn/RHN/DB/Set.pm
index cebf2f0..98d89cd 100644
--- a/web/modules/rhn/RHN/DB/Set.pm
+++ b/web/modules/rhn/RHN/DB/Set.pm
@@ -253,52 +253,6 @@ EOQ
}
-sub num_proxies_in_set {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $query;
-
- $query = <<EOQ;
-SELECT COUNT(ST.element)
- FROM rhnProxyInfo PI,
- rhnSet ST
- WHERE ST.user_id = ?
- AND ST.label = ?
- AND ST.element = PI.server_id
-EOQ
- my $sth = $dbh->prepare($query);
- $sth->execute($self->uid, $self->label);
-
- my ($count) = $sth->fetchrow;
- $sth->finish();
-
- return $count;
-}
-
-sub num_satellites_in_set {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $query;
-
- $query = <<EOQ;
-SELECT COUNT(ST.element)
- FROM rhnSatelliteInfo SI,
- rhnSet ST
- WHERE ST.user_id = ?
- AND ST.label = ?
- AND ST.element = SI.server_id
-EOQ
- my $sth = $dbh->prepare($query);
- $sth->execute($self->uid, $self->label);
-
- my ($count) = $sth->fetchrow;
- $sth->finish();
-
- return $count;
-}
-
sub remove_scheduled_errata_for_system {
my $self = shift;
my $sid = shift;
commit 95f2dcb6c6582fc0fc201982d6fe7f110ad23597
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:51:46 2010 +0100
Removal of base_channel_alteration.pxt made rhn-sscd-base-channel-alteration and sscd_base_channel_alteration unused, removing.
diff --git a/web/modules/sniglets/Sniglets/Channel.pm b/web/modules/sniglets/Sniglets/Channel.pm
index 441b4fc..c118460 100644
--- a/web/modules/sniglets/Sniglets/Channel.pm
+++ b/web/modules/sniglets/Sniglets/Channel.pm
@@ -42,7 +42,6 @@ sub register_tags {
$pxt->register_tag('rhn-resubscribe-warning-ssm' => \&resubscribe_warning_ssm, 3);
- $pxt->register_tag('rhn-sscd-base-channel-alteration' => \&sscd_base_channel_alteration);
$pxt->register_tag('viewed_channel_name' => \&viewed_channel_name, -10);
}
@@ -71,63 +70,6 @@ sub resubscribe_warning_ssm {
-sub sscd_base_channel_alteration {
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
-
- my @system_set_base_channels = RHN::Server->system_set_base_channels($pxt->user->id);
-
- my $ds = new RHN::DataSource::System (-mode => 'systems_in_set_with_no_base_channel');
- my $systems_without_base_channel = $ds->execute_query(-user_id => $pxt->user->id);
-
- if (@{$systems_without_base_channel}) {
- unshift @system_set_base_channels, [ 0, '(none)', scalar @{$systems_without_base_channel} ];
- }
-
- $block =~ m{<base_channel>(.*?)</base_channel>}ism;
- my $channel_block = $1;
-
- my @subscribable_base_channels = RHN::Channel->user_subscribable_base_channels(user_id => $pxt->user->id,
- org_id => $pxt->user->org_id);
-
- my $no_change_opt = ['No Change', '__no_change__', 1];
- my $default_opt = [ 'Default RH Base Channel', '__default__', undef ];
- my @base_channels = map { [ $_->[1], $_->[0] ] } @subscribable_base_channels;
-
- my $channels = '';
- foreach my $base_channel (@system_set_base_channels) {
-
- my %current;
-
- my @options = ($no_change_opt);
-
- my $can_sub_ds = new RHN::DataSource::Channel(-mode => 'can_subscribe_to_default_in_set');
- my $can_sub_results = $can_sub_ds->execute_full(-user_id => $pxt->user->id);
- if (@$can_sub_results and $can_sub_results->[0]->{CHANNEL_ID}) {
- push @options, $default_opt;
- }
-
- push @options, @base_channels;
-
- my @filtered_options = grep { $_->[1] ne $base_channel->[0] } @options;
- my $drop_down_box = PXT::HTML->select(-name => "desired_base_channel_from-" . $base_channel->[0],
- -options => \@filtered_options);
-
- $current{base_channel_id} = $base_channel->[0];
- $current{base_channel_name} = $base_channel->[1];
- $current{system_count} = $base_channel->[2];
- $current{drop_down_box} = $drop_down_box;
-
- $channels .= PXT::Utils->perform_substitutions($channel_block, \%current);
- }
-
- $block =~ s{<base_channel>.*?</base_channel>}{$channels}ism;
-
- return $block;
-}
-
sub channel_gpg_key {
my $pxt = shift;
my %params = @_;
commit 5fe5f38adae6addac2a91cb2fef20392147f9ed1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:49:44 2010 +0100
Removal of user_subscribable_bases_for_system made verify_channel_arch_compat unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index 83ddca7..d3726bc 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -859,30 +859,6 @@ EOQ
return $columns[0];
}
-sub verify_channel_arch_compat {
- my $self = shift;
- my $cid = shift;
-
- throw "No cid" unless $cid;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT 1
- FROM rhnChannel C, rhnServerChannelArchCompat SCAC, rhnServer S
- WHERE S.id = :sid
- AND SCAC.server_arch_id = S.server_arch_id
- AND C.id = :cid
- AND SCAC.channel_arch_id = C.channel_arch_id
-EOQ
-
- $sth->execute_h(sid => $self->id, cid => $cid);
- my ($compat) = $sth->fetchrow;
-
- $sth->finish;
-
- return ($compat ? 1 : 0);
-}
-
# given a channel family label and server_id, return the child channels
# the server could be subscribed to, if any
sub child_channel_candidates {
commit 86fcdd268bd4831b44100c8e3066c1b79481977a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:47:48 2010 +0100
Removal of user_subscribable_bases_for_system and sscd_change_base_channels_cb made default_base_channel unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index 6632fba..83ddca7 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -859,31 +859,6 @@ EOQ
return $columns[0];
}
-#returns the default base channel, from rhnServer.arch, .os, and .release
-sub default_base_channel {
- my $self = shift;
- my $sid = (ref $self) ? $self->id : shift;
-
- my $dbh = RHN::DB->connect;
- my $default_base_id;
-
- eval {
- $default_base_id = $dbh->call_function('rhn_channel.guess_server_base', $sid);
- };
-
- if ($@) {
- my $E = $@;
-
- # if it's anything other not function not returning a value, toss
- # the exception further up the chain...
- unless ($E =~ m/ORA-06503/) {
- throw $E;
- }
- }
-
- return $default_base_id;
-}
-
sub verify_channel_arch_compat {
my $self = shift;
my $cid = shift;
commit 18cb394bf46f1907f3f11359c4818c59c0088b92
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:44:00 2010 +0100
base_channel_alteration.pxt is now replaced by /rhn/channel/ssm/BaseChannelSubscribe.do, removing.
Also removing sscd_change_base_channels_cb which was the only
place referencing base_channel_alteration.pxt, and
rhn:sscd_change_base_channels_cb which was only in base_channel_alteration.pxt,.
diff --git a/web/html/network/systems/ssm/channels/base_channel_alteration.pxt b/web/html/network/systems/ssm/channels/base_channel_alteration.pxt
deleted file mode 100644
index 859078e..0000000
--- a/web/html/network/systems/ssm/channels/base_channel_alteration.pxt
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
-<pxt-passthrough>
- <pxt-use class="Grail::Frame" />
- <pxt-use class="Sniglets::ListUtils" />
- <pxt-use class="Sniglets::Channel" />
- <pxt-use class="Sniglets::HTML" />
-
- <grail-canvas-template base="/templates/c.pxt" mode="main_canvas">
-
- <h1><img src="/img/rhn-icon-system_group.gif" alt="system set" /> System Set Manager <rhn-help href="s1-sm-systems.jsp#s2-sm-ssm" /></h1>
-
- <rhn-navi-nav prefix="system_set_manager" depth="0" file="/nav/ssm.xml" style="contentnav" />
-
-
-<h2>Base Channel Alteration</h2>
-
-<p>As a Channel Administrator, you may change the base channels your systems are subscribed to. Valid channels are either channels created by your organization, or the default Red Hat base channel for your operating system version and processor type. Systems will be unsubscribed from all channels, and subscribed to their new base channels.</p>
-
-<p><strong>This operation can have a dramatic effect on the packages and errata available to the systems, and should be used with caution.</strong></p>
-
-<rhn-sscd-base-channel-alteration>
-<pxt-form method="post">
-<table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td><strong>Current Base Channel</strong></td>
- <td align="center"><strong>Systems</strong></td>
- <td><strong>Desired Base Channel</strong></td>
- </tr>
-<base_channel>
- <tr>
- <td>{base_channel_name}</td>
- <td align="center">{system_count}</td>
- <td>{drop_down_box}</td>
- </tr>
-</base_channel>
-</table>
-
-<div align="right">
-<hr />
-
-<input type="submit" value="Change Base Channels" />
-<input type="hidden" name="pxt:trap" value="rhn:sscd_change_base_channels_cb" />
-</div>
-
-</pxt-form>
-</rhn-sscd-base-channel-alteration>
-
- </grail-canvas-template>
-
-</pxt-passthrough>
diff --git a/web/modules/sniglets/Sniglets/Channel.pm b/web/modules/sniglets/Sniglets/Channel.pm
index 69e238a..441b4fc 100644
--- a/web/modules/sniglets/Sniglets/Channel.pm
+++ b/web/modules/sniglets/Sniglets/Channel.pm
@@ -51,7 +51,6 @@ sub register_callbacks {
my $pxt = shift;
# sscd
- $pxt->register_callback('rhn:sscd_change_base_channels_cb' => \&sscd_change_base_channels_cb);
$pxt->register_callback('rhn:sscd_alter_channel_membership_cb' => \&sscd_alter_channel_membership_cb);
$pxt->register_callback('rhn:globally_subscribable_cb' => \&globally_subscribable_cb);
}
@@ -72,158 +71,6 @@ sub resubscribe_warning_ssm {
-sub sscd_change_base_channels_cb {
- my $pxt = shift;
-
- my $set = new RHN::DB::Set 'system_list', $pxt->user->id;
-
- my $count_proxies = $set->num_proxies_in_set();
- my $count_sats = $set->num_satellites_in_set();
-
- my $sats_or_proxies_in_set;
-
- if ($count_proxies + $count_sats > 0 ) {
- $sats_or_proxies_in_set = 1;
- }
-
- my @dest_values = grep { /desired_base_channel_from-/ } $pxt->param();
-
- my @from_to;
- my @to_defaults;
-
- # all the non-default channel ids...
- my %ids = map { $pxt->dirty_param($_) =~ m/\d/ ? ($_ => $pxt->dirty_param($_)) : () } @dest_values;
-
- # make sure I'm allowed to see the destination channels (other than red hat default...)
- die "no access to channels: " . join(", ", values %ids) unless $pxt->user->verify_channel_access(values %ids);
-
- my $will_be_ignored = 0;
- my $orphan_destination;
- foreach my $dest (@dest_values) {
- my $from_id = (split( /[-]/, $dest))[-1];
-
- # verification of values happened above...
- my $to_id = $pxt->dirty_param($dest);
-
- next unless $to_id;
-
- # ignore __no_change__ and __default__ values for now...
- if ($from_id == 0 and ($to_id ne '__no_change__')) {
- $orphan_destination = $to_id;
- }
- elsif ($to_id =~ m/\d/) {
- push @from_to, [ $from_id, $to_id ];
- }
- elsif ($to_id eq '__default__') {
- push @to_defaults, $from_id;
- }
- }
-
- my $subscribe_perms_error_msg = <<EOM;
-You no longer have subscription access to some of the channels you selected.<br />
-Please review your selections and try again.
-EOM
-
- if (not $pxt->user->verify_channel_subscribe(map { $_->[1] } @from_to)) {
- $pxt->push_message(local_alert => $subscribe_perms_error_msg);
- $pxt->redirect("/network/systems/ssm/channels/base_channel_alteration.pxt");
- }
-
- my $ds = new RHN::DataSource::System (-mode => 'systems_in_set_with_no_base_channel');
- my $systems_without_base_channel = $ds->execute_query(-user_id => $pxt->user->id);
-
- my $base_not_found;
- my $incompatible_base = 0;
-
- my $transaction = RHN::DB->connect();
-
- eval {
- if (@{$systems_without_base_channel} and $orphan_destination) {
- foreach my $sid (map { $_->{ID} } @{$systems_without_base_channel}) {
- my $server = RHN::Server->lookup(-id => $sid);
-
- # don't mess w/ satellites or proxies...
- if ($server->is_satellite() or $server->is_proxy()) {
- next;
- }
-
- my $cid = $orphan_destination;
- if ($cid eq '__default__') {
- $cid = $server->default_base_channel;
- }
-
- if ($cid) {
-
- if ($pxt->user->verify_channel_subscribe($cid) and $server->verify_channel_arch_compat($cid)) {
- $transaction = $server->subscribe_to_channel($cid, $transaction);
- }
- elsif (not $pxt->user->verify_channel_subscribe($cid)) {
- throw '(no_subscribe_permissions)';
- }
- else {
- $incompatible_base++;
- }
- }
- else {
- $base_not_found = 1;
- }
- }
- }
-
- RHN::ServerActions->system_set_change_base_channels($pxt->user->id,
- \@to_defaults,
- \@from_to,
- $transaction);
-
- # this probably snapshots some systems in the set that aren't needed.
- # it'll be nice if and when snapshot_server is smart enough to not do anything
- # if it's not needed...
- RHN::Server->snapshot_set(-reason => "Base channel change",
- -set_label => 'system_list',
- -user_id => $pxt->user->id);
- };
-
- if ($@) {
- my $E = $@;
- if (ref $E and $E->is_rhn_exception('channel_family_no_subscriptions')) {
- $transaction->rollback();
- $pxt->push_message(local_alert => "This operation would exceed your allowed subscriptions in one or more channels; no changes made.");
- $pxt->redirect('/network/systems/ssm/channels/base_channel_alteration.pxt');
- }
- elsif (ref $E and $E->is_rhn_exception('no_subscribe_permissions')) { ### FIXME!!!!
- # whole transaction borks?
- $transaction->rollback();
- $pxt->push_message(local_alert => $subscribe_perms_error_msg);
- $pxt->redirect('/network/systems/ssm/channels/base_channel_alteration.pxt');
- }
- else {
- $transaction->rollback();
- throw $E;
- }
- }
- else {
- $transaction->commit();
- }
-
- my $system_set = new RHN::DB::Set 'system_list', $pxt->user->id;
- my @servers = $system_set->contents;
-
- foreach my $sid (@servers) {
- RHN::Server->schedule_errata_cache_update($pxt->user->org_id, $sid, 0);
- }
-
- # message to the user...
- $pxt->push_message(site_info => "Channel changes submitted.");
-
- $pxt->push_message(site_info => 'Note: RHN Proxy and ' . PXT::Config->get("product_name") . ' systems may not be changed from their base channel.') if $sats_or_proxies_in_set;
-
- $pxt->push_message(site_info => 'Note: Some systems could not find their default Red Hat base channel and remain unaltered.') if $base_not_found;
-
- $pxt->push_message(site_info => 'Note: Some systems did not change channel subscription because the base channel selected was not compatible with their system architecture.') if $incompatible_base;
-
- $pxt->redirect('/network/systems/ssm/channels/base_channel_alteration.pxt');
-}
-
sub sscd_base_channel_alteration {
my $pxt = shift;
my %params = @_;
commit 08166f363f494199588e80c046a306402fda2863
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:34:29 2010 +0100
Removal of system_base_channel_select made user_subscribable_bases_for_system unused, removing.
diff --git a/web/modules/rhn/RHN/Channel.pm b/web/modules/rhn/RHN/Channel.pm
index a7c6f56..e95d86f 100644
--- a/web/modules/rhn/RHN/Channel.pm
+++ b/web/modules/rhn/RHN/Channel.pm
@@ -36,26 +36,4 @@ sub lookup {
}
}
-sub user_subscribable_bases_for_system {
- my $class = shift;
- my $system = shift;
- my $user = shift;
-
- my $ds = new RHN::DataSource::Channel(-mode => 'base_channels_owned_by_org');
- my $channels = $ds->execute_query(-org_id => $user->org_id);
- my @ret = @$channels;
-
- my $default_base = $system->default_base_channel;
- if (defined $default_base) {
- my $channel = RHN::Channel->lookup(-id => $default_base);
- unshift @ret, { map { uc $_ => $channel->$_() } qw/id name label/ };
- }
-
- # filter out the channels a user doesn't have access to...
- @ret = grep { $user->verify_channel_subscribe($_->{ID}) } @ret;
- @ret = grep { $system->verify_channel_arch_compat($_->{ID}) } @ret;
-
- return @ret;
-}
-
1;
commit 740456397fffb46847dfb2f3a2492ab521e9c497
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:32:54 2010 +0100
rhn-system-base-channel-select is not used, removing, as well as system_base_channel_select.
diff --git a/web/modules/sniglets/Sniglets/Servers.pm b/web/modules/sniglets/Sniglets/Servers.pm
index 0308b0c..d383b5e 100644
--- a/web/modules/sniglets/Sniglets/Servers.pm
+++ b/web/modules/sniglets/Sniglets/Servers.pm
@@ -72,8 +72,6 @@ sub register_tags {
$pxt->register_tag('rhn-server-history-event-details' => \&server_history_event_details);
- $pxt->register_tag('rhn-system-base-channel-select' => \&system_base_channel_select);
-
$pxt->register_tag('rhn-proxy-entitlement-form' => \&proxy_entitlement_form);
$pxt->register_tag('rhn-system-pending-actions-count' => \&system_pending_actions_count);
@@ -1050,44 +1048,6 @@ sub server_prefs_form_cb {
}
}
-sub system_base_channel_select {
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
- my $sid = $pxt->param('sid');
-
- die "No Server id!"
- unless $sid;
-
- my $server = RHN::Server->lookup(-id => $sid);
-
- my $current_base_id = $server->base_channel_id || 0;
-
- if ($current_base_id and not $pxt->user->verify_channel_subscribe($current_base_id)) {
- $pxt->pnotes(resubscribe_base_warning => 1);
- }
-
- my @channels = RHN::Channel->user_subscribable_bases_for_system($server, $pxt->user);
-
- unshift @channels, { ID => 0, NAME => "(none, disable service)", LABEL => "(none)" };
-
- my @options;
-
- foreach my $channel (@channels) {
- my $selected = '';
-
- if ($channel->{ID} == $current_base_id) {
- $selected = '1';
- }
-
- push @options, [ PXT::Utils->escapeHTML($channel->{NAME} || ''), $channel->{ID}, $selected ];
- }
-
- return PXT::HTML->select(-name => "system_base_channel",
- -options => \@options);
-}
-
sub delete_servers_cb {
my $pxt = shift;
commit 808db83e7a1e8d0684d1c445aa218852fef743fa
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:31:32 2010 +0100
enable_notification_cron and disable_notification_cron are not used in our code base, removing.
diff --git a/web/modules/rhn/RHN/SatInstall.pm b/web/modules/rhn/RHN/SatInstall.pm
index 2d14241..814ee6a 100644
--- a/web/modules/rhn/RHN/SatInstall.pm
+++ b/web/modules/rhn/RHN/SatInstall.pm
@@ -128,21 +128,4 @@ sub generate_server_cert {
return $ret;
}
-sub enable_notification_cron {
- my $class = shift;
-
- my $ret = system('/usr/bin/sudo', 'ln', '-s', '/opt/notification/cron/notification',
- '/etc/cron.d/notification');
-
- return;
-}
-
-sub disable_notification_cron {
- my $class = shift;
-
- my $ret = system('/usr/bin/sudo', 'rm', '/etc/cron.d/notification');
-
- return;
-}
-
1;
14 years, 3 months
web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Probes.pm | 112 --------------------------------
1 file changed, 112 deletions(-)
New commits:
commit 6e475b9f0637df0684002358691b62cddbdc9f42
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:23:40 2010 +0100
Removal of probe_state_summary.pxi made rhn-probe-state-summary and probe_state_summary unused, removing.
diff --git a/web/modules/sniglets/Sniglets/Probes.pm b/web/modules/sniglets/Sniglets/Probes.pm
index f862215..89ae68f 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -40,116 +40,4 @@ use PXT::HTML;
use Sniglets::Forms;
use Sniglets::Navi::Style;
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag("rhn-probe-state-summary", \&probe_state_summary);
-}
-
-
-sub probe_state_summary {
- my $pxt = shift;
- my %params = @_;
-
- # my $ds = new RHN::DataSource::Simple(-querybase => 'probe_queries', -mode => 'probe_state_summary');
- my $ds = new RHN::DataSource::Simple(-querybase => 'probe_queries', -mode => 'probe_state_count_by_state_and_user');
-
- my $probe_state_summary = { total => 0 };
-
-
- my @states = qw/ok warning critical unknown pending/;
-
- # process the data looking for states that we recognize and rolling up the total
- # number of probes configured.
- foreach my $state (@states) {
- my $data = $ds->execute_query(-user_id => $pxt->user->id, -state => uc($state));
- foreach my $row (@{$data}) {
- $probe_state_summary->{$state} = $row->{STATE_COUNT};
- $probe_state_summary->{total} += $row->{STATE_COUNT};
- }
- }
-
- my @probe_state_display = (
- { label => 'critical',
- name => 'Critical',
- icon => '/img/rhn-mon-down.gif',
- value => ($probe_state_summary->{critical} || 0),
- mode => 'critical' },
- { label => 'warning',
- name => 'Warning',
- icon => '/img/rhn-mon-warning.gif',
- value => ($probe_state_summary->{warning} || 0),
- mode => 'warning' },
- { label => 'unknown',
- name => 'Unknown',
- icon => '/img/rhn-mon-unknown.gif',
- value => ($probe_state_summary->{unknown} || 0),
- mode => 'unknown' },
- { label => 'pending',
- name => 'Pending',
- icon => '/img/rhn-mon-pending.gif',
- value => ($probe_state_summary->{pending} || 0),
- mode => 'pending' },
- { label => 'ok',
- name => 'OK',
- icon => '/img/rhn-mon-ok.gif',
- value => ($probe_state_summary->{ok} || 0),
- mode => 'ok' },
- { label => 'all',
- name => 'All',
- value => $probe_state_summary->{total},
- mode => 'all' },
- );
-
- if (($probe_state_summary->{total} == 0) and (not defined $params{no_probes_message})) {
- return;
- }
-
- my $navbar = Sniglets::Navi::Style->new('contentnav');
-
- my $level = 0;
- my $html .= $navbar->pre_nav;
- $html .= $navbar->pre_level($level);
- my $selected_mode = $params{"selected_mode"};
-
- foreach my $attrib (@probe_state_display) {
- my $active = ((defined $selected_mode) and ($selected_mode =~ /^$attrib->{mode}/));
- my $link_style = $active ? $navbar->link_style_active($level) : $navbar->link_style($level);
- my $mode_url = $params{"link_url"};
- $mode_url =~ s/\{mode\}/$attrib->{mode}/eg;
-
- my $link_content;
- if (defined $attrib->{icon}) {
- $link_content .= "<span class=\"toolbar\">";
- $link_content .= PXT::HTML->img( -src => $attrib->{icon} );
- #leave out alt and title since the text is right next to it.
- #, -alt => $attrib->{name}, -title => $attrib->{name} );
- $link_content .= "</span>";
- }
- $link_content .= $attrib->{name} . " (" . $attrib->{value} . ")";
-
- $html .= $navbar->pre_item($pxt, $active, $level);
-
- $html .= PXT::HTML->link($mode_url, $link_content, $link_style);
-
- $html .= $navbar->post_item;
-
- }
-
- if ($probe_state_summary->{total} == 0) {
- my $msg = $params{no_probes_message};
-
- $html .= <<EOQ;
-<li class="graydata"><strong>$msg</strong></li>
-EOQ
- }
-
- $html .= $navbar->post_level;
- $html .= $navbar->post_nav($pxt);
-
- return $html;
-}
-
-
1;
14 years, 3 months
2 commits - web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Packages.pm | 6 -
web/modules/sniglets/Sniglets/Servers.pm | 129 ------------------------------
2 files changed, 135 deletions(-)
New commits:
commit f85f99fdf74e254638375fa382a745ed2ed4e963
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:18:14 2010 +0100
Removal of package_search_form made search_arch_list unused, removing.
diff --git a/web/modules/sniglets/Sniglets/Packages.pm b/web/modules/sniglets/Sniglets/Packages.pm
index 126bf64..6304ac9 100644
--- a/web/modules/sniglets/Sniglets/Packages.pm
+++ b/web/modules/sniglets/Sniglets/Packages.pm
@@ -336,12 +336,6 @@ sub package_details {
return PXT::Utils->perform_substitutions($ret, \%subst);
}
-sub search_arch_list {
- my $class = shift;
-
- return ['ia32', 'IA-32'], ['ia64', 'IA-64'], ['x86_64', 'AMD64']
-}
-
sub raw_pkgmap {
my $pxt = shift;
commit ccfb9e6af1786286cd889bae0d3d1f6ed31ab4d8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:13:10 2010 +0100
base_entitlement_box, addon_entitlement_box, and store_bounce not referenced, removing.
diff --git a/web/modules/sniglets/Sniglets/Servers.pm b/web/modules/sniglets/Sniglets/Servers.pm
index 3d287a5..0308b0c 100644
--- a/web/modules/sniglets/Sniglets/Servers.pm
+++ b/web/modules/sniglets/Sniglets/Servers.pm
@@ -613,48 +613,6 @@ sub base_entitlement {
}
}
-sub base_entitlement_box {
- my $pxt = shift;
- my $server = shift;
-
- my ($base_entitlement) = grep { $_->{IS_BASE} eq 'Y' } $server->entitlements;
-
- $base_entitlement ||= { LABEL => 'none',
- PERMANENT => 'N' };
-
- if ($base_entitlement->{PERMANENT} eq 'Y') {
- return $pxt->user->org->slot_name($base_entitlement->{LABEL});
- }
-
- my @all_entitlements = RHN::Entitlements->valid_system_entitlements_for_org($pxt->user->org_id);
- my @allowed_entitlements = grep { $_->{IS_BASE} eq 'Y' and
- ( $_->{LABEL} eq $base_entitlement->{LABEL} or
- $server->can_switch_base_entitlement($_->{LABEL})
- )
- } @all_entitlements;
-
- my @options = ( map { {label => $pxt->user->org->slot_name($_->{LABEL}),
- value => $_->{LABEL}},
- } @allowed_entitlements);
-
- if ($base_entitlement->{LABEL} eq 'none') {
- unshift @options,
- { label => 'None',
- value => 'none' };
- }
- else {
- unshift @options,
- { label => 'Unentitle System',
- value => 'unentitle' };
- }
-
- my $selectbox = new RHN::Form::Widget::Select (name => 'Base Entitlement',
- label => 'base_entitlement',
- default => $base_entitlement->{LABEL},
- options => \@options);
- return $selectbox->render;
-}
-
sub addon_entitlements {
my $pxt = shift;
my $server = shift;
@@ -671,52 +629,6 @@ sub addon_entitlements {
return join(", ", @addon_entitlements);
}
-sub addon_entitlement_box {
- my $pxt = shift;
- my $server = shift;
-
- my @system_entitlements = $server->entitlements;
- my ($base_entitlement) = grep { $_->{IS_BASE} eq 'Y' } @system_entitlements;
- my %addon_entitlements = map { ($_->{LABEL}, $_) }
- grep { $_->{IS_BASE} eq 'N' } @system_entitlements;
-
- if (not $base_entitlement) {
- return "A system must have a base entitlement to have add-on entitlements.";
- }
-
- my @all_entitlements = RHN::Entitlements->valid_system_entitlements_for_org($pxt->user->org_id);
- my %allowed_entitlements = map { ($_->{LABEL}, $_) }
- grep { $_->{IS_BASE} eq 'N' and
- $server->can_entitle_server($_->{LABEL}) } @all_entitlements;
-
- my @options;
- my @selected;
-
- foreach my $ent (@all_entitlements) {
- if (exists $addon_entitlements{$ent->{LABEL}} or
- exists $allowed_entitlements{$ent->{LABEL}}) {
- my $disabled = (exists $addon_entitlements{$ent->{LABEL}} and
- $ent->{PERMANENT} eq 'Y') ? 1 : 0;
-
- push @options, { label => $pxt->user->org->slot_name($ent->{LABEL}),
- value => $ent->{LABEL},
- disabled => $disabled };
- push(@selected, $ent->{LABEL}) if exists $addon_entitlements{$ent->{LABEL}};
- }
- }
-
- unless (@options) {
- return "No add-on entitlements available.";
- }
-
- my $boxes = new RHN::Form::Widget::CheckboxGroup (name => 'Add-On Entitlements',
- label => 'addon_entitlements',
- default => \@selected,
- options => \@options);
-
- return join("<br/>\n", $boxes->render);
-}
-
sub reboot_server_cb {
my $pxt = shift;
my $sid = $pxt->param('sid');
@@ -1190,47 +1102,6 @@ sub delete_servers_cb {
$pxt->redirect('/rhn/systems/Overview.do?empty_set=true&return_url=/rhn/systems/Overview.do?' . $message);
}
-sub store_bounce {
- my $pxt = shift;
- my %params = @_;
-
- my $ret = $params{__block__};
-
- # A bit of an ugly and hurried loop here, but it'll work.
-
- my @ent_types = ('sw_mgr_', 'enterprise_');
- my $ent_type;
-
- foreach $ent_type (@ent_types) {
- my $eg = $ent_type . "entitled";
- my ($server_count, $entitled_server_count, $entitlement_count) = $pxt->user->org->entitlement_gap($eg);
- my $recommend = $server_count - $entitlement_count;
- $recommend = int($recommend/5 + 1) * 5;
- $recommend = 5 if $recommend < 5;
-
- my $remaining = $entitlement_count - $entitled_server_count;
- $remaining = 0 if $remaining < 0;
-
- my $rq = $ent_type . 'recommend_quantity';
- my $edc = $ent_type . 'entitled_count';
- my $etc = $ent_type . 'entitlement_count';
- my $er = $ent_type . 'entitlement_remaining';
-
- $ret =~ s/\{$rq\}/$recommend/gms;
-
- $ret =~ s/\{$edc\}/$entitled_server_count/gms;
- $ret =~ s/\{$etc\}/defined $entitlement_count ? $entitlement_count : '(unlimited)'/egms;
- $ret =~ s/\{$er\}/defined $entitlement_count ? $remaining : '(unlimited)'/egms;
-
- $ret =~ s/\{quantity\}/$pxt->param('quantity') || 5/egms;
-
- $ret =~ s/\{rhn_$_\}/$pxt->dir_config("rhn_$_")/egsmi
- foreach qw/item_code store_url/;
- }
-
- return $ret;
-}
-
sub system_activation_key_form {
my $pxt = shift;
my %attr = @_;
14 years, 3 months
5 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB.pm | 13 -
web/modules/rhn/RHN/SatInstall.pm | 336 -------------------------------------
web/modules/rhn/RHN/ServerGroup.pm | 8
3 files changed, 357 deletions(-)
New commits:
commit 665c076856959c6e7ee2024c3a9aa437e0bdd35e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:10:27 2010 +0100
lookup_server_group is not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/ServerGroup.pm b/web/modules/rhn/RHN/ServerGroup.pm
index efcf4b7..01baf09 100644
--- a/web/modules/rhn/RHN/ServerGroup.pm
+++ b/web/modules/rhn/RHN/ServerGroup.pm
@@ -43,12 +43,4 @@ sub lookup {
}
}
-sub lookup_server_group {
- my $class = shift;
-
- warn "deprecated use of $class->lookup_foo from (" . join(', ', caller) . "). Using $class->lookup instead\n";
-
- return $class->lookup(@_);
-}
-
1;
commit 7b926862f9c75f5e64da5a76ab5c4a9ab5b11ac2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:05:52 2010 +0100
Removal of restart_satellite made prepare_for_fork unused, removing.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm
index cdddc90..af7c0e5 100644
--- a/web/modules/rhn/RHN/DB.pm
+++ b/web/modules/rhn/RHN/DB.pm
@@ -89,19 +89,6 @@ sub apache_child_init_handler {
}
}
-# DBD::Oracle handles don't survive forks well if you don't
-# immediately exec or somesuch. so this is what we call when we know
-# we're going to fork
-
-sub prepare_for_fork {
- my $class = shift;
-
- for my $handle (grep { defined $_ } values %handles) {
- $handle->force_disconnect;
- }
- %handles = ();
-}
-
# called after every request. necessary to cleanup uncommitted
# transactions and such
commit 4db7b05802434e8ab61876ebfa8907b69191ed52
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:04:51 2010 +0100
Removal of Sniglets::MonitoringConfig made restart_satellite unused, removing.
diff --git a/web/modules/rhn/RHN/SatInstall.pm b/web/modules/rhn/RHN/SatInstall.pm
index cffe405..2d14241 100644
--- a/web/modules/rhn/RHN/SatInstall.pm
+++ b/web/modules/rhn/RHN/SatInstall.pm
@@ -128,29 +128,6 @@ sub generate_server_cert {
return $ret;
}
-sub restart_satellite {
- my $class = shift;
- my %params = validate(@_, { delay => 1,
- service => { default => 'rhn-satellite' },
- });
-
- RHN::DB->prepare_for_fork();
- # we fork here. the original process returns and sends content to
- # the client so the page renders. the child will quickly terminate...
- return if fork;
-
- # sleep to let the parent process cleanup
- sleep $params{delay};
- # when apache restarts, it sends a kill to its entire process group.
- # for us, though, that would include the restart script. oops.
- POSIX::setsid();
-
- exec('/usr/bin/sudo', '/usr/sbin/rhn-satellite', 'restart')
- or throw "(exec_error) Could not exec '/usr/sbin/rhn-satellite restart': $!";
-
- # exec does not return
-}
-
sub enable_notification_cron {
my $class = shift;
commit f2e7c180146506fc6048cbe5cdebaaef4a9033a0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 21:03:19 2010 +0100
Removing some more functions from RHN::SatInstall, that are duplicated in spacewalk-setup now:
is_embedded_db
local_sat_cert_checks
generate_ca_cert
is_rpm_installed
default_cert_expiration
diff --git a/web/modules/rhn/RHN/SatInstall.pm b/web/modules/rhn/RHN/SatInstall.pm
index beacb8e..cffe405 100644
--- a/web/modules/rhn/RHN/SatInstall.pm
+++ b/web/modules/rhn/RHN/SatInstall.pm
@@ -85,93 +85,10 @@ sub write_config {
return;
}
-sub is_embedded_db {
- my $class = shift;
-
- return $class->is_rpm_installed('oracle-server-admin');
-}
-
sub generate_secret {
return md5_hex(PXT::Utils->random_bits(4096));
}
-sub local_sat_cert_checks {
- my $filename = shift;
- my $check_monitoring = shift;
-
- open(CERT, $filename) or throw "(satellite_activation_failed) File upload error: $OS_ERROR";
- my @data = <CERT>;
- close(CERT);
-
- my $cert_str = join('', @data);
- my ($signature, $cert);
-
- eval {
- ($signature, $cert) = RHN::SatelliteCert->parse_cert($cert_str);
- };
- if ($@) {
- throw "(parse_error) Error parsing satellite cert: $@";
- }
-
- my $sat_version = PXT::Config->get('version');
- my $cert_version = $cert->get_field('satellite-version');
-
- #The cert version should be less specific than the sat version.
- my $match_length = length($cert_version);
- $sat_version = substr($sat_version, 0, $match_length);
- unless ($sat_version eq $cert_version) {
- throw "(satellite_activation_failed) The version of the supplied cert ($cert_version)"
- . " did not match the version of this satellite ($sat_version)";
- }
-
- my $mon_slots = $cert->get_field('monitoring-slots');
-
- if ($check_monitoring and not $mon_slots) {
- throw "(no_monitoring_entitlements) You have provided a certificate that does not contain monitoring entitlements.";
- }
-
- return;
-}
-
-my %ca_cert_opts = (
- dir => 1,
- password => 1,
- 'set-country' => 1,
- 'set-state' => 1,
- 'set-city' => 1,
- 'set-org' => 1,
- 'set-org-unit' => 1,
- 'set-common-name' => 0,
- 'cert-expiration' => 1, # In years
-);
-
-my @unquoted_cert_opts = qw/cert-expiration set-country dir set-hostname/;
-
-sub generate_ca_cert {
- my $class = shift;
- my %params = validate(@_, {
- %ca_cert_opts,
- 'server-rpm' => 1,
- });
-
- $params{'cert-expiration'} *= 365;
-
- my @opts = "--gen-ca";
-
- foreach my $name (keys %params) {
- next unless ($params{$name}
- and exists $ca_cert_opts{$name});
-
- push @opts, qq(--$name=$params{$name});
- }
-
- my @command = ('/usr/bin/rhn-sudo-ssl-tool', @opts);
-
- my $ret = system(@command);
-
- return $ret;
-}
-
my %server_cert_opts = (
dir => 1,
password => 1,
@@ -234,30 +151,6 @@ sub restart_satellite {
# exec does not return
}
-sub is_rpm_installed {
- my $class = shift;
- my $rpmname = shift;
-
- throw "(satinstall:missing_param) No rpm name param" unless $rpmname;
-
- # If the return code from rpm -q <rpmname> is nonzero, then the RPM was not found.
- my $ret = system('rpm', '-q', $rpmname);
-
- if ($ret) {
- return 0;
- }
-
- return 1;
-}
-
-sub default_cert_expiration {
- my $dt = DateTime->now;
- my $dt2 = new DateTime (year => 2038, month => 1, day => 18);
- my $diff = $dt2 - $dt;
-
- return $diff->years - 1;
-}
-
sub enable_notification_cron {
my $class = shift;
commit 613967992050ccaa2064294fda023801d28388e3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:57:38 2010 +0100
Removing bunch of unused functions from RHN::SatInstall:
config_up2date
db_population_in_progress
build_proxy_url
build_rhn_url
check_valid_ssl_cert_password
generate_bootstrap_scripts
write_satellite_cert
get_db_population_log_stats
setup_monitoring_sysv_step
get_db_population_errors
diff --git a/web/modules/rhn/RHN/SatInstall.pm b/web/modules/rhn/RHN/SatInstall.pm
index 67539cc..beacb8e 100644
--- a/web/modules/rhn/RHN/SatInstall.pm
+++ b/web/modules/rhn/RHN/SatInstall.pm
@@ -85,76 +85,12 @@ sub write_config {
return;
}
-sub config_up2date {
- my $class = shift;
- my %params = validate(@_, { http_proxy => 0,
- http_proxy_username => 0,
- http_proxy_password => 0,
- });
-
- my $up2date_opts = { enableProxy => ($params{http_proxy} ? '1' : '0'),
- httpProxy => $params{http_proxy},
- enableProxyAuth => ($params{http_proxy_username} ? '1' : '0'),
- proxyUser => $params{http_proxy_username},
- proxyPassword => $params{http_proxy_password},
- };
-
- $class->write_config($up2date_opts, '/etc/sysconfig/rhn/up2date');
-
- # swallow the exception - the only good reason for this to fail if
- # the previous command succeeded is that we are running an up2date
- # client that doesn't have seperate configs for rhn_regsiter.
- eval {
- $class->write_config($up2date_opts, '/etc/sysconfig/rhn/rhn_register');
- };
-
- return;
-}
-
sub is_embedded_db {
my $class = shift;
return $class->is_rpm_installed('oracle-server-admin');
}
-sub db_population_in_progress {
- my $class = shift;
-
- return (-e '/var/lock/subsys/rhn-satellite-db-population' ? 1 : 0);
-}
-
-sub build_proxy_url {
- my ($url, $user, $pass) = @_;
-
- return unless $url;
-
- $url =~ m|^((https?)://)?(.*)|;
- my $proto = $2 || 'http';
- my $rest = $3;
-
- throw "Could not parse url '$url'\n"
- unless $rest;
-
- my $ret;
-
- if ($user) {
- $ret = sprintf('%s://%s:%s@%s', $proto, $user, $pass, $rest);
- }
- else {
- $ret = sprintf('%s//%s', $proto, $rest);
- }
-
- return $ret;
-}
-
-sub build_rhn_url {
- my ($host, $ssl) = @_;
-
- my $proto = $ssl ? 'https' : 'http';
-
- return sprintf('%s://%s/XMLRPC', $proto, $host);
-}
-
sub generate_secret {
return md5_hex(PXT::Utils->random_bits(4096));
}
@@ -197,19 +133,6 @@ sub local_sat_cert_checks {
return;
}
-sub check_valid_ssl_cert_password {
- my $class = shift;
- my $password = shift;
-
- my $ret;
-
- if ($password =~ /([\t\r\n\f\013&+%\'\`\\\"=\#)])/) {
- $ret = $1;
- }
-
- return $ret;
-}
-
my %ca_cert_opts = (
dir => 1,
password => 1,
@@ -288,97 +211,6 @@ sub generate_server_cert {
return $ret;
}
-my $valid_bootstrap_params = {
- hostname => 1,
- "ssl-cert" => 1,
- "http-proxy" => 0,
- "http-proxy-username" => 0,
- "http-proxy-password" => 0,
- "no-ssl" => 0,
- "no-gpg" => 0,
- "allow-config-actions" => 0,
- "allow-remote-commands" => 0,
- overrides => 1,
- script => 1,
- };
-
-sub generate_bootstrap_scripts {
- my $class = shift;
- my %params = validate(@_, $valid_bootstrap_params);
-
- my @opts;
-
- foreach my $key (keys %{$valid_bootstrap_params}) {
- if (grep { $key eq $_ } qw/no-ssl no-gpg allow-config-actions allow-remote-commands/) {
-
- push @opts, "--$key" if ($params{$key});
- next;
- }
-
- if (not $params{$key}) {
- next;
- }
-
- push @opts, sprintf('--%s=%s', $key, $params{$key});
- }
-
- my $ret = system('/usr/bin/sudo', '/usr/bin/rhn-bootstrap', @opts);
-
- my %retcodes = (
- 10 => 'A script with that name already exists',
- 11 => 'Invalid script name',
- 12 => 'Invalid arguments',
- 13 => 'Could not parse httpd proxy URL',
- 14 => 'Cannot find pub tree',
- 15 => 'The hostname was not valid',
- 16 => 'Could not find the CA certificate',
- 17 => 'Could not find GPG key',
- );
-
- if ($ret) {
- my $exit_value = $? >> 8;
- throw "(bootstrap_script_creation_failed) $retcodes{$exit_value}" if exists $retcodes{$exit_value};
-
- throw "There was a problem generating the bootstrap scripts: $exit_value";
- }
-
- return;
-}
-
-sub write_satellite_cert {
- my $class = shift;
- my %params = validate(@_, {contents => 1});
-
- my $contents = $params{contents} || '';
- my $filename = "/tmp/satcert_${PID}";
-
- open(FH, ">$filename") or die "Could not open $filename for writing: $OS_ERROR";
-
- print FH $contents;
-
- close(FH);
-
- return $filename;
-}
-
-sub get_db_population_log_stats {
- my $class = shift;
- my $file = shift || DEFAULT_DB_POP_LOG_FILE;
-
- my $ret = {};
- if (not (-r $file)) {
- $ret->{$_} = '' foreach (qw/file_size/);
- return $ret;
- }
-
- my @stats = stat $file;
-
- $ret->{file_size} = $stats[7];
- $ret->{percent_complete} = int(100 * $ret->{file_size} / DB_POP_LOG_SIZE);
-
- return $ret;
-}
-
sub restart_satellite {
my $class = shift;
my %params = validate(@_, { delay => 1,
@@ -402,44 +234,6 @@ sub restart_satellite {
# exec does not return
}
-my @valid_sysv_steps = qw/Monitoring MonitoringScout/;
-
-sub setup_monitoring_sysv_step {
- my $class = shift;
- my $step = shift;
- my $command = shift || 'install';
-
- throw "No step name given" unless $step;
- throw "Invalid step: '$step'"
- unless (grep { $step eq $_ } @valid_sysv_steps);
-
- my $ret = system('/usr/bin/sudo', '/etc/rc.d/np.d/step', $step, $command);
-
- if ($ret) {
- throw "There was a problem starting the monitoring backend. "
- . 'See the webserver error log for details.';
- }
-
- return;
-}
-
-sub get_db_population_errors {
- my $class = shift;
- my %params = validate(@_, {log_file => 0});
-
- my $log_file = $params{log_file} || DEFAULT_DB_POP_LOG_FILE;
-
-
- open(ERRORS, qq(grep -P "^ORA|Errors for" $log_file |))
- or die "Could not grep $log_file: $OS_ERROR";
-
- my @errors = <ERRORS>;
-
- close(ERRORS);
-
- return @errors;
-}
-
sub is_rpm_installed {
my $class = shift;
my $rpmname = shift;
14 years, 3 months
6 commits - web/modules
by Jan Pazdziora
web/modules/pxt/PXT/Request.pm | 13 -
web/modules/rhn/RHN/DB/AppInstall/Session.pm | 18 --
web/modules/rhn/RHN/DB/Org.pm | 35 -----
web/modules/rhn/RHN/DB/SatInstall.pm | 176 ---------------------------
web/modules/rhn/RHN/Entitlements.pm | 54 --------
web/modules/rhn/RHN/ProxyInstall.pm | 39 -----
6 files changed, 335 deletions(-)
New commits:
commit 92bcc59307b399a6a5aa8fef94cdbcfe8191809b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:45:06 2010 +0100
Removal of Sniglets::MonitoringConfig made push_monitoring_config_changes unused.
diff --git a/web/modules/rhn/RHN/ProxyInstall.pm b/web/modules/rhn/RHN/ProxyInstall.pm
index 505a506..8cfe735 100644
--- a/web/modules/rhn/RHN/ProxyInstall.pm
+++ b/web/modules/rhn/RHN/ProxyInstall.pm
@@ -612,45 +612,6 @@ sub have_package {
}
-# The process to push monitoring config changes is currently:
-# 1) Find all Monitoring-enabled proxies (those with SatCluster records).
-# 2) Schedule a remote command for them: service rhn-proxy restart
-sub push_monitoring_config_changes {
- my $class = shift;
- my $user = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "scout_queries",
- -mode => 'scouts_for_org');
- my $data = $ds->execute_query(-org_id => $user->org_id);
-
- # Use a hash for uniqification
- my %server_ids = map { ($_->{SERVER_ID}, 1) }
- grep { $_->{SERVER_ID} } @{$data};
-
- return unless %server_ids;
-
- my $scheduled_time = RHN::Date->now()->long_date();
-
- my $script =<<EOQ;
-#!/bin/sh
-
-/sbin/service MonitoringScout restart
-EOQ
-
- my $script_aid = RHN::Scheduler->schedule_remote_command(-org_id => $user->org_id,
- -user_id => $user->id,
- -server_ids => [ keys %server_ids ],
- -earliest => $scheduled_time,
- -action_name => 'Restart Monitoring Services',
- -script => $script,
- -username => 'root',
- -group => 'root',
- -timeout => 300,
- );
-
- return $script_aid;
-}
-
sub import_ssl_cert_for_kickstarts {
my $ca_cert = shift;
my $org_id = shift;
commit 18a3790823ec64e423447d0afab58b59d98232c4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:43:24 2010 +0100
Removal of org_entitlement_choices made bunch of *_slot_name's unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index 7f017ae..5174fb3 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -654,41 +654,6 @@ sub slot_name {
return $self->{cached_slot_names}->{$ent};
}
-sub basic_slot_name {
- my $self = shift;
-
- return $self->slot_name('sw_mgr_entitled');
-}
-
-sub enterprise_slot_name {
- my $self = shift;
-
- return $self->slot_name('enterprise_entitled');
-}
-
-sub provisioning_slot_name {
- my $self = shift;
-
- return $self->slot_name('provisioning_entitled');
-}
-
-sub nonlinux_slot_name {
- my $self = shift;
-
- return $self->slot_name('nonlinux_entitled');
-}
-
-sub virtualization_slot_name {
- my $self = shift;
-
- return $self->slot_name('virtualization_host');
-}
-
-sub virtualization_platform_slot_name {
- my $self = shift;
-
- return $self->slot_name('virtualization_host_platform');
-}
sub org_channel_setting {
commit 320dec84aa761f6e323d8a645859e0c520f4258d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:39:18 2010 +0100
org_entitlement_choices and allowed_entitlement_transition are not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/Entitlements.pm b/web/modules/rhn/RHN/Entitlements.pm
index 4f62778..37d126e 100644
--- a/web/modules/rhn/RHN/Entitlements.pm
+++ b/web/modules/rhn/RHN/Entitlements.pm
@@ -91,60 +91,6 @@ sub entitlement_grants_service { # Need to refactor Tokens to remove this entire
return 0;
}
-# given an org and a default entitlement, return the
-# selectbox-suitable choice array
-sub org_entitlement_choices {
- my $class = shift;
- my $org = shift;
- my $current_ent = shift;
-
- my @ret;
- if ($org->has_entitlement('sw_mgr_enterprise')) {
- push @ret, [ 'None', 'none' ];
- push @ret, [ $org->basic_slot_name, 'sw_mgr_entitled' ]
- if not PXT::Config->get("satellite");
- push @ret, [ $org->enterprise_slot_name, 'enterprise_entitled' ];
- push @ret, [ $org->provisioning_slot_name, 'provisioning_entitled' ]
- if $org->has_entitlement('rhn_provisioning');
- push @ret, [ $org->virtualization_slot_name, 'virtualization_host' ]
- if $org->has_entitlement('virtualization_host');
- push @ret, [ $org->virtualization_platform_slot_name, 'virtualization_host_platform' ]
- if $org->has_entitlement('virtualization_host_platform');
- push @ret, [ $org->nonlinux_slot_name, 'monitoring_entitled' ]
- if $org->has_entitlement('rhn_monitor');
- push @ret, [ $org->nonlinux_slot_name, 'nonlinux_entitled' ]
- if $org->has_entitlement('rhn_nonlinux');
- }
- else {
- @ret =
- ([ 'None', 'none' ],
- [ $org->basic_slot_name, 'sw_mgr_entitled' ]);
- }
-
- for my $ret (@ret) {
- $ret->[2] = 0;
- $ret->[2] = 1 if $ret->[1] eq $current_ent;
- }
-
- return @ret;
-}
-
-my %transitions =
- (none => [ qw/sw_mgr_entitled enterprise_entitled provisioning_entitled nonlinux_entitled/ ],
- sw_mgr_entitled => [ qw/enterprise_entitled provisioning_entitled/ ],
- enterprise_entitled => [ qw/provisioning_entitled/ ],
- provisioning_entitled => [ ]);
-
-sub allowed_entitlement_transition {
- my $class = shift;
- my $from = shift;
- my $to = shift;
-
- return 1 if $from eq $to;
-
- return scalar grep { $to eq $_ } @{$transitions{$from}};
-}
-
# What type of feature is this? Management, provisioning, monitoring, etc.
sub feature_type {
my $class = shift;
commit 4a46f1bbf7eb8995b2c5c3d944434161a59da1cc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:37:27 2010 +0100
Removing bunch of functions from RHN::DB::SatInstall:
get_default_tablespace_name
check_db_privs
check_db_tablespace_settings
check_db_charsets
create_satellite_org
diff --git a/web/modules/rhn/RHN/DB/SatInstall.pm b/web/modules/rhn/RHN/DB/SatInstall.pm
index cee1b95..7d4e3c3 100644
--- a/web/modules/rhn/RHN/DB/SatInstall.pm
+++ b/web/modules/rhn/RHN/DB/SatInstall.pm
@@ -65,148 +65,6 @@ EOQ
return $row ? 1 : 0;
}
-# return 0 if the version is allowed, otherwise dies with the version
-
-sub check_db_version {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my ($v, $c);
-
- $dbh->call_procedure('dbms_utility.db_version', \$v, \$c);
-
- my $version = join('', (split(/\./, $v))[0 .. 2]);
-
- throw "Invalid db version: ($v, $c)" unless
- grep { $version == $_ } @allowed_db_versions;
-
- return 0;
-}
-
-# Find the default tablespace name for the given (oracle) user.
-sub get_default_tablespace_name {
- my $class = shift;
- my $db_user = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT UU.default_tablespace
- FROM user_users UU
- WHERE UU.username = upper(:uname)
-EOQ
-
- $sth->execute_h(uname => $db_user);
-
- my ($ts) = $sth->fetchrow();
- $sth->finish;
-
- throw "No tablespace found for user '$db_user'"
- unless $ts;
-
- return $ts;
-}
-
-sub check_db_privs {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT DISTINCT privilege
- FROM (
- SELECT USP.privilege
- FROM user_sys_privs USP
- UNION
- SELECT RSP.privilege
- FROM role_sys_privs RSP,
- user_role_privs URP
- WHERE RSP.role = URP.granted_role
- UNION
- SELECT RSP.privilege
- FROM role_sys_privs RSP,
- role_role_privs RRP,
- user_role_privs URP1,
- user_role_privs URP2
- WHERE URP1.granted_role = RRP.role
- AND RRP.role = URP2.granted_role
- AND URP2.granted_role = RSP.role
- )
- WHERE privilege = :priv
-EOQ
-
- my @required_privs =
- ('ALTER SESSION',
- 'CREATE SEQUENCE',
- 'CREATE SYNONYM',
- 'CREATE TABLE',
- 'CREATE VIEW',
- 'CREATE PROCEDURE',
- 'CREATE TRIGGER',
- 'CREATE TYPE',
- 'CREATE SESSION',
- );
-
- foreach my $priv (@required_privs) {
- $sth->execute_h(priv => $priv);
- my ($got_priv) = $sth->fetchrow();
-
- unless ($got_priv) {
- throw "Missing privilege: $priv";
- }
-
- $sth->finish;
- }
-
- return 0;
-}
-
-# returns 0 if the tablespace settings are good, dies with error(s) otherwise
-sub check_db_tablespace_settings {
- my $class = shift;
-
- my $oracle_user = shift;
- my $tablespace_name = $class->get_default_tablespace_name($oracle_user);
-
- $class->check_db_privs();
-
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare(<<EOQ);
-SELECT UT.status, UT.contents, UT.logging
- FROM user_tablespaces UT
- WHERE UT.tablespace_name = :tname
-EOQ
-
- $sth->execute_h(tname => $tablespace_name);
- my $row = $sth->fetchrow_hashref;
- $sth->finish;
-
- unless (ref $row eq 'HASH' and (%{$row})) {
- throw "tablespace $tablespace_name does not appear to exist";
- }
-
- my %expectations = (STATUS => 'ONLINE',
- CONTENTS => 'PERMANENT',
- LOGGING => 'LOGGING',
- );
- my @errs = ();
-
- foreach my $column (keys %expectations) {
- if ($row->{$column} ne $expectations{$column}) {
- push @errs, sprintf("tablespace %s has %s set to %s where %s is expected",
- $tablespace_name, $column, $row->{$column}, $expectations{$column});
- }
- }
-
- if (@errs) {
- throw "Tablespace errors: " . join(';', @errs);
- }
-
- return 0;
-}
-
sub get_nls_database_parameters {
my $class = shift;
@@ -228,23 +86,6 @@ EOQ
return %nls_database_parameters;
}
-my @ALLOWED_CHARSETS = qw/UTF8 AL32UTF8/;
-
-# returns 0 if the db is using UTF8, dies with actual character set otherwise.
-sub check_db_charsets {
- my $class = shift;
-
- my %nls_database_parameters = $class->get_nls_database_parameters();
-
- unless (exists $nls_database_parameters{NLS_CHARACTERSET} and
- grep { $nls_database_parameters{NLS_CHARACTERSET} eq $_ } @ALLOWED_CHARSETS) {
- throw "DB is using an invalid (non-UTF8) character set: (NLS_CHARACTERSET = "
- . $nls_database_parameters{NLS_CHARACTERSET} . ")";
- }
-
- return 0;
-}
-
sub clear_db {
my $class = shift;
@@ -334,23 +175,6 @@ EOQ
return;
}
-sub create_satellite_org {
- my $class = shift;
- my $org_name = shift;
-
- my $dbh = RHN::DB->connect;
-
- my ($org_id) = $class->get_satellite_org_id;
-
- if (defined $org_id) {
- throw "Attempt create an org on satellite when one already exists";
- }
-
- $dbh->call_procedure("create_first_org", $org_name, PXT::Utils->random_password(16));
-
- return;
-}
-
sub get_satellite_org_id {
my $class = shift;
my $dbh = RHN::DB->connect;
commit a2592029f62bb769856df2379b22386472c86fd3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:32:40 2010 +0100
get_instance_id and set_instance_id are not referenced, removing.
diff --git a/web/modules/rhn/RHN/DB/AppInstall/Session.pm b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
index 7c4e7c4..25b300c 100644
--- a/web/modules/rhn/RHN/DB/AppInstall/Session.pm
+++ b/web/modules/rhn/RHN/DB/AppInstall/Session.pm
@@ -470,24 +470,6 @@ foreach my $field (keys %valid_fields) {
}
}
-sub get_instance_id {
- my $self = shift;
-
- return $self->get_app_instance->get_id()
-}
-
-sub set_instance_id {
- my $self = shift;
- my $id = shift;
-
- my $app = RHN::AppInstall::Instance->lookup(-id => $id);
-
- $self->set_app_instance($app);
- $self->{":modified:"}->{instance_id} = 1;
-
- return;
-}
-
sub get_user_id {
my $self = shift;
commit d26bd966f2bfd41db566df427e21d18b01a01cf1
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:28:21 2010 +0100
Removal of rpc_fault made %fault_messages unused, removing.
diff --git a/web/modules/pxt/PXT/Request.pm b/web/modules/pxt/PXT/Request.pm
index 18a674a..2a1f0d0 100644
--- a/web/modules/pxt/PXT/Request.pm
+++ b/web/modules/pxt/PXT/Request.pm
@@ -530,19 +530,6 @@ sub encode_rpc_result {
return $self->xml_request->encode_rpc_result(@_);
}
-my %fault_messages =
- ( unknown_error => 'Unknown internal error',
- server_security => 'No server perms/server does not exist',
- invalid_login => 'Invalid username/password',
- old_client => 'Your client does not support this version of PXT. Contact rhn-feedback(a)redhat.com',
- invalid_certificate => 'Invalid server certificate',
- invalid_sat_certificate => 'Invalid entitlement certificate',
- satellite_already_activated => 'Satellite has already been activated',
- no_sat_chan_for_version => 'No Satellite channel exists for specified version',
- no_access_to_sat_channel => 'Account does not have access to any Satellite channels',
- insufficient_channel_entitlements => 'All entitlements to the required channel are currently in use.',
- );
-
sub touch_session {
$_[0]->{session_touched} = 1;
}
14 years, 3 months
13 commits - web/modules
by Jan Pazdziora
web/modules/grail/Grail/Component.pm | 26 -
web/modules/pxt/PXT/ApacheHandler.pm | 11
web/modules/pxt/PXT/Request.pm | 98 ------
web/modules/pxt/PXT/Trace.pm | 9
web/modules/pxt/PXT/Utils.pm | 176 ------------
web/modules/rhn/RHN/AppInstall/ACL.pm | 6
web/modules/rhn/RHN/AppInstall/ActionHandler.pm | 22 -
web/modules/rhn/RHN/AppInstall/Process.pm | 18 -
web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm | 7
web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm | 15 -
web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm | 19 -
web/modules/rhn/RHN/AppInstall/RequirementHandler.pm | 33 --
web/modules/rhn/RHN/AppInstall/Session.pm | 48 ---
13 files changed, 488 deletions(-)
New commits:
commit d860a77a2bb4a1cb90781914b1bbd226d98d20d8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:25:16 2010 +0100
current_step, import_session, and _check_stored_data are not referenced in the code, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Session.pm b/web/modules/rhn/RHN/AppInstall/Session.pm
index 5c88e92..8abe2a4 100644
--- a/web/modules/rhn/RHN/AppInstall/Session.pm
+++ b/web/modules/rhn/RHN/AppInstall/Session.pm
@@ -119,13 +119,6 @@ sub current_process {
}
-# returns the step object for the step we are on.
-sub current_step {
- my $self = shift;
-
- $self->_lookup_step($self->get_step_number);
-}
-
# return the next step, or undef if none exists.
# does not advance the step counter.
sub next_step {
@@ -271,47 +264,6 @@ sub export {
return $state;
}
-# import the state for the given app; returns a new session object.
-sub import_session {
- my $class = shift;
- my %attr = validate(@_, {
- app_instance => { isa => 'RHN::AppInstall::Instance' },
- stored_data => { type => HASHREF },
- });
-
- my $app = $attr{app_instance};
- my $data = $attr{stored_data};
-
- _check_stored_data($app, $data);
-
- my $user = RHN::User->lookup(-id => $data->{user_id});
- my $server = RHN::Server->lookup(-id => $data->{server_id});
-
- my $session = $class->new(-app_instance => $app,
- -process_name => $data->{process_name},
- -step_number => $data->{step_number},
- -session_data => $data->{session_data},
- -user => $user,
- -server => $server,
- );
-
- return $session;
-}
-
-# verify that the stored data matches the app, user, and server
-sub _check_stored_data {
- my ($app, $data) = @_;
-
- throw "(invalid_session) The target application label does not match the stored session"
- unless ($app->get_label eq $data->{app_label});
- throw "(invalid_session) The target application version does not match the stored session"
- unless ($app->get_version eq $data->{app_version});
- throw "(invalid_session) The target application md5sum does not match the stored session"
- unless ($app->get_md5 eq $data->{app_md5sum});
-
- return;
-}
-
# Run an action.
# Returns 0 if the action succeeded
commit af72e8417e23c576b5cdc667c6675c20223eb80f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:23:36 2010 +0100
remove_requirement, get_requirement_registry, and set_requirement_registry are not called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm b/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
index 05798cb..40e099f 100644
--- a/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
+++ b/web/modules/rhn/RHN/AppInstall/RequirementHandler.pm
@@ -85,17 +85,6 @@ sub add_requirement {
return;
}
-sub remove_requirement {
- my $self = shift;
- my $requirement_name = shift;
-
- if (not delete $self->{requirement_registry}->{$requirement_name}) {
- throw "(requirement_not_found) There is no '$requirement_name' requirement registered";
- }
-
- return;
-}
-
sub check_requirement {
my $self = shift;
my $requirement = shift;
@@ -131,26 +120,4 @@ sub make_param_pretty {
return $param_subs{$param} || $param;
}
-sub get_requirement_registry {
- my $self = shift;
-
- return %{$self->{requirement_registry}};
-}
-
-sub set_requirement_registry {
- my $self = shift;
- my %data;
-
- if (ref $_[0] eq 'HASH') {
- %data = %{$_[0]};
- }
- else {
- %data = @_;
- }
-
- $self->{requirement_registry} = \%data;
-
- return;
-}
-
1;
commit 431fd7788853528e25e6ea6d3ca1056af20b9df7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:21:57 2010 +0100
get_requirements and set_requirements do not appear elsewhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm b/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
index 85ead7c..912d03c 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Requirements.pm
@@ -34,25 +34,6 @@ sub valid_fields {
return ($class->SUPER::valid_fields(), %valid_fields);
}
-sub get_requirements {
- my $self = shift;
-
- return @{$self->{requirements} || []};
-}
-
-sub set_requirements {
- my $self = shift;
- my @requirements = @_;
-
- if (ref $requirements[0] eq 'ARRAY') {
- @requirements = @{$requirements[0]};
- }
-
- $self->push_requirement(@requirements);
-
- return;
-}
-
sub push_requirement {
my $self = shift;
my @requirements = @_;
commit 89892bd09bf0ace1d47daec040f7139b255fefc3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:21:00 2010 +0100
set_url and get_save_session do not appear elsewhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm b/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
index c693b96..ba8cb51 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Redirect.pm
@@ -42,21 +42,6 @@ sub get_url {
return $self->{url};
}
-sub set_url {
- my $self = shift;
- my $url = shift;
-
- $self->{url} = $url;
-
- return;
-}
-
-sub get_save_session {
- my $self = shift;
-
- return $self->{save_session};
-}
-
sub set_save_session {
my $self = shift;
my $save_session = shift;
commit f013a7dc25ed2a472cd940d441eb90cb1a29527b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:19:32 2010 +0100
pop_argument does not seem to be used, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm b/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
index ab9c0e8..4037eda 100644
--- a/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process/Step/Action.pm
@@ -124,11 +124,4 @@ sub push_argument {
return;
}
-sub pop_argument {
- my $self = shift;
-
- return if (not @{$self->{arguments}});
- return pop @{$self->{arguments}};
-}
-
1;
commit 2efacec52aac4b889c2efe83137e1eeaa96299bc
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:18:58 2010 +0100
get_steps and set_steps are not called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/Process.pm b/web/modules/rhn/RHN/AppInstall/Process.pm
index 62b08f0..188c238 100644
--- a/web/modules/rhn/RHN/AppInstall/Process.pm
+++ b/web/modules/rhn/RHN/AppInstall/Process.pm
@@ -63,24 +63,6 @@ sub lookup_step {
return $step;
}
-sub get_steps {
- my $self = shift;
- return @{$self->{steps} || []};
-}
-
-sub set_steps {
- my $self = shift;
- my @steps = @_;
-
- if (ref $steps[0] eq 'ARRAY') {
- @steps = @{$steps[0]};
- }
-
- $self->push_step(@steps);
-
- return;
-}
-
sub push_step {
my $self = shift;
my @steps = @_;
commit 5588363e1e1cafc57a6353fbeb9a20e703a9ff02
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:17:34 2010 +0100
get_action_registry and set_action_registry are not called anywhere, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/ActionHandler.pm b/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
index 9d46392..52d0d2b 100644
--- a/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
+++ b/web/modules/rhn/RHN/AppInstall/ActionHandler.pm
@@ -171,26 +171,4 @@ sub export_arguments {
}
}
-sub get_action_registry {
- my $self = shift;
-
- return %{$self->{action_registry}};
-}
-
-sub set_action_registry {
- my $self = shift;
- my %data;
-
- if (ref $_[0] eq 'HASH') {
- %data = %{$_[0]};
- }
- else {
- %data = @_;
- }
-
- $self->{action_registry} = \%data;
-
- return;
-}
-
1;
commit 638d9ea91056b9eb715cd49bf821923f59140ad6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:16:46 2010 +0100
get_failed_message is not used, removing.
diff --git a/web/modules/rhn/RHN/AppInstall/ACL.pm b/web/modules/rhn/RHN/AppInstall/ACL.pm
index e44cf87..de85089 100644
--- a/web/modules/rhn/RHN/AppInstall/ACL.pm
+++ b/web/modules/rhn/RHN/AppInstall/ACL.pm
@@ -85,12 +85,6 @@ sub set_argument {
return;
}
-sub get_failed_message {
- my $self = shift;
-
- return $self->{failed_message};
-}
-
sub set_failed_message {
my $self = shift;
my $failed_message = shift;
commit 1dc59b4a601e847a8d5c59fd51ef068d175fb342
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:15:34 2010 +0100
Removing bunch of unused methods from PXT::Request:
positive_numeric_param
encode_rpc_fault
rpc_fault
exception_message_map
current_stage
set_stage
form_builder_query_string
form_builder_hidden_vars
pagination_bounds
diff --git a/web/modules/pxt/PXT/Request.pm b/web/modules/pxt/PXT/Request.pm
index 06c516b..18a674a 100644
--- a/web/modules/pxt/PXT/Request.pm
+++ b/web/modules/pxt/PXT/Request.pm
@@ -353,26 +353,6 @@ sub passthrough_param {
}
}
-sub numeric_param {
- my $self = shift;
- my $name = shift;
-
- my $n = $self->param($name) || 0;
-
- $n = int(0 + $n);
-
- return $n;
-}
-
-sub positive_numeric_param {
- my $self = shift;
- my $name = shift;
-
- my $n = $self->numeric_param($name);
-
- return $n < 0 ? -$n : $n;
-}
-
sub prefill_form_values {
my $self = shift;
my $block = shift;
@@ -550,12 +530,6 @@ sub encode_rpc_result {
return $self->xml_request->encode_rpc_result(@_);
}
-sub encode_rpc_fault {
- my $self = shift;
-
- return $self->xml_request->encode_rpc_fault(@_);
-}
-
my %fault_messages =
( unknown_error => 'Unknown internal error',
server_security => 'No server perms/server does not exist',
@@ -569,40 +543,6 @@ my %fault_messages =
insufficient_channel_entitlements => 'All entitlements to the required channel are currently in use.',
);
-sub rpc_fault {
- my $self = shift;
- my $fault_string = shift;
- my $fault_code = -2; # later we'll assign numbers; for now, -2 means
- # "not in fault list" and -1 means "in list"
-
- if (exists $fault_messages{$fault_string}) {
- $fault_code = -1;
- $fault_string = $fault_messages{$fault_string};
- }
-
- die bless { fault_text => $fault_string, fault_code => $fault_code }, "PXT::RPCFault";
-}
-
-sub exception_message_map {
- my $self = shift;
- my $exception = shift;
- my %map = @_;
-
- for my $key (%map) {
- if (ref $exception and $exception->is_rhn_exception($key)) {
- $self->push_message(local_alert => $map{$key});
- return 1;
- }
- }
-
- if (exists $map{__default__}) {
- $self->push_message(local_alert => $map{__default__});
- return 1;
- }
-
- return 0;
-}
-
sub touch_session {
$_[0]->{session_touched} = 1;
}
@@ -671,40 +611,12 @@ sub user {
return $self->{__user__};
}
-sub current_stage {
- my $self = shift;
-
- return $self->{stage};
-}
-
-sub set_stage {
- my $self = shift;
-
- $self->{stage} = shift;
-
- return $self->current_stage;
-}
-
sub form_builder_variables {
my $self = shift;
push @{$self->{form_builder_variables}}, @_;
}
-sub form_builder_query_string {
- my $self = shift;
-
- return join("&", map { "$_=" . $self->pnotes($_) } @{$self->{form_builder_variables}});
-}
-
-sub form_builder_hidden_vars {
- my $self = shift;
-
- return join("\n",
- map { sprintf(q{<input type="hidden" name="%s" value="%s">}, $_, $self->pnotes($_)) }
- @{$self->{form_builder_variables}});
-}
-
sub parse {
my $self = shift;
my $str = shift;
@@ -795,16 +707,6 @@ sub derelative_url {
return $url;
}
-sub pagination_bounds {
- my $self = shift;
- my $prefix = shift;
-
- my $lower = $self->param('lower') || $self->pnotes("${prefix}_lower") || 1;
- my $upper = $self->param('upper') || $self->pnotes("${prefix}_upper") || $self->user->preferred_page_size;
-
- return ($lower, $upper);
-}
-
sub route_marker {
my $self = shift;
my $href = shift;
commit d0721eb75c02ca8255674917c68fb0930fb83dc8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:09:38 2010 +0100
clear_traces is nowhere used, removing.
diff --git a/web/modules/pxt/PXT/Trace.pm b/web/modules/pxt/PXT/Trace.pm
index f40e3f1..3a0c46c 100644
--- a/web/modules/pxt/PXT/Trace.pm
+++ b/web/modules/pxt/PXT/Trace.pm
@@ -130,15 +130,6 @@ sub active {
return $cache->get('tracing_active') || 0;
}
-sub clear_traces {
- my $self = shift;
-
- my $cache = $self->get_cache;
- my $tracing = $cache->get('tracing_active');
- $cache->clear;
- $cache->set('tracing_active', $tracing);
-}
-
sub get_cache {
return new Cache::FileCache({namespace => 'pxt_trace'});
}
commit 92566dd77369cd141845a7e82e694bfaea7953d2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:08:36 2010 +0100
Removing bunch of unused functions from PXT::Utils:
get_timezones
relative_time_diff
pretty_relative_time
country_selectbox
prefix_selectbox
humanify
get_subtag_body
replace_subtag
diff --git a/web/modules/pxt/PXT/Utils.pm b/web/modules/pxt/PXT/Utils.pm
index 50430f5..b93f6ec 100644
--- a/web/modules/pxt/PXT/Utils.pm
+++ b/web/modules/pxt/PXT/Utils.pm
@@ -67,59 +67,6 @@ sub olson_from_offset {
return $timezone_conversions{$offset};
}
-# return a list of the selectable timezones for user prefs
-sub get_timezones {
- my $class = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "User_queries",
- -mode => "available_timezones");
-
- my $result = $ds->execute_query();
-
- return @$result;
-}
-
-# take 2 timestamps, return relative difference between them
-sub relative_time_diff {
- my $class = shift;
- my $time1 = shift; # timestamp
- my $time2 = shift; # timestamp
-
- # might want to suck in Date::Calc, but for now do this...
-
- my $delta = abs($time2 - $time1);
-
- my %diff;
- $diff{seconds} = $delta % 60;
- $diff{minutes} = int($delta / 60) % 60;
- $diff{hours} = int($delta / 3600) % 24;
- $diff{days} = int($delta / 86400);
- $diff{direction} = $time2 > $time1 ? 1 : -1;
-
- return \%diff;
-}
-
-# given the output of relative_time_diff, show a prettier string
-# (also must give the fields you want, ie. 'day', 'minute', 'second', etc...)
-sub pretty_relative_time {
- my $class = shift;
- my $diff_ref = shift;
- my @fields = @_;
-
- my @ret;
- foreach my $singular (@fields) {
- my $plural = $singular . 's';
- my $value = $diff_ref->{$plural};
- push @ret, $value eq 1 ? $value . " $singular" : $value . " $plural";
- }
-
- if (scalar(@ret) > 1) {
- $ret[-1] = 'and ' . $ret[-1];
- }
-
- return join(", ", @ret);
-}
-
sub split_attributes {
my $blob = shift;
@@ -137,50 +84,6 @@ sub split_attributes {
return @ret;
}
-sub country_selectbox {
- my ($class, $formvar, $lang, $default, $current, $allow_empty) = @_;
-
- $lang ||= 'en';
- $current ||= $default || '';
-
- my $dbh = RHN::DB->connect;
-
- my $sql = "SELECT vc.code, nvl(short_name_tl, short_name)
- FROM valid_countries vc, valid_countries_tl tl
- where tl.lang (+) = ? and tl.code (+)= vc.code
- ORDER BY vc.short_name";
-
- my $sth = $dbh->prepare($sql);
- $sth->execute($lang);
-
- my @codes;
-
- while (my @r = $sth->fetchrow) {
-
- next if (grep { $_ eq uc $r[0] } qw/US CA MX/);
-
- push @codes, \@r;
- }
- $sth->finish();
-
- unshift @codes, ( ["US", "United States"], ["MX", "Mexico"], ["CA", "Canada"]);
-
- if ($allow_empty) {
- unshift @codes, [ "", "None" ];
- }
-
- my @opts;
- foreach my $country (@codes) {
- push @opts, [ $country->[1], $country->[0], (lc($country->[0]) eq lc($current)) ? 1 : 0 ];
- }
-
- my $ret = PXT::HTML->select(-name => $formvar,
- -size => 1,
- -options => \@opts);
-
- return $ret;
-}
-
sub paginate_variables {
my $class = shift;
my $block = shift;
@@ -346,26 +249,6 @@ sub random_password {
return $ret;
}
-sub prefix_selectbox {
- my ($class, $formvar, $default) = @_;
-
- my $dbh = RHN::DB->connect;
-
- my $sql = "SELECT text FROM web_user_prefix WHERE text <> '.' AND text <> ' ' ORDER BY text";
-
- my $sth = $dbh->prepare($sql);
- $sth->execute;
-
- my @codes;
- while (my ($prefix) = $sth->fetchrow) {
- push @codes, [ $prefix, $prefix, $default ne '.' ? $default eq $prefix : $prefix eq 'Mr.' ];
- }
- $sth->finish();
-
- return PXT::HTML->select(-name => $formvar,
- -options => \@codes);
-}
-
# take a positive integer, return a pretty version with commas
sub commafy {
my $class = shift;
@@ -376,42 +259,6 @@ sub commafy {
return scalar reverse $n;
}
-sub humanify {
- my $class = shift;
- my $n = shift;
- my $suffix = shift || '';
- my $dec = shift;
-
- my $unit = '';
- my $form;
- if ($dec) {
- $form = "%.${dec}f";
- }
- else {
- $form = "%d";
- }
-
- if ($n > 1 * 1024 * 1024 * 1024) {
- $n = sprintf $form, $n/1024/1024/1024;
- $unit = 'G';
- }
- elsif ($n > 1 * 1024 * 1024) {
- $n = sprintf $form, $n/1024/1024;
- $unit = 'M';
- }
- elsif ($n > 1 * 1024) {
- $n = sprintf $form, $n/1024;
- $unit = 'K';
- }
-
- if ($unit) {
- return "$n$unit$suffix";
- }
- else {
- return "$n$suffix";
- }
-}
-
sub untaint {
my $class = shift;
my $dref = shift;
@@ -439,27 +286,4 @@ sub random_bits {
}
-sub get_subtag_body {
- my $class = shift;
- my $tagname = shift;
- my $source = shift;
-
- if ($source =~ m{<$tagname>(.*?)</$tagname>}ism) {
- return $1;
- }
-
- return undef;
-}
-
-sub replace_subtag {
- my $class = shift;
- my $tagname = shift;
- my $target = shift;
- my $replacement = shift;
-
- $target =~ s{<$tagname>.*?</$tagname>}{$replacement}ism;
-
- return $target;
-}
-
1;
commit 7184ce8499f0668581982cad11983c41c97e457d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:04:06 2010 +0100
profiling_markpoint is not called anywhere, removing.
diff --git a/web/modules/pxt/PXT/ApacheHandler.pm b/web/modules/pxt/PXT/ApacheHandler.pm
index 03f2f8c..2fdfaa9 100644
--- a/web/modules/pxt/PXT/ApacheHandler.pm
+++ b/web/modules/pxt/PXT/ApacheHandler.pm
@@ -734,16 +734,5 @@ sub clear_profile_timer {
$last_profile_pt = 0;
}
-sub profiling_markpoint {
- my $now = Time::HiRes::time;
-
- my $where = join(": ", (caller)[1], (caller)[2]);
- my $delta = $last_profile_pt ? sprintf("%.03f", $now - $last_profile_pt) : "begin";
-
- warn "profile pt: $now ($delta) at $where\n";
-
- $last_profile_pt = $now;
-}
-
1;
commit 882cf2574ed4323f925a4ee0baf8bf55737f7d72
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 20:01:06 2010 +0100
render_modes and sql_install_query are not called anywhere, removing.
diff --git a/web/modules/grail/Grail/Component.pm b/web/modules/grail/Grail/Component.pm
index 35adf74..56a2c2d 100644
--- a/web/modules/grail/Grail/Component.pm
+++ b/web/modules/grail/Grail/Component.pm
@@ -65,12 +65,6 @@ sub render_mapping {
return $self->{_render_map_}->{+shift};
}
-sub render_modes {
- my $self = shift;
-
- return keys %{$self->{_render_map_}};
-}
-
sub initialize {
my $self = shift;
@@ -78,24 +72,4 @@ sub initialize {
foreach $self->component_modes;
}
-sub sql_install_query {
- my $self = shift;
- my $pkg = ref $self ? ref $self : $self;
-
- my @ret;
-
- foreach my $c ($self->component_modes) {
- my $role = $c->[4] ? "'$c->[4]'" : 'NULL';
- my $config = $c->[3] ? "'$c->[3]'" : 'NULL';
- my $label = $c->[2] || '';
-
- push @ret, <<EOQ;
-INSERT INTO rhnGrailComponents (id, component_pkg, component_mode, config_mode, component_label, role_required)
- VALUES (rhn_grail_components_seq.nextval, '$pkg', '$c->[0]', $config, '$label', $role);
-EOQ
- }
-
- return join("", @ret);
-}
-
1;
14 years, 3 months
web/modules
by Jan Pazdziora
web/modules/rhn/RHN/Kickstart/IPRange.pm | 108 -------------------------------
1 file changed, 108 deletions(-)
New commits:
commit 8341855350f8f395a758d3fa905f7e909e349754
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:18:14 2010 +0100
Removing bunch of unused methods from RHN::Kickstart::IPRange:
split_ips
disjoint_from
subset_of
superset_of
equal_to
can_coexist
test_org_conflicts
org_ranges_for_ip
build_range_from_row
diff --git a/web/modules/rhn/RHN/Kickstart/IPRange.pm b/web/modules/rhn/RHN/Kickstart/IPRange.pm
index f5c411d..62adfa5 100644
--- a/web/modules/rhn/RHN/Kickstart/IPRange.pm
+++ b/web/modules/rhn/RHN/Kickstart/IPRange.pm
@@ -75,12 +75,6 @@ sub as_string {
return $self->min . "-" . $self->max;
}
-sub split_ips {
- my $self = shift;
-
- return ($self->min->value, $self->max->value);
-}
-
# get or set the minimum value
sub min {
my $self = shift;
@@ -159,106 +153,4 @@ sub after {
return 0;
}
-# This range has no IPs in common with the other
-sub disjoint_from {
- my $self = shift;
- my ($other) = validate_pos(@_, { isa => "RHN::Kickstart::IPRange" });
-
- return 1 if ($self->before($other) or $self->after($other));
-
- return 0;
-}
-
-# All of this range is inside the other
-sub subset_of {
- my $self = shift;
- my ($other) = validate_pos(@_, { isa => "RHN::Kickstart::IPRange" });
-
- return 1 if ( ($self->min >= $other->min) and ($self->max <= $other->max) );
-
- return 0;
-}
-
-# All of the other range is inside this one
-sub superset_of {
- my $self = shift;
- my ($other) = validate_pos(@_, { isa => "RHN::Kickstart::IPRange" });
-
- return 1 if ( ($self->min <= $other->min) and ($self->max >= $other->max) );
-
- return 0;
-}
-
-sub equal_to {
- my $self = shift;
- my ($other) = validate_pos(@_, { isa => "RHN::Kickstart::IPRange" });
-
- return 1 if ( ($self->min == $other->min) and ($self->max == $other->max) );
-
- return 0;
-}
-
-# Can they exist within the same space?
-# Yes, if they are disjoint, or one is a subset of the other
-sub can_coexist {
- my $self = shift;
- my ($other) = validate_pos(@_, { isa => "RHN::Kickstart::IPRange" });
-
- return 1 if ( ($self->disjoint_from($other) or $self->subset_of($other) or $self->superset_of($other))
- and (not $self->equal_to($other)) );
-
- return 1 if ($self->equal_to($other) and ($self->ksid == $other->ksid));
-
- return 0;
-}
-
-# test for range conflicts within an org for a given ip range
-# returns the conflicting ranges, if any
-sub test_org_conflicts {
- my $class = shift;
- my $org_id = shift;
- my $range = shift;
-
- my $ds = new RHN::DataSource::General(-mode => 'org_ks_ip_ranges');
- my $data = $ds->execute_query(-org_id => $org_id);
-
- my @ret;
-
- foreach my $row (@{$data}) {
- my $test_range = build_range_from_row($row);
-
- push(@ret, $test_range) unless $range->can_coexist($test_range);
- }
-
- return @ret;
-}
-
-sub org_ranges_for_ip {
- my $class = shift;
- my %params = validate(@_, { org_id => { optional => 0 }, ip => { optional => 0 } });
-
- my $ip = new RHN::Kickstart::IPAddress($params{ip});
-
- my $ds = new RHN::DataSource::General(-mode => 'org_ks_ip_ranges_for_ip');
- my $data = $ds->execute_query(-org_id => $params{org_id}, -ip => $ip->export);
-
- my @ret;
-
- foreach my $row (@{$data}) {
- push @ret, build_range_from_row($row);
- }
-
- return @ret;
-}
-
-sub build_range_from_row {
- my $row = shift;
-
- return new RHN::Kickstart::IPRange(-min => $row->{MIN},
- -max => $row->{MAX},
- -ksid => $row->{KICKSTART_ID},
- -org_id => $row->{ORG_ID},
- );
-}
-
1;
14 years, 3 months
4 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/Date.pm | 8
web/modules/rhn/RHN/Form/Response.pm | 10 -
web/modules/rhn/RHN/Kickstart/Post.pm | 308 ----------------------------------
web/modules/rhn/RHN/Kickstart/Pre.pm | 6
4 files changed, 332 deletions(-)
New commits:
commit 990e72f075649fb27c0bb4567879b24ae191720d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:15:47 2010 +0100
valid_helpers not used anywhere, removing.
diff --git a/web/modules/rhn/RHN/Kickstart/Pre.pm b/web/modules/rhn/RHN/Kickstart/Pre.pm
index 9052856..a73c408 100644
--- a/web/modules/rhn/RHN/Kickstart/Pre.pm
+++ b/web/modules/rhn/RHN/Kickstart/Pre.pm
@@ -25,8 +25,6 @@ Params::Validate::validation_options(strip_leading => "-");
use overload # I, for one, welcome our new operator overloaders
'""' => \&as_string;
-my @valid_helpers = qw//;
-
sub new {
my $class = shift;
my $val = shift;
@@ -47,8 +45,4 @@ sub as_string {
return $$self;
}
-sub valid_helpers {
- return @valid_helpers;
-}
-
1;
commit 177f1fcabe3a2ec7e6f362288b76ddeaae3befc2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:13:20 2010 +0100
Removing most of code from RHN::Kickstart::Post as the methods were not referenced from anywhere.
diff --git a/web/modules/rhn/RHN/Kickstart/Post.pm b/web/modules/rhn/RHN/Kickstart/Post.pm
index 343dc3c..2837862 100644
--- a/web/modules/rhn/RHN/Kickstart/Post.pm
+++ b/web/modules/rhn/RHN/Kickstart/Post.pm
@@ -46,312 +46,4 @@ sub as_string {
return $$self;
}
-# Helpers
-
-sub get_rhn_packages {
- my $self = shift;
- my $on_off = shift;
- my $attr = shift;
-
- my @packages = @{$attr->{packages}};
- my $ssl_available = $attr->{ssl_available};
-
- my $expires = time + 43200; # 12 hours
- my @urls;
-
- foreach my $pkg_id (@packages) {
- my $pkg = RHN::Package->lookup(-id => $pkg_id);
-
- push @urls, RHN::TokenGen::Local->generate_url(0, 0, $pkg->path, "/download", "local", $expires, $ssl_available);
-
- }
-
- my $urls = join(" ", @urls);
-
- return unless $urls;
-
- $self->choose_action($attr->{style}, $on_off, { urls => $urls });
-}
-
-sub update_rhn_packages {
- my $self = shift;
- my $on_off = shift;
- my $attr = shift;
-
- my @packages = @{$attr->{package_names}};
-
- # crude hack
- my $dir = '/tmp/rhn_rpms/optional';
- my $packages = join(" ", map { "$dir/$_*" } @{$attr->{package_names}});
- $self->choose_action('update_rhn_package', $on_off, { packages => $packages });
-}
-
-
-sub add_gpg_keys {
- my $self = shift;
- my $on_off = shift;
- my $attr = shift;
-
- my @key_data = @{$attr->{key_data}};
-
- return unless @key_data;
-
- my $dist = $attr->{dist};
-
- for (my $i = $#key_data; $i >= 0; $i--) { # What's this?! A 'for' loop in perl? Madness!
- $self->choose_action("import_gpg_keys_${dist}" , $on_off, { index => $i + 1 });
- $self->choose_action('write_key_to_file', $on_off, { key => $key_data[$i], index => $i + 1, type => 'gpg' });
- }
-}
-
-sub add_ssl_keys {
- my $self = shift;
- my $on_off = shift;
- my $attr = shift;
-
- my @key_data = @{$attr->{key_data}};
-
- return unless @key_data;
-
- $self->choose_action('use_custom_ssl_keys', $on_off);
- $self->choose_action("import_ssl_keys" , $on_off);
-
- for (my $i = $#key_data; $i >= 0; $i--) {
- $self->choose_action('write_key_to_file', $on_off, { key => $key_data[$i], index => $i + 1, type => 'ssl' });
- }
-}
-
-sub choose_action {
- my $self = shift;
- my $mode = shift;
- my $toggle = shift;
- my $args = shift;
-
- if (not defined $toggle) { # is it on already?
- return $self->check_for_line($mode);
- }
- elsif ($toggle) { # turn it on...
- return $self->insert_line($mode, $args);
- }
- else { # ...or off
- return $self->remove_line($mode);
- }
-}
-
-my %helpers = (
- enable_cfg_management => {
- regexp => qr|^mkdir -p /etc/sysconfig/rhn/allowed-actions/configfiles\n
- touch /etc/sysconfig/rhn/allowed-actions/configfiles/all|xm,
- string => "mkdir -p /etc/sysconfig/rhn/allowed-actions/configfiles\n"
- . "touch /etc/sysconfig/rhn/allowed-actions/configfiles/all",
- position => 1,
- },
- enable_remote_command => {
- regexp => qr|^mkdir -p /etc/sysconfig/rhn/allowed-actions/script\n
- touch /etc/sysconfig/rhn/allowed-actions/script/all|xm,
- string => "mkdir -p /etc/sysconfig/rhn/allowed-actions/script\n"
- . "touch /etc/sysconfig/rhn/allowed-actions/script/all",
- position => 1,
- },
- import_rhn_gpg_key_rhel3 => {
- regexp => qr|^rpm --import /usr/share/rhn/RPM-GPG-KEY|m,
- string => "rpm --import /usr/share/rhn/RPM-GPG-KEY",
- position => 1,
- },
- import_rhn_gpg_key_rhel2_1 => {
- regexp => qr|^gpg $(up2date --gpg-flags) --batch --import /usr/share/rhn/RPM-GPG-KEY\n
- gpg $(up2date --gpg-flags) --batch --import /usr/share/rhn/RPM-GPG-KEY|xm,
- string => "gpg \$(up2date --gpg-flags) --batch --import /usr/share/rhn/RPM-GPG-KEY\n"
- . "gpg \$(up2date --gpg-flags) --batch --import /usr/share/rhn/RPM-GPG-KEY",
- position => 1,
- },
- rhnreg_ks_with_profile_name => {
- regexp => qr|^rhnreg_ks --activationkey=(\S+)|m,
- string => "rhnreg_ks --activationkey={key} --profilename=\"{profile_name}\"",
- position => 1,
- },
- rhnreg_ks => {
- regexp => qr|^rhnreg_ks --activationkey=(\S+)|m,
- string => "rhnreg_ks --activationkey={key}",
- position => 1,
- },
- up2date_conf_www => {
- regexp => qr|^perl -npe \'s/www.rhns.redhat.com/.*/\' -i /etc/sysconfig/rhn/up2date|m,
- string => "perl -npe 's/www.rhns.redhat.com/{kickstart_host}/' -i /etc/sysconfig/rhn/up2date",
- position => 1,
- },
- up2date_conf_xmlrpc => {
- regexp => qr|^perl -npe \'s/xmlrpc.rhn.redhat.com/.*/\' -i /etc/sysconfig/rhn/up2date|m,
- string => "perl -npe 's/xmlrpc.rhn.redhat.com/{kickstart_host}/' -i /etc/sysconfig/rhn/up2date",
- position => 1,
- },
- rhn_register_conf_www => {
- regexp => qr|^perl -npe \'s/www.rhns.redhat.com/.*/\' -i /etc/sysconfig/rhn/rhn_register|m,
- string => "perl -npe 's/www.rhns.redhat.com/{kickstart_host}/' -i /etc/sysconfig/rhn/rhn_register",
- position => 1,
- },
- rhn_register_conf_xmlrpc => {
- regexp => qr|^perl -npe \'s/xmlrpc.rhn.redhat.com/.*/\' -i /etc/sysconfig/rhn/rhn_register|m,
- string => q(perl -npe 's/xmlrpc.rhn.redhat.com/{kickstart_host}/' -i /etc/sysconfig/rhn/rhn_register),
- position => 1,
- },
- make_rhn_packages_dir => {
- regexp => qr|^mkdir -p /tmp/rhn_rpms/optional|m,
- string => "mkdir -p /tmp/rhn_rpms/optional",
- position => 1,
- },
- download_rhn_packages => {
- regexp => qr|^wget -P /tmp/rhn_rpms [^\n]*|m,
- string => "wget -P /tmp/rhn_rpms {urls}",
- position => 1,
- },
- download_optional_rhn_packages => {
- regexp => qr|^wget -P /tmp/rhn_rpms/optional [^\n]*|m,
- string => "wget -P /tmp/rhn_rpms/optional {urls}",
- position => 1,
- },
- freshen_rhn_packages => {
- regexp => qr|^rpm -Fvh /tmp/rhn_rpms/\*rpm|m,
- string => "rpm -Fvh /tmp/rhn_rpms/*rpm",
- position => 1,
- },
- update_rhn_package => {
- regexp => qr|^rpm -Uvh --replacepkgs --replacefiles (/tmp/rhn_rpms/optional/.*?\*)+|m,
- string => "rpm -Uvh --replacepkgs --replacefiles {packages}",
- position => 1,
- },
- rhn_check => {
- regexp => qr|^rhn_check$|m,
- string => "rhn_check",
- position => 1,
- },
- copy_out => {
- string => "\n# now copy from the ks-tree we saved in the non-chroot checkout\n" .
- "cp -fav /tmp/ks-tree-copy/* /\n" .
- "rm -Rf /tmp/ks-tree-copy",
- position => 2,
- },
- write_key_to_file => {
- regexp => qr!cat > /tmp/({type})-key-({index}) <<'EOF'.*EOF\n# \1-key-\2!sm,
- string => "cat > /tmp/{type}-key-{index} <<'EOF'\n{key}\nEOF\n# {type}-key-{index}",
- position => 1,
- },
- import_gpg_keys_rhel3 => {
- regexp => qr|rpm --import /tmp/gpg-key-({index})|m,
- string => 'rpm --import /tmp/gpg-key-{index}',
- position => 1,
- },
- import_gpg_keys_rhel2_1 => {
- regexp => qr|^gpg $(up2date --gpg-flags) --batch --import /tmp/gpg-key-({index})\n
- gpg $(up2date --gpg-flags) --batch --import /tmp/gpg-key-\1|xm,
- string => "gpg \$(up2date --gpg-flags) --batch --import /tmp/gpg-key-{index}\n"
- . "gpg \$(up2date --gpg-flags) --batch --import /tmp/gpg-key-{index}",
- position => 1,
- },
- import_ssl_keys => {
- regexp => qr|cat /tmp/ssl-key-\* > /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT|m,
- string => 'cat /tmp/ssl-key-* > /usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT',
- position => 1,
- },
- use_custom_ssl_keys => {
- regexp => qr|^perl -npe \'s/RHNS-CA-CERT/RHN-ORG-TRUSTED-SSL-CERT/g\' -i /etc/sysconfig/rhn/*|m,
- string => q(perl -npe 's/RHNS-CA-CERT/RHN-ORG-TRUSTED-SSL-CERT/g' -i /etc/sysconfig/rhn/*),
- position => 1,
- },
- start_log => {
- regexp => qr|^\( # Log \%post errors$|m,
- string => '( # Log %post errors',
- position => 0,
- },
- end_log => {
- regexp => qr|^\) > /root/ks-post\.log 2>&1$|m,
- string => ') > /root/ks-post.log 2>&1',
- },
- add_comment => {
- regexp => qr|^#always add new comments|,
- string => qq(\n# {comment}\n),
- position => 1,
- },
- set_resolv_conf => {
- regexp => qr|^cp /etc/resolv\.conf /mnt/sysimage/etc/resolv\.conf|,
- string => qq(cp /etc/resolv.conf /mnt/sysimage/etc/resolv.conf),
- position => 0,
- },
- # we use oldtmp below because, in rhel3, /oldtmp is
- # what we made on the initrd; /tmp is a ramfs copy (and
- # an imperffect copy that skips some files and doesn't
- # preserve directory permissions).
- copy_preserved_files => {
- string => "mkdir /mnt/sysimage/tmp/ks-tree-copy\n"
- . "if [ -d /oldtmp/ks-tree-shadow ]; then\n"
- . " cp -fa /oldtmp/ks-tree-shadow/* /mnt/sysimage/tmp/ks-tree-copy\n"
- . "elif [ -d /tmp/ks-tree-shadow ]; then\n"
- . " cp -fa /tmp/ks-tree-shadow/* /mnt/sysimage/tmp/ks-tree-copy\n"
- . "fi",
- position => 0,
- },
- );
-
-sub valid_helpers {
- return (keys %helpers);
-}
-
-sub check_for_line {
- my $self = shift;
- my $mode = shift;
-
- my $check = $self->as_string =~ $helpers{$mode}->{regexp};
- return $1 ? $1 : $check;
-}
-
-sub insert_line {
- my $self = shift;
- my $mode = shift;
- my $subst = shift;
-
- my $options = $helpers{$mode};
-
- if ($options->{regexp} && $self->as_string =~ $options->{regexp}) {
- my $regexp = $options->{regexp};
- $regexp = PXT::Utils->perform_substitutions($regexp, $subst);
- $$self =~ s/$regexp/PXT::Utils->perform_substitutions($options->{string}, $subst)/egsm;
- }
- else {
- my @lines = split(/\n/, $self->as_string);
-
- push @lines, (''); # make sure we append when position is '-1'
-
- if (defined $options->{position}) {
- splice(@lines, $options->{position}, 0, PXT::Utils->perform_substitutions($options->{string}, $subst));
- }
- else {
- push @lines, PXT::Utils->perform_substitutions($options->{string}, $subst);
- }
-
- $$self = join("\n", @lines);
- }
-
- return 1;
-}
-
-sub remove_line {
- my $self = shift;
- my $mode = shift;
-
- my ($index, $found);
- my @lines = split(/\n/, $self->as_string);
-
- for ($index = 0; $index <= $#lines; $index++) {
- if ($lines[$index] =~ $helpers{$mode}->{regexp}) {
- $found = 1;
- last;
- }
- }
-
- splice(@lines, $index, 1);
-
- $$self = join("\n", @lines);
- return 1;
-}
-
1;
commit 78abcf0b896d49e8054ca0fda5ad9a24b4b88437
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:10:39 2010 +0100
long_date_with_zone is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Date.pm b/web/modules/rhn/RHN/Date.pm
index 67db890..2af8a5b 100644
--- a/web/modules/rhn/RHN/Date.pm
+++ b/web/modules/rhn/RHN/Date.pm
@@ -179,14 +179,6 @@ sub short_date {
return $self->strftime("%Y-%m-%d");
}
-# helper function for our classical "long_date" format, with abbreviated zone name
-sub long_date_with_zone {
- my $self = shift;
- my $user = shift;
-
- return $self->long_date . " " . $self->user_short_timezone($user);
-}
-
# increment an RHN::Date object. parameters are passed straight
# through to the datetime add method, which basically is like
# "$foo->add(hours => 2, minutes => 7), etc
commit d54505a385c3f37203bae01e1b235c158eb8270f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:09:30 2010 +0100
lookup_widget_value is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Form/Response.pm b/web/modules/rhn/RHN/Form/Response.pm
index eb0499d..3c4450a 100644
--- a/web/modules/rhn/RHN/Form/Response.pm
+++ b/web/modules/rhn/RHN/Form/Response.pm
@@ -97,14 +97,4 @@ sub status {
return 'partial';
}
-sub lookup_widget_value {
- my $self = shift;
- my $var = shift;
-
- my $widget = $self->lookup_widget($var);
- return unless defined $widget;
-
- return $widget->value;
-}
-
1;
14 years, 3 months
6 commits - web/modules web/spacewalk-web.spec
by Jan Pazdziora
web/modules/grail/Grail/Canvas.pm | 1
web/modules/rhn/MANIFEST | 2
web/modules/rhn/RHN/DB/Grail.pm | 88 ---------------------------------
web/modules/rhn/RHN/Grail.pm | 42 ---------------
web/modules/rhn/RHN/Mail.pm | 24 ---------
web/modules/sniglets/Sniglets/Users.pm | 1
web/spacewalk-web.spec | 1
7 files changed, 159 deletions(-)
New commits:
commit cc90057426168337405cb05a5d352b4e04b3bcf2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:08:14 2010 +0100
Previous removals made RHN::Grail and RHN::DB::Grail noops, removing.
diff --git a/web/modules/grail/Grail/Canvas.pm b/web/modules/grail/Grail/Canvas.pm
index e40c93b..b43ce1e 100644
--- a/web/modules/grail/Grail/Canvas.pm
+++ b/web/modules/grail/Grail/Canvas.pm
@@ -17,7 +17,6 @@ use strict;
package Grail::Canvas;
use Grail::Component;
-use RHN::Grail;
use Carp;
@Grail::Canvas::ISA = qw/Grail::Component/;
diff --git a/web/modules/rhn/MANIFEST b/web/modules/rhn/MANIFEST
index ce301a0..c543ae8 100644
--- a/web/modules/rhn/MANIFEST
+++ b/web/modules/rhn/MANIFEST
@@ -10,7 +10,6 @@ RHN/DB/Action.pm
RHN/DB/ChannelEditor.pm
RHN/DB/Channel.pm
RHN/DB/Errata.pm
-RHN/DB/Grail.pm
RHN/DB/JoinClass.pm
RHN/DB/Notes.pm
RHN/DB/Org.pm
@@ -34,7 +33,6 @@ RHN/DB/UserGroup.pm
RHN/DB/User.pm
RHN/Errata.pm
RHN/Exception.pm
-RHN/Grail.pm
RHN/Mail.pm
RHN/Org.pm
RHN/Package.pm
diff --git a/web/modules/rhn/RHN/DB/Grail.pm b/web/modules/rhn/RHN/DB/Grail.pm
deleted file mode 100644
index b637553..0000000
--- a/web/modules/rhn/RHN/DB/Grail.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::Grail;
-use RHN::DB;
-
-1;
diff --git a/web/modules/rhn/RHN/Grail.pm b/web/modules/rhn/RHN/Grail.pm
deleted file mode 100644
index 488f1ea..0000000
--- a/web/modules/rhn/RHN/Grail.pm
+++ /dev/null
@@ -1,20 +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::Grail;
-
-1;
diff --git a/web/modules/sniglets/Sniglets/Users.pm b/web/modules/sniglets/Sniglets/Users.pm
index 40f4c87..eec09c4 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -21,7 +21,6 @@ use PXT::Utils;
use RHN::User;
use RHN::Org;
-use RHN::Grail;
use PXT::HTML;
use RHN::UserActions;
use RHN::Exception qw/throw catchable/;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 72db751..3b57581 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -169,7 +169,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/FileList.pm
%{perl_vendorlib}/RHN/Form.pm
%{perl_vendorlib}/RHN/Form/
-%{perl_vendorlib}/RHN/Grail.pm
%{perl_vendorlib}/RHN/I18N.pm
%{perl_vendorlib}/RHN/KSTree.pm
%{perl_vendorlib}/RHN/Kickstart.pm
commit bff563dc580ac06b788b07f8c6fc4713f085f65d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:06:21 2010 +0100
Removal of components_for_user and set_user_components in RHN::Grail made them unused in RHN::DB::Grail as well, removing.
diff --git a/web/modules/rhn/RHN/DB/Grail.pm b/web/modules/rhn/RHN/DB/Grail.pm
index 4ef0b39..b637553 100644
--- a/web/modules/rhn/RHN/DB/Grail.pm
+++ b/web/modules/rhn/RHN/DB/Grail.pm
@@ -18,50 +18,4 @@ use strict;
package RHN::DB::Grail;
use RHN::DB;
-sub components_for_user {
- my $class = shift;
- my $user_id = shift;
-
- my $dbh = RHN::DB->connect;
- my $query = "SELECT component_pkg, component_mode FROM rhnGrailComponentChoices WHERE user_id = ? ORDER BY ordering";
- my $sth = $dbh->prepare($query);
- $sth->execute($user_id);
-
- my @ret;
- while (my ($pkg, $mode) = $sth->fetchrow) {
- push @ret, [ $pkg, $mode ];
- }
-
- return @ret;
-}
-
-sub set_user_components {
- my $class = shift;
- my $uid = shift;
- my @components = @_;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOQ;
-DELETE FROM rhnGrailComponentChoices WHERE user_id = ?
-EOQ
- my $sth = $dbh->prepare($query);
- $sth->execute($uid);
-
- $query = <<EOQ;
-INSERT INTO rhnGrailComponentChoices
- SELECT ?, ?, component_pkg, component_mode
- FROM rhnGrailComponents GC
- WHERE GC.id = ?
-EOQ
- $sth = $dbh->prepare($query);
-
- my $i = 0;
- foreach (@components) {
- $sth->execute($uid, $i++, $_);
- }
-
- $dbh->commit;
-
-}
-
1;
commit 19fb72fa640e3bca273f038c41954134e359dd79
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:05:35 2010 +0100
components_for_user and set_user_components is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Grail.pm b/web/modules/rhn/RHN/Grail.pm
index c1feeb2..488f1ea 100644
--- a/web/modules/rhn/RHN/Grail.pm
+++ b/web/modules/rhn/RHN/Grail.pm
@@ -17,19 +17,4 @@ use strict;
package RHN::Grail;
-use RHN::DB::Grail;
-
-sub components_for_user {
- my $class = shift;
- my $user = shift;
-
- return RHN::DB::Grail->components_for_user($user);
-}
-
-sub set_user_components {
- my $class = shift;
-
- RHN::DB::Grail->set_user_components(@_);
-}
-
1;
commit 1d96c4ebc19d9db830ea2ad682e8206c51bef335
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:04:19 2010 +0100
Removal of components_available_for_user made components_available unused, removing.
diff --git a/web/modules/rhn/RHN/DB/Grail.pm b/web/modules/rhn/RHN/DB/Grail.pm
index 32eaa2f..4ef0b39 100644
--- a/web/modules/rhn/RHN/DB/Grail.pm
+++ b/web/modules/rhn/RHN/DB/Grail.pm
@@ -35,27 +35,6 @@ sub components_for_user {
return @ret;
}
-sub components_available {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOQ;
- SELECT component_pkg, component_mode, config_mode, component_label, NVL(UGT.label, ''), GC.id
- FROM rhnGrailComponents GC, rhnUserGroupType UGT
- WHERE UGT.id(+) = role_required
- ORDER BY UPPER(component_label), component_pkg, component_mode
-EOQ
- my $sth = $dbh->prepare($query);
- $sth->execute;
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
sub set_user_components {
my $class = shift;
my $uid = shift;
commit 621f611fe267296d1ef8a87167be4a1e32331bc5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:03:41 2010 +0100
components_available_for_user is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Grail.pm b/web/modules/rhn/RHN/Grail.pm
index 4771ae1..c1feeb2 100644
--- a/web/modules/rhn/RHN/Grail.pm
+++ b/web/modules/rhn/RHN/Grail.pm
@@ -26,13 +26,6 @@ sub components_for_user {
return RHN::DB::Grail->components_for_user($user);
}
-sub components_available_for_user {
- my $class = shift;
- my $user = shift;
-
- return grep { $_->[4] ? $user->is($_->[4]) : 1 } RHN::DB::Grail->components_available;
-}
-
sub set_user_components {
my $class = shift;
commit 497f50dfe7f3d934c60c340ee88cce862941cdf7
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:03:05 2010 +0100
send_raw is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Mail.pm b/web/modules/rhn/RHN/Mail.pm
index 542ebb2..a4cd355 100644
--- a/web/modules/rhn/RHN/Mail.pm
+++ b/web/modules/rhn/RHN/Mail.pm
@@ -22,30 +22,6 @@ use Params::Validate;
my @header_order = qw/To From Subject/;
my $DEFAULT_FROM = PXT::Config->get('default_mail_from');
-sub send_raw {
- my $class = shift;
- my $data = shift;
-
- my $sendmail_from = $DEFAULT_FROM;
- my @command = ('/usr/sbin/sendmail', '-t', '-oi', "-f'$sendmail_from'");
-
- $ENV{PATH} = "/bin:/usr/bin";
-
- my $command = join(' ', @command);
- open SM, "|$command"
- or die "Can't spawn sendmail: $!";
-
- print SM $data;
- if (not close SM) {
- if ($!) {
- die "Can't close sendmail: $!";
- }
- else {
- warn "sendmail returned failure code $?";
- }
- }
-}
-
# given a list of possible recipients, validate they're allowed to receive
# email in the current environment
sub validate_allowed_recipients {
14 years, 3 months
9 commits - web/modules web/spacewalk-web.spec
by Jan Pazdziora
web/modules/rhn/RHN/Action.pm | 8
web/modules/rhn/RHN/DB/CryptoKey.pm | 9
web/modules/rhn/RHN/DB/Entitlements.pm | 14 -
web/modules/rhn/RHN/DB/ServerGroup.pm | 200 --------------------
web/modules/rhn/RHN/DB/Set.pm | 41 ----
web/modules/rhn/RHN/Daemon.pm | 322 ---------------------------------
web/modules/rhn/RHN/Org.pm | 8
web/modules/rhn/RHN/SystemSnapshot.pm | 8
web/spacewalk-web.spec | 1
9 files changed, 611 deletions(-)
New commits:
commit c39564c0f673ad78e5143522df71db2ff26c8ad5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:02:06 2010 +0100
RHN::Daemon not use'd anywhere, removing.
diff --git a/web/modules/rhn/RHN/Daemon.pm b/web/modules/rhn/RHN/Daemon.pm
deleted file mode 100644
index e9fcb85..0000000
--- a/web/modules/rhn/RHN/Daemon.pm
+++ /dev/null
@@ -1,322 +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::Daemon;
-
-use PXT::Config;
-
-use Params::Validate;
-Params::Validate::validation_options(strip_leading => "-");
-
-use Proc::Daemon;
-use Unix::Syslog qw/:subs :macros/;
-use POSIX ":sys_wait_h", 'strftime';
-
-use constant TRACE => 3;
-use constant DEBUG => 2;
-use constant INFO => 1;
-use constant SILENT => 0;
-
-sub new {
- my $class = shift;
- my $name = shift;
-
- my $self = bless {}, $class;
- $self->{name} = $name if $name;
- $self->{loglevel} = LOG_LOCAL7;
-
- return $self;
-}
-
-sub become_daemon {
- my $self = shift;
-
- $self->die("can't call become_daemon unless no children and not a child") if $self->{children} or $self->{parent};
- Proc::Daemon::Init();
-
- umask 077;
-
- my %facilities =
- (
- local0 => LOG_LOCAL0,
- local1 => LOG_LOCAL1,
- local2 => LOG_LOCAL2,
- local3 => LOG_LOCAL3,
- local4 => LOG_LOCAL4,
- local5 => LOG_LOCAL5,
- local6 => LOG_LOCAL6,
- local7 => LOG_LOCAL7,
- );
-
- my $facility = PXT::Config->get('daemon_logging_facility');
- die "Invalid daemon logging facility '$facility'"
- unless exists $facilities{$facility};
-
- openlog $0, LOG_ODELAY|LOG_PID, $facilities{$facility};
- $self->{logging} = 1;
-}
-
-sub info {
- my $self = shift;
- my $msg = shift;
-
- $self->log_message(-level => INFO, -msg => $msg);
-}
-
-sub debug {
- my $self = shift;
- my $msg = shift;
-
- $self->log_message(-level => DEBUG, -msg => $msg);
-}
-
-sub trace {
- my $self = shift;
- my $msg = shift;
-
- $self->log_message(-level => TRACE, -msg => $msg);
-}
-
-sub log_message {
- my $self = shift;
- my %params = validate(@_, { -level => 1, -msg => 1 });
-
- return if $self->current_log_level < $params{level};
-
- if ($self->{logging}) {
- syslog(LOG_INFO, $params{msg});
- }
- else {
- warn sprintf "[ %s ] %s\n", strftime("%Y-%m-%d %H:%M:%S", localtime time), $params{msg};
- }
-}
-
-sub current_log_level {
- my $level = PXT::Config->get('daemon_debug_level');
-
- die "Invalid log level: $level" if $level < SILENT or $level > TRACE;
-
- return $level;
-}
-
-sub die {
- my $self = shift;
- my $msg = shift;
-
- $self->info($msg) if $self->{logging};
- die $msg;
-}
-
-sub write_pidfile {
- my $self = shift;
- my $file = shift;
-
- $self->die("pidfile called but no name or file") unless $file or $self->{name};
- $file ||= "/var/run/" . $self->{name} . ".pid";
-
- open PID, ">$file"
- or $self->die("Can't write pidfile $file: $!");
- print PID "$$\n";
- close PID;
-}
-
-sub new_child {
- my $self = shift;
- my $coderef = shift;
-
- $self->die("$coderef not a CODEREF") if $coderef and ref($coderef) ne 'CODE';
-
- $self->die("process is already a child") if $self->{parent};
-
- my $parent = $$;
- my $pid = fork();
- $self->die("bad fork? $!") unless defined $pid;
-
- if ($pid) {
- my $child = RHN::Daemon::Child->new($pid);
- push @{$self->{children}}, $child;
-
- return $child;
- }
- else {
- $self->{parent} = $parent;
-
- # coderef passed? if so, call it, then exit.
- if ($coderef) {
- eval {
- $coderef->($self);
- };
- $self->info($@) if $@;
-
- exit 0;
- }
-
- return;
- }
-}
-
-sub parent_alive {
- my $self = shift;
-
- return (getppid() == $self->{parent}) ? 1 : 0;
-}
-
-sub find_child {
- my $self = shift;
- my $pid = shift;
-
- my ($child) = grep { $_->pid == $pid } @{$self->{children}};
- $self->die("no child with pid $pid?") unless $child;
-
- return $child;
-}
-
-sub remove_child {
- my $self = shift;
- my $pid = shift;
-
- my @new_children;
- my $ret;
-
- foreach my $child (@{$self->{children}}) {
- if ($child->pid == $pid) {
- $ret = $child;
- }
- else {
- push @new_children, $child;
- }
- }
-
- $self->{children} = \@new_children;
- return $ret;
-}
-
-sub wait_for_children {
- my $self = shift;
- my $nohang = shift;
-
- my $pid = waitpid(-1, $nohang ? WNOHANG : 0);
-
- # if error was no processes, ignore it, otherwise die
- if ($nohang and $pid == 0) {
- return;
- }
- if ($pid < 0) {
- if (0 + $! != 10) {
- $self->die("waitpid: $!");
- }
- return;
- }
-
- my $child = $self->remove_child($pid);
- $child->exit_status($?);
-
- return $child;
-}
-
-sub signal_children {
- my $self = shift;
- my $sig = shift;
-
- foreach my $child (@{$self->{children}}) {
- kill $sig, $child->pid;
- }
-}
-
-sub reap_children {
- my $self = shift;
-
- my @ret;
- while (my $child = $self->wait_for_children(1)) {
- push @ret, $child;
- }
-
- return @ret;
-}
-
-sub kill_children {
- my $self = shift;
-
- return unless $self->{children} and @{$self->{children}};
-
- my @ret;
- my $tries = 0;
-
- while($tries < 3 and @{$self->{children}}) {
- $self->signal_children("TERM");
- sleep 1;
-
- push @ret, $self->reap_children;
-
- $tries++;
- }
-
- if (not @{$self->{children}}) {
- return @ret;
- }
-
- warn "Children still left after $tries tries. Killing harder.";
-
- $self->signal_children("KILL");
- sleep 1;
-
- push @ret, $self->reap_children;
-
- return @ret;
-}
-
-package RHN::Daemon::Child;
-use POSIX ":sys_wait_h";
-
-sub new {
- my $class = shift;
- my $pid = shift;
- die "no pid" unless $pid;
-
- my $self = bless { pid => $pid }, $class;
-
- return $self;
-}
-
-sub pid {
- return shift->{pid};
-}
-
-sub running {
- my $self = shift;
-
- my $result = waitpid($self->pid, WNOHANG);
-
- if ($result == 0) {
- return 1;
- }
- else {
- $self->exit_status($?);
- return 0;
- }
-}
-
-sub exit_status {
- my $self = shift;
- my $exit_status = shift;
-
- $self->{exit_status} = $exit_status if defined $exit_status;
-
- return $self->{exit_status};
-}
-
-1;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index fd0aae5..72db751 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -158,7 +158,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/CryptoKey.pm
%{perl_vendorlib}/RHN/CustomInfoKey.pm
%{perl_vendorlib}/RHN/DB/
-%{perl_vendorlib}/RHN/Daemon.pm
%{perl_vendorlib}/RHN/DataSource.pm
%{perl_vendorlib}/RHN/DataSource/
%{perl_vendorlib}/RHN/Date.pm
commit 7dfac9a027785449ccd0b1b726f679aecf5aa3ae
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:01:08 2010 +0100
lookup_org is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Org.pm b/web/modules/rhn/RHN/Org.pm
index c4a5dd5..2a2e29c 100644
--- a/web/modules/rhn/RHN/Org.pm
+++ b/web/modules/rhn/RHN/Org.pm
@@ -36,12 +36,4 @@ sub lookup {
}
}
-sub lookup_org {
- my $class = shift;
-
- warn "deprecated use of $class->lookup_foo from (" . join(', ', caller) . "). Using $class->lookup instead\n";
-
- return $class->lookup(@_);
-}
-
1;
commit cac906bbb922860ac8b104d59171104766f80e01
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 18:00:49 2010 +0100
lookup_action is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/Action.pm b/web/modules/rhn/RHN/Action.pm
index 0e257c1..43af538 100644
--- a/web/modules/rhn/RHN/Action.pm
+++ b/web/modules/rhn/RHN/Action.pm
@@ -36,12 +36,4 @@ sub lookup {
}
}
-sub lookup_action {
- my $class = shift;
-
- warn "deprecated use of $class->lookup_foo from (" . join(', ', caller) . "). Using $class->lookup instead\n";
-
- return $class->lookup(@_);
-}
-
1;
commit 19d42341aa3e2cea20108f7d639589118c036080
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:58:01 2010 +0100
lookup_snapshot is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/SystemSnapshot.pm b/web/modules/rhn/RHN/SystemSnapshot.pm
index 5049c1b..5043bc3 100644
--- a/web/modules/rhn/RHN/SystemSnapshot.pm
+++ b/web/modules/rhn/RHN/SystemSnapshot.pm
@@ -36,12 +36,4 @@ sub lookup {
}
}
-sub lookup_snapshot {
- my $class = shift;
-
- warn "deprecated use of $class->lookup_foo from (" . join(', ', caller) . "). Using $class->lookup instead\n";
-
- return $class->lookup(@_);
-}
-
1;
commit 9dc1e2c55debbfea83427cc6d00fd4a5a553bd80
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:57:45 2010 +0100
lookup_group_type_id is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Entitlements.pm b/web/modules/rhn/RHN/DB/Entitlements.pm
index efd653a..ef5dccf 100644
--- a/web/modules/rhn/RHN/DB/Entitlements.pm
+++ b/web/modules/rhn/RHN/DB/Entitlements.pm
@@ -50,20 +50,6 @@ sub is_valid_entitlement {
}
-sub lookup_group_type_id {
- my $class = shift;
- my $entitlement = shift;
-
- my @all = $class->valid_system_entitlements();
- my ($match) = grep { $_->{LABEL} eq $entitlement } @all;
-
- unless ($match) {
- throw "(no_group_type) No server group type '$entitlement' found";
- }
-
- return $match->{ID};
-}
-
sub entitlement_feature_map {
my $class = shift;
commit d4e5d2ae21736123b6f5e7ac892f8c39c04a9245
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:57:31 2010 +0100
org_key_list is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/CryptoKey.pm b/web/modules/rhn/RHN/DB/CryptoKey.pm
index f928929..7f1d55d 100644
--- a/web/modules/rhn/RHN/DB/CryptoKey.pm
+++ b/web/modules/rhn/RHN/DB/CryptoKey.pm
@@ -161,15 +161,6 @@ EOQ
$self->crypto_key_type_id($row->{ID});
}
-sub org_key_list {
- my $class = shift;
- my $org_id = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "General_queries");
- $ds->mode("crypto_keys_for_org");
- return $ds->execute_query(-org_id => $org_id);
-}
-
sub key_type_list {
my $class = shift;
commit e2a9ed0e9bb12dc0f92fc430792340bb3f534495
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:56:51 2010 +0100
retrieve is not called from Perl stack, removing.
diff --git a/web/modules/rhn/RHN/DB/ServerGroup.pm b/web/modules/rhn/RHN/DB/ServerGroup.pm
index 94f97f2..db6fe27 100644
--- a/web/modules/rhn/RHN/DB/ServerGroup.pm
+++ b/web/modules/rhn/RHN/DB/ServerGroup.pm
@@ -239,28 +239,6 @@ EOQ
$dbh->commit();
}
-=head1 retrieve
-
-arguments - $group_id (scalar) - the group_id to be retrieved
-returns - list
-
-=cut
-
-sub retrieve {
- my $class = shift;
- my $group_id = shift;
-
- my $dbh = RHN::DB->connect;
-
- my $query ='SELECT ' . join(', ', @server_group) . ' FROM ' . $t->table_name . ' where id = ?';
- my $sth = $dbh->prepare($query);
- $sth->execute($group_id);
- my @data = $sth->fetchrow();
- $sth->finish;
-
- return @data;
-}
-
sub server_group_list {
my $self = shift;
my $org_id = shift;
commit 14b1a86313bcc6bc4a5b20f1f8e2cfe3c1cc4c64
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:54:35 2010 +0100
Removing bunch of unused methods from RHN::DB::ServerGroup:
servers_in_groups
groups_in_org_overview
group_overview
tri_state_server_group_list
diff --git a/web/modules/rhn/RHN/DB/ServerGroup.pm b/web/modules/rhn/RHN/DB/ServerGroup.pm
index 199e8d8..94f97f2 100644
--- a/web/modules/rhn/RHN/DB/ServerGroup.pm
+++ b/web/modules/rhn/RHN/DB/ServerGroup.pm
@@ -261,184 +261,6 @@ sub retrieve {
return @data;
}
-=head1 list
-
-arguments - $group_id
-returns - list of serverId's in group
-
-=cut
-
-sub servers_in_groups {
- my $class = shift;
- my $groups = shift;
- my $bounds = shift;
- my @columns = @_;
-
- if (not ref $bounds or ref $bounds ne 'ARRAY') {
- unshift @columns, $bounds;
- $bounds = [ 1, 1_000_000 ];
- }
-
- $groups = [ $groups ] unless ref $groups;
- @columns = ('S.ID') unless @columns;
-
- my $dbh = RHN::DB->connect;
-
- my $query = sprintf <<EOQ, join(", ", @columns), join(", ", ("?") x @$groups);
-SELECT %s
-FROM rhnServerGroupMembers SGM, rhnServer S, rhnServerArch SA
-WHERE SGM.server_group_id IN (%s) AND
- SGM.server_id = S.id AND
- S.server_arch_id = SA.id
-EOQ
-
- my $sth = $dbh->prepare($query);
- $sth->execute(@$groups);
-
- my @result;
-
- my $i = 1;
- while ( my (@data) = $sth->fetchrow ) {
- if ( $i >= $bounds->[0] and $i <= $bounds->[1]) {
- push ( @result, \@data );
- } else {
- last;
- }
- $i++
- }
-
- $sth->finish;
-
- return @result;
-}
-
-sub groups_in_org_overview {
- my $class = shift;
- my %params = @_;
-
- my ($org_id, $user_id, $lower, $upper, $total_ref, $mode, $mode_params, $all_ids) =
- map { $params{"-" . $_} } qw/org_id user_id lower upper total_rows mode mode_params all_ids/;
-
- my $dbh = RHN::DB->connect;
- my $query;
-
- if ($mode eq 'server') {
- $query = <<EOS;
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, GO.GROUP_ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT, NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS
- FROM rhnVisServerGroupOverview GO, rhnServerGroupMembers SGM
- WHERE GO.ORG_ID = ?
- AND SGM.server_group_id = GO.group_id
- AND SGM.server_id = ?
- AND EXISTS (SELECT 1 FROM rhnUserServerGroupPerms WHERE server_group_id = GO.group_id AND user_id = ?)
-ORDER BY UPPER(GROUP_NAME), GO.GROUP_ID
-EOS
- }
- elsif ($mode eq 'user') {
- $query = <<EOS;
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, GO.GROUP_ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT, NOTE_COUNT, GO.MODIFIED, GO.MAX_MEMBERS
- FROM rhnVisServerGroupOverview GO, rhnUserManagedServerGroups UMSG
- WHERE GO.ORG_ID = ?
- AND GO.GROUP_ID = UMSG.server_group_id
- AND UMSG.user_id = ?
-ORDER BY UPPER(GROUP_NAME), GO.GROUP_ID
-EOS
- }
- elsif ($mode eq 'set') {
- $query = <<EOS;
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, GROUP_ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT, NOTE_COUNT, MODIFIED, MAX_MEMBERS
- FROM rhnVisServerGroupOverview, rhnSet RS
- WHERE ORG_ID = ? AND GROUP_ID = RS.element AND RS.label = ? AND RS.user_id = ?
-ORDER BY UPPER(GROUP_NAME), GROUP_ID
-EOS
- }
- else {
- $query = <<EOS;
-SELECT SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA, GROUP_ID, GROUP_NAME, GROUP_ADMINS, SERVER_COUNT, NOTE_COUNT, MODIFIED, MAX_MEMBERS
- FROM rhnVisServerGroupOverview
- WHERE ORG_ID = ?
-ORDER BY UPPER(GROUP_NAME), GROUP_ID
-EOS
- }
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id, @{ref $mode_params ? $mode_params : [ $mode_params ]});
-
- my @result;
- my $i = 1;
- $$total_ref = 0;
-
- while (my @data = $sth->fetchrow) {
- push @$all_ids, $data[3] if $all_ids;
- $$total_ref = $i;
- if ($i >= $lower and $i <= $upper) {
- push @result, [ @data ];
- }
- $i++;
- }
- $sth->finish;
- return @result;
-}
-
-# return is:
-# [ server_id, server_name, numadmins, numgroups_server_is_in, updated ]
-sub group_overview {
- my $class = shift;
- my $group_id = shift;
- my ($lower, $upper) = @_;
- $lower ||= 1;
- $upper ||= 100000;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOQ;
-SELECT SERVER_ID, SERVER_NAME, 0, GROUP_COUNT, MODIFIED
-FROM rhnServerOverview
-WHERE SERVER_GROUP_ID = ?
-ORDER BY UPPER(S.NAME), S.ID
-EOQ
-
- my $sth = $dbh->prepare($query);
-
- $sth->execute($group_id);
-
- my @result;
- my $i = 1;
- while (my @data = $sth->fetchrow) {
- if ($i >= $lower and $i <= $upper) {
- push @result, [ @data, 0 ];
- } else {
- last;
- }
- $i++;
- }
- $sth->finish;
- return @result;
-}
-
-sub tri_state_server_group_list {
- my $self = shift;
- my $org_id = shift;
-
- my $dbh = RHN::DB->connect;
- my $query = <<EOS;
-SELECT SGO.group_id, SGO.group_name
- FROM rhnServerGroup SG, rhnServerGroupOverview SGO
- WHERE SGO.org_id = ?
- AND SGO.group_id = SG.id
- AND SG.group_type IS NULL
-ORDER BY UPPER (SGO.group_name)
-EOS
-
- my $sth = $dbh->prepare($query);
- $sth->execute($org_id);
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
sub server_group_list {
my $self = shift;
my $org_id = shift;
commit 89cda6992163d78aa614f92449c928b571e99f8a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 17:53:06 2010 +0100
immediate_add and immediate_remove not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/DB/Set.pm b/web/modules/rhn/RHN/DB/Set.pm
index 801e751..cebf2f0 100644
--- a/web/modules/rhn/RHN/DB/Set.pm
+++ b/web/modules/rhn/RHN/DB/Set.pm
@@ -99,47 +99,6 @@ sub add {
@{$self->{contents}}{@vals} = (1) x @vals;
}
-sub immediate_add {
- my $self = shift;
- my @vals = @_;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("INSERT INTO rhnSet (user_id, label, element, element_two) VALUES (?, ?, ?, ?)");
-
- for my $val (@vals) {
- if (ref $val) {
- $sth->execute($self->uid, $self->label, $val->[0], $val->[1])
- unless exists $self->{contents}->{join("|", @$val)};
- }
- else {
- $sth->execute($self->uid, $self->label, $val, undef)
- unless exists $self->{contents}->{$val};
- }
- }
-
- $self->add(@vals);
-}
-
-sub immediate_remove {
- my $self = shift;
- my @vals = @_;
-
- my $dbh = RHN::DB->connect;
-
- for my $val (@vals) {
- if (ref $val) {
- my $sth = $dbh->prepare("DELETE FROM rhnSet WHERE user_id = ? AND label = ? AND element = ? AND element_two = ?");
- $sth->execute($self->uid, $self->label, $val->[0], $val->[1]);
- }
- else {
- my $sth = $dbh->prepare("DELETE FROM rhnSet WHERE user_id = ? AND label = ? AND element = ?");
- $sth->execute($self->uid, $self->label, $val);
- }
- }
-
- $self->remove(@vals);
-}
-
sub remove {
my $self = shift;
my @vals = @_;
14 years, 3 months