web/modules/rhn/RHN/DB/Channel.pm | 62 -----------
web/modules/rhn/RHN/DB/Org.pm | 60 -----------
web/modules/rhn/RHN/DB/Server.pm | 58 ----------
web/modules/sniglets/Sniglets/Org.pm | 189 -----------------------------------
4 files changed, 369 deletions(-)
New commits:
commit 2a0bc3f80725fe3706c85291b5700a0645b59eb4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:51:49 2009 +0100
Previous change made satellite_channels_by_version obsolete, removing as dead code;
throw the %sat_chans_by_version in (out) as well.
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index 4676ae8..65d11ba 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -289,42 +289,6 @@ sub trusted_orgs {
# Channel package functions
################################
-my %sat_chans_by_version = ('1.0' =>
['redhat-rhn-satellite-as-i386-2.1', 'redhat-rhn-satellite-i386-7.2'],
- '2.0' => ['redhat-rhn-satellite-2.0-as-i386-2.1',
'redhat-rhn-satellite-2.0-i386-7.2'],
- '2.1' => ['redhat-rhn-satellite-2.1-as-i386-2.1'],
- '2.99' => ['redhat-rhn-satellite-2.99beta-as-i386-2.1'],
- '3.2' => ['redhat-rhn-satellite-3.2-as-i386-2.1'],
- '3.4' => ['redhat-rhn-satellite-3.4-as-i386-2.1'],
- '3.5' => ['redhat-rhn-satellite-3.5-as-i386-2.1',
'redhat-rhn-satellite-3.5-as-i386-3'],
- '3.6' => ['redhat-rhn-satellite-3.6-as-i386-2.1',
'redhat-rhn-satellite-3.6-as-i386-3'],
- '3.7' => ['redhat-rhn-satellite-3.7-as-i386-2.1',
'redhat-rhn-satellite-3.7-as-i386-3',
- 'redhat-rhn-satellite-3.7-as-i386-4'],
- '4.0' => ['redhat-rhn-satellite-4.0-as-x86_64-4',
- 'redhat-rhn-satellite-4.0-as-i386-3',
- 'redhat-rhn-satellite-4.0-as-i386-4',
- ],
- '4.1' => ['redhat-rhn-satellite-4.1-as-i386-3',
- 'redhat-rhn-satellite-4.1-as-i386-4',
- ],
- '4.2' =>
['redhat-rhn-satellite-4.2-as-i386-3',
- 'redhat-rhn-satellite-4.2-as-i386-4',
- ],
- '5.0' => ['redhat-rhn-satellite-5.0-as-i386-4',
- 'redhat-rhn-satellite-5.0-server-i386-5',
- ],
- );
-
-sub satellite_channels_by_version {
- my $class = shift;
- my %params = validate(@_, { version => {type => Params::Validate::SCALAR } });
-
- if (not exists $sat_chans_by_version{$params{version}}) {
- die "invalid satellite version";
- }
-
- return @{$sat_chans_by_version{$params{version}}};
-}
-
my %proxy_chans_by_version = ('1.1' =>
['redhat-rhn-proxy-as-i386-2.1', 'redhat-rhn-proxy-i386-7.2'],
'3.2' => ['redhat-rhn-proxy-3.2-as-i386-2.1'],
'3.6' => ['redhat-rhn-proxy-3.6-as-i386-2.1',
'redhat-rhn-proxy-3.6-as-i386-3'],
commit fe222cd8d0740209b726c8ff088c222eef739b52
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:50:27 2009 +0100
Previous change made satellite_channel_versions obsolete, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index da58a90..4676ae8 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -314,11 +314,6 @@ my %sat_chans_by_version = ('1.0' =>
['redhat-rhn-satellite-as-i386-2.1', 'redha
],
);
-sub satellite_channel_versions {
- my $class = shift;
- return sort(keys %sat_chans_by_version);
-}
-
sub satellite_channels_by_version {
my $class = shift;
my %params = validate(@_, { version => {type => Params::Validate::SCALAR } });
commit a355c5b5278158bc636f1695a8543f2d911ae39c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:49:21 2009 +0100
sat_channel_by_version not used anywyere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index b73d96a..1776956 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -755,44 +755,6 @@ EOQ
-# given a base channel id plus satellite certificate satellite-version value,
-# return satellite channel info...
-sub sat_channel_by_version {
- my $self = shift;
- my %params = validate(@_, { version => { type => Params::Validate::SCALAR } });
-
- my @potential_chans = RHN::Channel->satellite_channels_by_version(-version =>
$params{version});
-
- return unless @potential_chans;
-
- my $num_potentials = scalar @potential_chans;
-
- my $base_channel_id = $self->base_channel_id;
- die "no base channel!?" unless $base_channel_id;
-
- my $query = sprintf(<<EOQ, join(", ", map {":chan$_"}
(1..$num_potentials)));
-SELECT DISTINCT C.id AS CHANNEL_ID, C.label AS CHANNEL_LABEL
- FROM rhnChannel C
- WHERE C.label IN (%s)
- AND C.parent_channel = :base_channel_id
-EOQ
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare($query);
-
- my %args = (base_channel_id => $base_channel_id);
- foreach my $placeholder (map {"chan$_"} (1..$num_potentials)) {
- $args{$placeholder} = pop @potential_chans;
- }
-
- $sth->execute_h(%args);
-
- my $sat_channel_info = $sth->fetchrow_hashref;
- $sth->finish;
-
- return $sat_channel_info;
-}
-
sub deactivate_proxy {
my $self = shift;
my $transaction = shift;
commit 9efbf02a1b96b1a25d5ddb7135ad90b2cbd6e962
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:46:45 2009 +0100
Previous change made family_details_by_label obsolete, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index 5edfcad..da58a90 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -1350,27 +1350,6 @@ EOQ
return $row;
}
-sub family_details_by_label {
- my $class = shift;
- my $label = shift;
-
- die "No channel family label" unless defined $label;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT CF.id, CF.name, CF.label, CF.product_url, CF.org_id
- FROM rhnChannelFamily CF
- WHERE CF.label = :label
-EOQ
-
- $sth->execute_h(label => $label);
- my ($row) = $sth->fetchrow_hashref;
-
- $sth->finish;
-
- return $row;
-}
-
sub family_details_from_set {
commit d13864e6cb1f9af96f87fa9d2acb87dd55017c6a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:45:19 2009 +0100
Previous change made server_group_type_ids_by_label obsolete, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index 03b6dc7..b73d96a 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -3896,26 +3896,6 @@ EOQ
return $row;
}
-sub server_group_type_ids_by_label {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT label, id
- FROM rhnServerGroupType
-EOQ
-
-
- $sth->execute();
-
- my $ret;
- while (my $row = $sth->fetchrow_hashref) {
- $ret->{$row->{LABEL}} = $row->{ID};
- }
-
- return $ret;
-}
-
sub server_group_type_details_from_set {
my $class = shift;
my $uid = shift;
commit 119b6fdf1252034653a4a06b4910f20fc766ab8f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:43:42 2009 +0100
calc_cert_expiration not used anywyere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index 3431c3c..c68d4e5 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -1399,32 +1399,6 @@ EOQ
}
-# figure out the theoretical expiration date of an org's cert given
-# the currently available services
-sub calc_cert_expiration {
- my $self = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT GREATEST(end_date_active) FROM web_customer_entitlements
- WHERE service_item_code IN
- (SELECT item_code FROM rh_product
- WHERE product_id IN
- (SELECT product_id FROM rhnServiceChannelFamilyMap
- WHERE family_id IN
- (SELECT id FROM rhnChannelFamily WHERE label='rhn-satellite'))) AND
- active_flag='Y' AND customer_id=:org_id
-EOQ
-
- $sth->execute_h(org_id => $self->id);
- my $data = $sth->fetchrow;
-
- $sth->finish;
-
- return Date::Parse::str2time($data);
-
-}
-
sub available_cert_channels {
my $self = shift;
commit a6ffecc8779f0b74118f629c50ab85b901f2508a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:42:54 2009 +0100
lookup_company_name not used anywyere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Org.pm b/web/modules/rhn/RHN/DB/Org.pm
index 4a5a722..3431c3c 100644
--- a/web/modules/rhn/RHN/DB/Org.pm
+++ b/web/modules/rhn/RHN/DB/Org.pm
@@ -129,40 +129,6 @@ EOQ
return $ret;
}
-sub lookup_company_name {
-
- my $self = shift;
- my $org_id = shift;
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare (<<EOQ);
-select
- nvl(wupi.company,(select name from web_customer where id = :org_id))
-from
- web_user_personal_info wupi,
- web_contact wcon
-where
- wcon.org_id = :org_id
- and wupi.web_user_id = wcon.id
- and wupi.modified = (
- select max(wupi.modified)
- from
- web_user_personal_info wupi,
- web_contact wcon
- where
- wcon.org_id = :org_id
- and wupi.web_user_id = wcon.id
- )
-EOQ
-
- $sth->execute_h(org_id => $org_id);
- my $org_name = $sth->fetchrow();
- $sth->finish();
-
- return $org_name;
-
-}
-
my @valid_org_entitlements = qw/sw_mgr_personal sw_mgr_enterprise rhn_provisioning
rhn_nonlinux rhn_monitor rhn_solaris/;
commit f592ca8226e95b03d0fa1b5e89fcfd54138c4a32
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Dec 11 14:38:38 2009 +0100
rhn-cert-info not used anywhere, makes cert_info obsolete as well, removing.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index 7809985..3899185 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -30,7 +30,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-cert-info' => \&cert_info);
$pxt->register_tag('rhn-cert-text' => \&cert_text);
$pxt->register_tag('rhn-org-entitlement-name' =>
\&org_entitlement_name, -5);
}
@@ -77,194 +76,6 @@ sub reset_and_commit_set {
$set->commit();
}
-sub cert_info {
-
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
-
- my $support_org_id = $pxt->param('support_org_id');
- if (not $support_org_id) {
- reset_form($pxt);
- croak "No org id provided!";
- }
-
- my $org = RHN::Org->lookup(-id => $support_org_id);
-
- my $data = $pxt->session->get('new_cert_info');
-
- my %cert_info;
-
- # use the data we've got in the session if it's there
- if ($data and $data->{'meta_info'}->{'support_org_id'} eq
$org->id) {
-
- %cert_info = %{$data};
-
- # overwrite the cert owner name with the correct name from web_user_personal_info
- $cert_info{'meta_info'}->{'owner'} =
RHN::Org->lookup_company_name($support_org_id);
-
- }
- else {
- reset_form($pxt); # blank slate
-
- # initialize our vars from the db
- $cert_info{'meta_info'}->{'support_org_id'} = $org->id;
-
- # set the cert owner name with the correct name from web_user_personal_info
- $cert_info{'meta_info'}->{'owner'} =
RHN::Org->lookup_company_name($support_org_id);
-
- # grab the latest version
- my @versions = RHN::Channel->satellite_channel_versions;
- my $ver = pop @versions;
- $cert_info{'meta_info'}->{'version'} = $ver;
- $cert_info{'meta_info'}->{'issued'} =
HTTP::Date::time2str(time());
- $cert_info{'meta_info'}->{'expires'} =
HTTP::Date::time2str($org->calc_cert_expiration);
-
- # services
- my $ent_data = $org->entitlement_data;
- my @ent_keys = keys %{$ent_data};
-
- my $service_set = RHN::Set->lookup(-label => 'new_cert_service_set',
-uid => $pxt->user->id);
- my $service_id_map_ref = RHN::Server->server_group_type_ids_by_label();
-
- my $prov_quant = 0;
- foreach my $ent (sort @ent_keys) {
- if ($ent ne 'sw_mgr_entitled') {
- my $total = $ent_data->{$ent}->{max};
- $service_set->add( [ $service_id_map_ref->{$ent}, $total] );
- if ($ent eq 'provisioning_entitled') {
- $prov_quant = $total;
- }
- }
- }
- $service_set->commit();
-
- # channels
- my $rec;
- my %channel_quantities;
- my $channel_set = RHN::Set->lookup(-label => 'new_cert_channel_set',
-uid => $pxt->user->id);
- my $rhn_slots_id = 0;
- foreach $rec ($org->ent_cert_channels) {
- my ($cid, $name, $label, $quant) = @$rec;
- if ($quant and $quant > 0) {
- $channel_set->add([$cid, $quant]);
- }
- }
-
- # always make sure that rhn-tools is among the channel families.
- # quantity for rhn-tools is always the same # as provisioning
- # entitlements.
- my $rhn_tools = RHN::Channel->family_details_by_label('rhn-tools');
- my $additional_channel_set = RHN::Set->lookup(-label =>
'new_cert_add_channel_set', -uid => $pxt->user->id);
- my %contents = $channel_set->output_hash;
- if ( exists $contents{$rhn_tools->{ID}} ) {
- $channel_set->add([$rhn_tools->{ID}, $prov_quant]);
- }
- else {
- $additional_channel_set->add([$rhn_tools->{ID}, $prov_quant]);
- }
- $channel_set->commit();
- $additional_channel_set->commit();
-
- $pxt->session->set('new_cert_info', \%cert_info);
- }
-
- # do our substitutions
- my %subs;
-
- $subs{'support_org_id'} =
$cert_info{'meta_info'}->{'support_org_id'};
- $subs{'owner'} =
$cert_info{'meta_info'}->{'owner'};
-
- my @possible_versions;
- foreach my $ver (RHN::Channel->satellite_channel_versions) {
- push @possible_versions, [ $ver, $ver, $ver eq
$cert_info{'meta_info'}->{'version'} ? 1 : 0];
- }
- $subs{'version'} = PXT::HTML->select(-name => "version",
- -options => \@possible_versions);
-
- $subs{'issued'} =
$cert_info{'meta_info'}->{'issued'};
- $subs{'expires'} =
$cert_info{'meta_info'}->{'expires'};
-
- my $counter = 1;
-
- my $services = get_service_map($pxt->user->id);
- my $servicetable = "";
-
- foreach my $label (sort keys %{$services}) {
- $counter++;
- my $total = $services->{$label}->{QUANT};
- my $id = $services->{$label}->{ID};
- my $row_class = ($counter % 2) ? "list-row-even" :
"list-row-odd";
- $servicetable .= "<tr class=\"" . $row_class .
"\">\n";
- $servicetable .= " <td>" . $label . "</td>\n";
- $servicetable .= " <td align=\"center\">" . $total .
"</td>\n";
- $servicetable .= " <td align=\"center\">\n";
- $servicetable .= " <input size=\"5\" type=\"text\"
name=\"service_" . $id . "_quant\" value=\"" . $total .
"\"/>\n";
- $servicetable .= " <input type=\"hidden\"
name=\"service\" value=\"" . $id . "\"/>\n";
- $servicetable .= " <input type=\"hidden\"
name=\"service_" . $id . "_oldquant\" value=\"" . $total .
"\"/>\n";
- $servicetable .= " </td>\n";
- $servicetable .= "</tr>\n";
- }
- $subs{services} = $servicetable;
-
-
- my $existing_channels = get_channel_family_map($pxt->user->id,
'new_cert_channel_set');
- $subs{channels} = render_channel_rows($existing_channels, "chanid", 1);
-
- my $additional_channels = get_channel_family_map($pxt->user->id,
'new_cert_add_channel_set');
- my $addchantable = "";
-
- $addchantable = "<tr><td colspan=\"3\"
align=\"center\">none</td></tr>" unless
- ($pxt->dirty_param('add_channel') or keys %{$additional_channels});
-
- $addchantable .= render_channel_rows($additional_channels, "addchanid", 0);
-
- # add row for entering channel manually
- if ($pxt->dirty_param('add_channel')) {
- my $add_channel_id = $pxt->dirty_param('add_channel_id');
- if( not $add_channel_id ) {
- $add_channel_id = "";
- }
-
- # we create an option list of available channels,
- # but we don't want to list the ones already
- # entitled or manually added
- my %skip_chan = ();
- for (keys %{$existing_channels}) {
- $skip_chan{$_} = 1;
- }
- for (keys %{$additional_channels}) {
- $skip_chan{$_} = 1;
- }
-
- my @possible_channels;
-
- foreach my $rec ($org->available_cert_channels) {
- my ($id, $name, $label) = @$rec;
- if (not $skip_chan{$label}) {
- push @possible_channels,
- [ $label , $id, $id eq $add_channel_id ? 1 : 0 ];
- }
- }
-
- my @chankeys = keys %{$additional_channels};
- my $row_class = (($#chankeys + 1) % 2) ? "list-row-even" :
"list-row-odd";
- $addchantable .= "<tr class=\"" . $row_class .
"\"><td>";
- $addchantable .= PXT::HTML->select(-name => "newchannel",
- -options => \@possible_channels);
-
- $addchantable .= " </td><td
align=\"center\">0</td><td align=\"center\">";
- $addchantable .= "<input size=\"5\" type=\"text\"
name=\"newchannel_quant\" value=\"0\"/>\n";
- $addchantable .= "</td></tr>\n";
- }
-
- $subs{additional_channels} = $addchantable;
-
- $block = PXT::Utils->perform_substitutions($block, \%subs);
- return $block;
-
-}
-
sub get_channel_family_map {
my $uid = shift;
my $set_label = shift;