web/modules/rhn/RHN/CommandParameter.pm | 46 -
web/modules/rhn/RHN/DB/Command.pm | 19
web/modules/rhn/RHN/DB/CommandParameter.pm | 142 ---
web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml | 12
web/modules/rhn/RHN/DB/Probe.pm | 60 -
web/modules/rhn/RHN/DB/ProbeParam.pm | 146 ---
web/modules/rhn/RHN/DB/Server.pm | 26
web/modules/rhn/RHN/ProbeParam.pm | 47 -
web/modules/sniglets/Sniglets/Org.pm | 67 -
web/modules/sniglets/Sniglets/Probes.pm | 684 ----------------
web/spacewalk-web.spec | 6
11 files changed, 1255 deletions(-)
New commits:
commit b089ca8966a3970547b7d3f09afd4188ed140b46
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:31:52 2009 +0100
Previous removals made get_channel_family_map unused, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index 0951bd8..2d1cd48 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -43,20 +43,4 @@ sub reset_and_commit_set {
$set->commit();
}
-sub get_channel_family_map {
- my $uid = shift;
- my $set_label = shift;
-
- my @data = RHN::Channel->family_details_from_set($uid, $set_label);
-
- my $ret;
- foreach my $row (@data) {
- my $label = $row->{LABEL};
- $ret->{$label}->{QUANT} = $row->{ELEMENT_TWO};
- $ret->{$label}->{ID} = $row->{ID};
- }
-
- return $ret;
-}
-
1;
commit 4931c2e85d6bdd9697c7bd501c98b6d46608c60d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:31:15 2009 +0100
Removal of get_service_map made server_group_type_details_from_set unused, removing as
dead code.
diff --git a/web/modules/rhn/RHN/DB/Server.pm b/web/modules/rhn/RHN/DB/Server.pm
index ac0d273..94fff25 100644
--- a/web/modules/rhn/RHN/DB/Server.pm
+++ b/web/modules/rhn/RHN/DB/Server.pm
@@ -3652,32 +3652,6 @@ EOQ
return $row;
}
-sub server_group_type_details_from_set {
- my $class = shift;
- my $uid = shift;
- my $set_label = shift;
-
- die "No uid" unless defined $uid;
- die "No set label" unless defined $set_label;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare(<<EOQ);
-SELECT SGT.id, SGT.label, RS.element_two
- FROM rhnServerGroupType SGT,
- rhnSet RS
-WHERE SGT.id=RS.element and RS.user_id = :user_id AND RS.label=:label
-EOQ
-
- $sth->execute_h(user_id=> $uid, label => $set_label);
-
- my @ret;
- while (my $row = $sth->fetchrow_hashref) {
- push @ret, $row;
- }
-
- return @ret;
-}
-
# Make a guess at this system's hostname
sub guess_hostname {
my $self = shift;
commit 19fc4f01d121eff8a594986407b351a3c518ee4c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:30:41 2009 +0100
Previous removals made get_service_map unused, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index a7cbe76..0951bd8 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -59,20 +59,4 @@ sub get_channel_family_map {
return $ret;
}
-sub get_service_map {
- my $uid = shift;
-
- my @data = RHN::Server->server_group_type_details_from_set($uid,
'new_cert_service_set');
-
- my $ret;
- foreach my $row (@data) {
- my $label = $row->{LABEL};
- $ret->{$label}->{QUANT} = $row->{ELEMENT_TWO};
- $ret->{$label}->{ID} = $row->{ID};
- }
-
- return $ret;
-}
-
-
1;
commit 857a5f2bcb008db3c09f7732e4aae7e3ba9312c9
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:28:55 2009 +0100
register_tags without content can be removed as well.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index f261116..a7cbe76 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -25,12 +25,6 @@ use Carp;
use RHN::Exception qw/throw/;
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
-}
-
sub reset_form {
my $pxt = shift;
commit 172bab0fb7408e422e8122b8899f02ddbe6a2736
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:28:27 2009 +0100
rhn:cert_text_cb not used, removing, as well as cert_text_cb.
diff --git a/web/modules/sniglets/Sniglets/Org.pm b/web/modules/sniglets/Sniglets/Org.pm
index 98bffa0..f261116 100644
--- a/web/modules/sniglets/Sniglets/Org.pm
+++ b/web/modules/sniglets/Sniglets/Org.pm
@@ -31,14 +31,6 @@ sub register_tags {
}
-sub register_callbacks {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_callback('rhn:cert_text_cb' => \&cert_text_cb);
-
-}
-
sub reset_form {
my $pxt = shift;
@@ -89,25 +81,4 @@ sub get_service_map {
}
-sub cert_text_cb {
- my $pxt = shift;
-
- my $support_org_id = $pxt->param('support_org_id');
- my $action = $pxt->dirty_param('button');
-
- my $data = $pxt->session->get('new_cert_info');
- my %cert_info;
- if ($data and $data->{'meta_info'}->{'support_org_id'} eq
$support_org_id) {
- %cert_info = %{$data};
- }
- else {
- reset_form($pxt);
- croak "No cert data!";
- }
-
- if ($action eq "Back") {
- $pxt->redirect("/internal/support/create_cert.pxt?support_org_id=" .
$support_org_id);
- }
-}
-
1;
commit a76f4f8749d7a025f179932cfeb340fcc225ae13
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:27:21 2009 +0100
Previous removals made RHN::ProbeParam and RHN::DB::ProbeParam not needed, removing as
dead packages.
diff --git a/web/modules/rhn/RHN/DB/ProbeParam.pm b/web/modules/rhn/RHN/DB/ProbeParam.pm
deleted file mode 100644
index 33762ae..0000000
--- a/web/modules/rhn/RHN/DB/ProbeParam.pm
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::DB::ProbeParam;
-
-use Params::Validate qw/:all/;
-Params::Validate::validation_options(strip_leading => '-');
-
-use strict;
-use Carp;
-use Data::Dumper;
-use RHN::DataSource::Simple;
-
-our $VERSION = (split(/s+/, q$Id$, 4))[2];
-
-#########
-sub new {
-#########
- my $class = shift;
- my %args = @_;
- my $self = {};
- bless($self, $class);
-
- foreach my $arg (keys %args) {
- $self->$arg($args{$arg});
- }
-
- return $self;
-}
-
-
-############
-sub create {
-############
- my $class = shift;
- my $self = bless { }, $class;
- return $self;
-}
-
-
-1;
-
-__END__
-=head1 NAME
-
-RHN::DB::ProbeParam - Monitoring probe parameters
-
-=head1 SYNOPSIS
-
- use RHN::DB::ProbeParam;
-
-=head1 DESCRIPTION
-
-RHN::DB::ProbeParam provides access to monitoring probe parameters
-(the RHN_PROBE_PARAMS table);
-
-=head1 CLASS METHODS
-
-=over 8
-
-=item new()
-
-Creates a new RHN::DB::ProbeParam object
-
-=back
-
-=head1 SEE ALSO
-
-L<RHN::DB::Probe>, L<RHN::DB::Command>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
-
-
diff --git a/web/modules/rhn/RHN/ProbeParam.pm b/web/modules/rhn/RHN/ProbeParam.pm
deleted file mode 100644
index 2825b29..0000000
--- a/web/modules/rhn/RHN/ProbeParam.pm
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::ProbeParam;
-
-use strict;
-use RHN::DB::Probe;
-use RHN::DB::ProbeParam;
-
-our @ISA = qw(RHN::DB::ProbeParam);
-our $VERSION = (split(/s+/, q$Id$, 4))[2];
-
-
-1;
-
-__END__
-=head1 NAME
-
-RHN::Probe - Wrapper class for RHN::DB::ProbeParam
-
-=head1 DESCRIPTION
-
-Wrapper class for RHN::DB::ProbeParam
-
-=head1 SEE ALSO
-
-L<RHN::DB::Probe>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
-
-
diff --git a/web/modules/sniglets/Sniglets/Probes.pm
b/web/modules/sniglets/Sniglets/Probes.pm
index 160080e..f862215 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -24,7 +24,6 @@ use RHN::ContactGroup;
use RHN::DataSource;
use RHN::Exception;
use RHN::Probe;
-use RHN::ProbeParam;
use RHN::Server;
use RHN::Form::Widget::Checkbox;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 380f9f5..be145c2 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -194,7 +194,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/Package/
%{perl_vendorlib}/RHN/Postal.pm
%{perl_vendorlib}/RHN/Probe.pm
-%{perl_vendorlib}/RHN/ProbeParam.pm
%{perl_vendorlib}/RHN/Product.pm
%{perl_vendorlib}/RHN/Profile.pm
%{perl_vendorlib}/RHN/ProxyInstall.pm
@@ -235,13 +234,11 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/RHN::DB::ContactMethod.3pm.gz
%{_mandir}/man3/RHN::DB::MonitoringConfigMacro.3pm.gz
%{_mandir}/man3/RHN::DB::Probe.3pm.gz
-%{_mandir}/man3/RHN::DB::ProbeParam.3pm.gz
%{_mandir}/man3/RHN::DB::SatCluster.3pm.gz
%{_mandir}/man3/RHN::DB::SatNode.3pm.gz
%{_mandir}/man3/RHN::DB::ServerGroup.3pm.gz
%{_mandir}/man3/RHN::MonitoringConfigMacro.3pm.gz
%{_mandir}/man3/RHN::Probe.3pm.gz
-%{_mandir}/man3/RHN::ProbeParam.3pm.gz
%{_mandir}/man3/RHN::SCDB.3pm.gz
%{_mandir}/man3/RHN::SatCluster.3pm.gz
%{_mandir}/man3/RHN::SatNode.3pm.gz
commit 8e178239ac3efedf0c36346e4d21cf54dc5a35b2
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:25:18 2009 +0100
Removal of build_system_probe_edit_form and system_probe_edit_cb made
list_probe_param_values unused, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/ProbeParam.pm b/web/modules/rhn/RHN/DB/ProbeParam.pm
index 93022fa..33762ae 100644
--- a/web/modules/rhn/RHN/DB/ProbeParam.pm
+++ b/web/modules/rhn/RHN/DB/ProbeParam.pm
@@ -49,19 +49,6 @@ sub create {
return $self;
}
-#############################
-sub list_probe_param_values {
-#############################
- my $class = shift;
- my $probe_id = shift;
- my $command_id = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "probe_queries",
- -mode => "params_for_probe");
-
- return $ds->execute_query(-probe_id => $probe_id, -command_id =>
$command_id);
-}
-
1;
@@ -74,9 +61,6 @@ RHN::DB::ProbeParam - Monitoring probe parameters
use RHN::DB::ProbeParam;
- # Get a list of probe parameters
- my $params = RHN::DB::ProbeParam->list_probe_param_values($pid, $cid);
-
=head1 DESCRIPTION
RHN::DB::ProbeParam provides access to monitoring probe parameters
@@ -90,10 +74,6 @@ RHN::DB::ProbeParam provides access to monitoring probe parameters
Creates a new RHN::DB::ProbeParam object
-=item I<list_probe_param_values>($probe_id, $command_id)
-
-Lists probe param values given a probe ID and a command ID.
-
=back
=head1 SEE ALSO
commit 0190662feeb36844ef5acb9f9d718687d12df512
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:22:02 2009 +0100
Removal of rhn:system_probe_*cb made update_probe_param_values unused, removing as
dead code.
diff --git a/web/modules/rhn/RHN/DB/ProbeParam.pm b/web/modules/rhn/RHN/DB/ProbeParam.pm
index 0a177eb..93022fa 100644
--- a/web/modules/rhn/RHN/DB/ProbeParam.pm
+++ b/web/modules/rhn/RHN/DB/ProbeParam.pm
@@ -63,32 +63,6 @@ sub list_probe_param_values {
}
-###############################
-sub update_probe_param_values {
-###############################
- my $class = shift;
- my $probe_id = shift;
- my %modified_params = @_;
-
- my $dbh = RHN::DB->connect;
- my $sqlstmt;
- my $sth;
-
- my ($name, $value);
- while ( ($name, $value) = each %modified_params) {
- $sqlstmt = <<EOQ;
-UPDATE PROBE_PARAM_VALUE
- SET value = :value,
- last_update_date = SYSDATE
- WHERE param_name = :param_name
- AND probe_id = :probe_id
-EOQ
- $sth = $dbh->prepare($sqlstmt);
- $sth->execute_h(value => $value, param_name => $name, probe_id =>
$probe_id);
- }
-
-}
-
1;
__END__
@@ -103,13 +77,6 @@ RHN::DB::ProbeParam - Monitoring probe parameters
# Get a list of probe parameters
my $params = RHN::DB::ProbeParam->list_probe_param_values($pid, $cid);
- # Update changed parameters
- RHN::DB::ProbeParam->update_probe_param_values($pid,
- $paramname => $value,
- # ...
- );
-
-
=head1 DESCRIPTION
RHN::DB::ProbeParam provides access to monitoring probe parameters
@@ -127,10 +94,6 @@ Creates a new RHN::DB::ProbeParam object
Lists probe param values given a probe ID and a command ID.
-=item I<update_probe_param_values>($probe_id, %modified_params)
-
-Updates a list of modified parameters given a probe ID.
-
=back
=head1 SEE ALSO
commit 437581dde5c60ab46a5889c7f2bde0637c8cab8d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:20:28 2009 +0100
Removal of rhn:system_probe_*cb made insert_check_probe and insert_probe_params
unused, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/Probe.pm b/web/modules/rhn/RHN/DB/Probe.pm
index c1ef038..1609666 100644
--- a/web/modules/rhn/RHN/DB/Probe.pm
+++ b/web/modules/rhn/RHN/DB/Probe.pm
@@ -283,66 +283,6 @@ sub commit {
delete $self->{":modified:"};
}
-########################
-sub insert_check_probe {
-########################
- my $self = shift;
-
- my ($probe_id, $host_id, $sat_cluster_id);
-
- $probe_id = $self->{__recid__};
- $host_id = $self->{__host_id__};
- $sat_cluster_id = $self->{__sat_cluster_id__};
-
- my $dbh = RHN::DB->connect;
-
- #probe_type will always be 'check'
- my $query = <<EOS;
-INSERT INTO rhn_check_probe
- (probe_id, host_id, probe_type, sat_cluster_id)
-VALUES
- (:probe_id, :host_id, 'check', :sat_cluster_id)
-EOS
-
- my $sth = $dbh->prepare($query);
- $sth->execute_h(probe_id => $probe_id, host_id => $host_id, sat_cluster_id
=> $sat_cluster_id);
- $dbh->commit;
-
-}
-
-#########################
-sub insert_probe_params {
-#########################
- my $class = shift;
- my %params = @_;
-
- my $dbh = RHN::DB->connect;
- my ($sth, $query);
- my ($param_name, $value);
- my $probe_id = $class->{__recid__};
- my $command_id = $class->{__command_id__};
- my $last_update_user = $class->{__last_update_user__};
-
- foreach my $key (sort keys %params) {
- $param_name = $key;
- $value = $params{$key};
-
- $query = <<EOQ;
-INSERT INTO rhn_probe_param_value
- (probe_id, command_id, param_name, value, last_update_user, last_update_date)
-VALUES
- (:probe_id, :command_id, :param_name, :value, :last_update_user, sysdate)
-EOQ
-
- $sth = $dbh->prepare($query);
- $sth->execute_h(probe_id => $probe_id, command_id => $command_id, param_name
=> $param_name,
- value => $value, last_update_user => $last_update_user);
- }
-
- $dbh->commit;
-
-}
-
#################
sub list_scouts {
#################
commit 9f38aba1c254ab73be64ed26debc7b9b81465091
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:18:44 2009 +0100
Removal of list_by_command made RHN::DB::CommandParameter and RHN::CommandParameter
empty, removing as dead packages.
diff --git a/web/modules/rhn/RHN/CommandParameter.pm
b/web/modules/rhn/RHN/CommandParameter.pm
deleted file mode 100644
index 8d75009..0000000
--- a/web/modules/rhn/RHN/CommandParameter.pm
+++ /dev/null
@@ -1,46 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::CommandParameter;
-
-use strict;
-use RHN::DB::CommandParameter;
-
-our @ISA = qw(RHN::DB::CommandParameter);
-our $VERSION = (split(/s+/, q$Id$, 4))[2];
-
-
-1;
-
-__END__
-=head1 NAME
-
-RHN::CommandParameter - Wrapper class for RHN::DB::CommandParameter
-
-=head1 DESCRIPTION
-
-Wrapper class for RHN::DB::CommandParameter
-
-=head1 SEE ALSO
-
-L<RHN::DB::CommandParameter>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
-
-
diff --git a/web/modules/rhn/RHN/DB/CommandParameter.pm
b/web/modules/rhn/RHN/DB/CommandParameter.pm
deleted file mode 100644
index 73f82f1..0000000
--- a/web/modules/rhn/RHN/DB/CommandParameter.pm
+++ /dev/null
@@ -1,113 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-#
http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::DB::CommandParameter;
-
-use strict;
-use Carp;
-use RHN::DataSource::Simple;
-
-
-our $VERSION = (split(/s+/, q$Id$, 4))[2];
-
-# Hash of default values for instance construction
-use constant INSTANCE_DEFAULTS => (
-);
-
-
-
-
-# Generated getter/setter methods (per Chip)
-{
-
- my @fields = qw(
- command_id param_name param_type data_type_name description mandatory
- default_value min_value max_value field_order field_widget_name
- field_visible_length field_maximum_length field_visible
- default_value_visible
- );
-
- my $tmpl = q|
- sub [[field]] {
- my $self = shift;
- if (@_) {
- $self->{__[[field]]__} = shift;
- }
- return $self->{__[[field]]__};
- };
- |;
-
- foreach my $field (@fields) {
-
- (my $sub = $tmpl) =~ s/\[\[field\]\]/$field/g;
-
- eval $sub;
-
- croak $@ if($@);
- }
-
-}
-
-
-#########
-sub new {
-#########
- my $class = shift;
- my %args = @_;
- my $self = {};
- bless($self, $class);
-
- foreach my $arg (keys %args) {
- $self->$arg($args{$arg});
- }
-
- # Set defaults for values that weren't supplied to the constructor
- my %defaults = (INSTANCE_DEFAULTS);
- foreach my $field (keys %defaults) {
- $self->$field($defaults{$field}) unless(defined($self->$field()));
- }
-
- return $self;
-}
-
-
-
-1;
-
-__END__
-=head1 NAME
-
-RHN::DB::CommandParameter - Monitoring command parameters
-
-=head1 SYNOPSIS
-
- use RHN::DB::CommandParameter;
-
-=head1 DESCRIPTION
-
-RHN::DB::CommandParamter provides access to monitoring command
-parameters (RHN_COMMAND_PARAMETER table).
-
-=head1 SEE ALSO
-
-L<RHN::DB::Command>
-
-=head1 COPYRIGHT
-
-Copyright (c) 2004-2005, Red Hat, Inc. All rights reserved
-
-=cut
-
-
diff --git a/web/modules/sniglets/Sniglets/Probes.pm
b/web/modules/sniglets/Sniglets/Probes.pm
index 803f771..160080e 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -20,7 +20,6 @@ package Sniglets::Probes;
use Data::Dumper;
use RHN::Command;
-use RHN::CommandParameter;
use RHN::ContactGroup;
use RHN::DataSource;
use RHN::Exception;
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 409fa4f..380f9f5 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -161,7 +161,6 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/ChannelEditor.pm
%{perl_vendorlib}/RHN/Cleansers.pm
%{perl_vendorlib}/RHN/Command.pm
-%{perl_vendorlib}/RHN/CommandParameter.pm
%{perl_vendorlib}/RHN/ConfigChannel.pm
%{perl_vendorlib}/RHN/ConfigFile.pm
%{perl_vendorlib}/RHN/ConfigRevision.pm
@@ -229,11 +228,9 @@ rm -rf $RPM_BUILD_ROOT
%{perl_vendorlib}/RHN/UserGroup.pm
%{perl_vendorlib}/RHN/Utils.pm
%{_mandir}/man3/RHN::Command.3pm.gz
-%{_mandir}/man3/RHN::CommandParameter.3pm.gz
%{_mandir}/man3/RHN::ContactGroup.3pm.gz
%{_mandir}/man3/RHN::ContactMethod.3pm.gz
%{_mandir}/man3/RHN::DB::Command.3pm.gz
-%{_mandir}/man3/RHN::DB::CommandParameter.3pm.gz
%{_mandir}/man3/RHN::DB::ContactGroup.3pm.gz
%{_mandir}/man3/RHN::DB::ContactMethod.3pm.gz
%{_mandir}/man3/RHN::DB::MonitoringConfigMacro.3pm.gz
commit dbc1c834a56029cc702b9868c05a1c66e276b32d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:15:00 2009 +0100
Removal of rhn:system_probe_*cb made list_by_command unused, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB/CommandParameter.pm
b/web/modules/rhn/RHN/DB/CommandParameter.pm
index 9aaba0b..73f82f1 100644
--- a/web/modules/rhn/RHN/DB/CommandParameter.pm
+++ b/web/modules/rhn/RHN/DB/CommandParameter.pm
@@ -84,23 +84,6 @@ sub new {
-# List parameters by command ID
-#####################
-sub list_by_command {
-#####################
- my $class = shift;
- my $command_id = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "probe_queries",
- -mode => "parameters_for_command");
-
- return $ds->execute_query(-command_id => $command_id);
-
-}
-
-
-
-
1;
__END__
@@ -112,23 +95,11 @@ RHN::DB::CommandParameter - Monitoring command parameters
use RHN::DB::CommandParameter;
- my $plist = RHN::DB::CommandParameter->list_by_command($command_id);
-
=head1 DESCRIPTION
RHN::DB::CommandParamter provides access to monitoring command
parameters (RHN_COMMAND_PARAMETER table).
-=head1 CLASS METHODS
-
-=over 8
-
-=item list_by_command($command_id)
-
-List parameters by command ID. Returns a list of hashes.
-
-=back
-
=head1 SEE ALSO
L<RHN::DB::Command>
commit 517a890782abf2aee53af2464d499eb75ff507ed
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:08:31 2009 +0100
Removal of list_commands_by_group made enabled_commands_for_group unused, removing as
dead query.
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
b/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
index 68b9812..c004d7f 100644
--- a/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
+++ b/web/modules/rhn/RHN/DB/DataSource/xml/probe_queries.xml
@@ -43,18 +43,6 @@ ORDER BY UPPER(GROUP_NAME)
</mode>
-<mode name="enabled_commands_for_group">
- <query params="command_group_label">
-SELECT recid AS ID,
- description AS COMMAND_NAME,
- name AS COMMAND_LABEL
- FROM rhn_command
- WHERE group_name = :command_group_label
- AND enabled = 1
-ORDER BY UPPER(description)
- </query>
-</mode>
-
<mode name="parameters_for_command">
<query params="command_id">
SELECT command_id,
commit fb244b6197fd666cf173a3692f3cf41886317bed
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:07:42 2009 +0100
Removal of rhn:system_probe_*cb made list_commands_by_group unused, removing as dead
code.
diff --git a/web/modules/rhn/RHN/DB/Command.pm b/web/modules/rhn/RHN/DB/Command.pm
index 36248cf..19efd35 100644
--- a/web/modules/rhn/RHN/DB/Command.pm
+++ b/web/modules/rhn/RHN/DB/Command.pm
@@ -150,20 +150,6 @@ sub lookup {
}
-# Get a list of enabled commands given a command group name
-############################
-sub list_commands_by_group {
-############################
- my $class = shift;
- my $command_group_label = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => "probe_queries",
- -mode => "enabled_commands_for_group");
-
- return $ds->execute_query(-command_group_label => $command_group_label);
-}
-
-
# Get a list of available command groups
#################
sub list_groups {
@@ -191,7 +177,6 @@ RHN::DB::Command - Monitoring commands
use RHN::DB::Command;
my $groups = RHN::DB::Command->list_groups();
- my $commands = RHN::DB::Command->list_commands_by_group($group_name);
my $cmd_obj = RHN::DB::Command->lookup(id => $command_id);
@@ -212,10 +197,6 @@ Construct a new RHN::DB::Command object.
Get a list of available command groups.
-=item list_commands_by_group($group_name)
-
-Get a list of enabled commands given a command group name.
-
=item lookup(id => $command_id)
Look up command by ID. Returns an RHN::DB::Command object.
commit 8efdb4a4c12351ac6a6220ce689d99021842410f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 20:06:04 2009 +0100
rhn:system_probe_creation_cb and rhn:system_probe_edit_cb not used, removing, as well
as other dependant functions.
diff --git a/web/modules/sniglets/Sniglets/Probes.pm
b/web/modules/sniglets/Sniglets/Probes.pm
index 51925ff..803f771 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -49,662 +49,6 @@ sub register_tags {
$pxt->register_tag("rhn-probe-state-summary", \&probe_state_summary);
}
-sub register_callbacks {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_callback('rhn:system_probe_creation_cb' =>
\&system_probe_creation_cb);
- $pxt->register_callback('rhn:system_probe_edit_cb' =>
\&system_probe_edit_cb);
-}
-
-######################################
-sub build_system_probe_creation_form {
-######################################
- my $pxt = shift;
- my %params = @_;
-
- my $finished;
- my $probe_command_id;
-
- my $sid = $pxt->param('sid');
- throw "no sid" unless $sid;
-
- my $probe_command_group = $pxt->dirty_param('probe_command_group') ||
'linux';
-
- my $form = new RHN::Form::ParsedForm(name => 'System Probe',
- label => 'system_probe',
- action => $params{action},
- );
-
- my $command_groups = RHN::Command->list_groups();
- my @group_options = map { { value => $_->{COMMAND_GROUP_NAME}, label =>
$_->{COMMAND_GROUP_LABEL} } } @{$command_groups};
- throw "no command groups!" unless @group_options;
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Probe Command
Group',
- label => 'probe_command_group',
- size => 1,
- value => $probe_command_group ? $probe_command_group : 'tools',
- options => [ @group_options ],
- auto_submit => 1,
- requires => {response => 1}) );
-
- my $group_commands;
-
- if ($probe_command_group eq 'all') {
- my @commands = ();
-
- for my $group_label (map { $_->{COMMAND_GROUP_NAME} } @{$command_groups}) {
-
- my $tmp_commands = RHN::Command->list_commands_by_group($group_label);
- push @commands, (@{$tmp_commands});
- }
-
- # sort per bugzilla 107149
- @commands = sort { $a->{COMMAND_NAME} cmp $b->{COMMAND_NAME} } @commands;
-
- $group_commands = \@commands;
- }
- else {
- $group_commands = RHN::Command->list_commands_by_group($probe_command_group);
- }
-
- my @command_options = map {{ value => $_->{ID},
- label => $_->{COMMAND_NAME} }} @{$group_commands};
- throw "no group commands!" unless @command_options;
-
-
- if ($pxt->dirty_param('probe_command_id')) {
- ($probe_command_id) = grep { $_ eq $pxt->dirty_param('probe_command_id') }
map { $_->{ID} } @{$group_commands};
- }
-
- if (not $probe_command_id) {
- $probe_command_id = $command_options[0]->{value};
- }
-
- my $command_obj = RHN::Command->lookup(id => $probe_command_id);
-
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Probe Command',
- label => 'probe_command_id',
- size => 1,
- value => $command_options[0]->{value},
- options => [ @command_options ],
- auto_submit => 1,
- requires => {response => 1}));
-
- #use the sat_clusters defined for the users org in the select box
- my @scout_options = $pxt->user->org->get_scout_options();
- if (not @scout_options) {
- $pxt->push_message(local_alert => "No monitoring scouts defined for your
organization.");
- }
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Monitoring
Scout',
- label => 'scout_id',
- size => 1,
- value => $scout_options[0]->{label},
- options => [ @scout_options ],
- requires => {response => 1}));
-
- if ($command_obj->requirements_description()) {
- $form->add_widget(new RHN::Form::Widget::Literal(name => 'Probe
Requirements',
- value => $command_obj->requirements_description()));
- }
-
- if ($command_obj->version_support()) {
- $form->add_widget(new RHN::Form::Widget::Literal(name => 'Supported
Versions',
- value => $command_obj->version_support()));
- }
-
- #need to figure out how to change default description when a new command_group or
command is selected
- # my $default_desc = $command_obj->command_class();
-
- $form->add_widget(new RHN::Form::Widget::Text(name => 'Probe
Description',
- label => 'probe_description',
- size => 50,
-# value => $default_desc,
- maxlength => 100,
- requires => {response => 1}));
-
-
- # pxt_passthrough doesn't really know how to set "checked" so we have to
keep track
- # ourselves.
- my $probe_notifications = $pxt->dirty_param('probe_notifications') || 0;
- $form->add_widget(new RHN::Form::Widget::Checkbox(name => 'Probe
Notifications',
- label => 'probe_notifications',
- auto_submit => 1,
- value => 1,
- checked => $probe_notifications ));
-
- my @intervals = ( { value => '1', label => '1 minute' },
- { value => '5', label => '5 minutes' },
- { value => '10', label => '10 minutes' },
- { value => '15', label => '15 minutes' },
- { value => '30', label => '30 minutes' },
- { value => '45', label => '45 minutes' },
- { value => '60', label => '1 hour' },
- { value => '120', label => '2 hours' },
- { value => '360', label => '6 hours' },
- { value => '720', label => '12 hours' },
- { value => '1440', label => '24 hours' }
- );
-
- if ($probe_notifications) {
-
- # We're taking advantage of the fact that we've kept the name of the contact
group and the
- # one member contact method in sync to present the contact group name which the user
will
- # assume is the contact method.
- my $contact_groups = RHN::ContactGroup->list_groups($pxt->user, $sid);
- my @contact_group_options = map {{ value => $_->{ID},
- label => $_->{CONTACT_GROUP_NAME} }} @{$contact_groups};
-
- if (not @contact_group_options) {
- # setting the param to 0 effectively unchecks the checkbox. So here we uncheck
the
- # checkbox and issue a message indicating that theres nothing to select.
- $pxt->dirty_param('probe_notifications', 0);
- $pxt->push_message(local_alert => "No notification methods have been
defined.");
- }
- else {
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Notification
Interval',
- label =>
'probe_notification_interval_min',
- size => 1,
- value => '5',
- options => [ @intervals ],
- requires => {response => 1}));
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Notification
Method',
- label => 'cgid',
- size => 1,
- value => $contact_group_options[0]->{value},
- options => [ @contact_group_options ],
- requires => {response => 1}));
- }
- }
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Probe Check
Interval',
- label => 'probe_check_interval_min',
- size => 1,
- value => '5',
- options => [ @intervals ],
- requires => {response => 1}));
-
-
-
- my $command_params = RHN::CommandParameter->list_by_command($probe_command_id);
-
- # add the command_id to the prefix so that the param names will be unique
- # across the auto_submits
- my $formvar_prefix = $probe_command_id .'_param_';
-
- # XXX FIXME: this is probably woefully incomplete...
- my %validation_methods = ( float => [regexp => '^(\d+(\.(\d)+)?)?$'],
- integer => [numeric => 1],
- probestate => [regexp => '(OK|WARNING|CRITICAL|UNKNOWN)'],
- );
-
- foreach my $param (@{$command_params}) {
- if ($param->{FIELD_VISIBLE}) {
-
- my $param_value = $pxt->dirty_param($param->{PARAM_NAME}) ||
$param->{DEFAULT_VALUE};
-
- my $field_type = $param->{FIELD_WIDGET_NAME};
-
- if ($field_type eq 'text') {
- my $data_type = $param->{DATA_TYPE_NAME};
- my @extra_requirements = exists $validation_methods{$data_type} ?
@{$validation_methods{$data_type}} : ();
-
- my $mandatory = $param->{MANDATORY} ? 1 : 0;
- my $requires = { ($mandatory ? (response => 1) : ()), @extra_requirements};
-
- if ($data_type eq 'password') {
- $form->add_widget(new RHN::Form::Widget::Password(name =>
$param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- default => $param_value,
- size => $param->{FIELD_VISIBLE_LENGTH},
- maxlength => $param->{FIELD_MAXIMUM_LENGTH},
- requires => $requires
- ));
- }
- else {
- $form->add_widget(new RHN::Form::Widget::Text(name => $param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- size => $param->{FIELD_VISIBLE_LENGTH},
- maxlength => $param->{FIELD_MAXIMUM_LENGTH},
- #default => $param->{DEFAULT_VALUE},
- value => $param_value,
- requires => $requires
- ));
- }
- }
- elsif ($field_type eq 'checkbox') {
- $form->add_widget(new RHN::Form::Widget::Checkbox(name =>
$param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- value => 1,
- checked => $param_value));
- }
- else {
- throw 'unknown widget type';
- }
- }
- else {
- # if we got here, that means that the param is nonvisible tot he user, and we
should just use the default value for it
- $form->add_widget(new RHN::Form::Widget::Hidden(name => $formvar_prefix .
$param->{PARAM_NAME},
- value => $param->{DEFAULT_VALUE}
- ));
- }
- }
-
- $form->add_widget(new RHN::Form::Widget::Submit(name => 'Create
Probe'));
- $form->add_widget(new RHN::Form::Widget::Hidden(name => 'sid', value
=> $sid));
-
- $form->add_widget(new RHN::Form::Widget::Hidden(name => 'pxt:trap', value
=> 'rhn:system_probe_creation_cb'));
-
- return $form;
-}
-
-##############################
-sub system_probe_creation_cb {
-##############################
- my $pxt = shift;
-
- unless ($pxt->dirty_param('Create Probe')) {
- # don't do any creation stuff unless they actually hit the create button
- return;
- }
-
- my $form = build_system_probe_creation_form($pxt);
- my $response = $form->prepare_response;
-
- my $errors = Sniglets::Forms::load_params($pxt, $response);
-
- if (@{$errors}) {
- foreach my $error (@{$errors}) {
- $pxt->push_message(local_alert => $error);
- }
- return;
- }
-
- my $sid = $pxt->param('sid');
- throw "no sid" unless $sid;
-
- my $command_id = $pxt->dirty_param('probe_command_id');
- throw "no command id" unless $command_id;
-
- my $probe_description = $pxt->dirty_param('probe_description');
- throw "no probe description" unless $probe_description;
-
- #set probe_notifications to 0 if the param is undef
- my $probe_notifications = $pxt->dirty_param('probe_notifications') || 0;
-
- my $probe_check_interval_min =
$pxt->dirty_param('probe_check_interval_min');
-
- #use a default setting of 5min for notif interval for probes that won't notify,
- #as this field is a NOT NULL
- my $probe_notification_interval_min =
$pxt->dirty_param('probe_notification_interval_min') || 5;
-
- my $contact_group_id = $pxt->param('cgid');
-
- my @param_formvars = grep { m/param_/ } $pxt->param();
- my %probe_params;
-
- # now strip off the formvar_prefix we added to the parameters
- for my $param_formvar (@param_formvars) {
- my $param_name = $param_formvar;
- $param_name =~ s/^\Q${command_id}_param_//;
-
- $probe_params{$param_name} = $pxt->dirty_param($param_formvar);
- }
-
- my $scout_id = $pxt->param('scout_id');
-
- my $probe = RHN::Probe->create;
-
- #set all the needed fields for the new probe object
- $probe->probe_type('check');
- $probe->max_attempts('1');
- $probe->command_id($command_id);
- $probe->description($probe_description);
- $probe->notify_critical($probe_notifications);
- $probe->notify_warning($probe_notifications);
- $probe->notify_unknown($probe_notifications);
- $probe->notify_recovery($probe_notifications);
- $probe->check_interval_minutes($probe_check_interval_min);
- $probe->notification_interval_minutes($probe_notification_interval_min);
- $probe->retry_interval_minutes($probe_check_interval_min);
- $probe->host_id($sid);
- $probe->sat_cluster_id($scout_id);
- $probe->last_update_user($pxt->user->id);
- $probe->customer_id($pxt->user->org_id);
- $probe->contact_group_id($contact_group_id) || 0;
-
- my $transaction = RHN::DB->connect();
- $transaction->nest_transactions();
-
- eval {
- $probe->commit;
- $probe->insert_check_probe;
- $probe->insert_probe_params(%probe_params);
- };
-
- if ($@ and catchable($@)) {
- my $E = $@;
- $transaction->nested_rollback();
- throw $E;
- }
- elsif ($@) {
- $transaction->nested_rollback();
- die $@;
- }
- $transaction->nested_commit();
-
- my $escaped = PXT::Utils->escapeHTML($probe->description());
-
- $pxt->push_message(site_info => "System Probe
<strong>$escaped</strong> created.");
-
- my $pid = $probe->recid();
-
$pxt->redirect("/network/systems/details/probes/details.pxt?sid=$sid&probe_id=$pid");
-
-}
-
-##################################
-sub build_system_probe_edit_form {
-##################################
- my $pxt = shift;
- my %params = @_;
-
- my $finished;
-
- my $sid = $pxt->param('sid');
- throw "no sid" unless $sid;
-
- my $probe_id = $pxt->param('probe_id');
- throw "no probe_id" unless $probe_id;
-
- my $probe = RHN::Probe->lookup(-recid => $probe_id);
-
- my $command = RHN::Command->lookup(id => $probe->command_id);
-
- my $form = new RHN::Form::ParsedForm(name => 'System Probe',
- label => 'system_probe',
- action => $params{action},
- );
-
- $form->add_widget( new RHN::Form::Widget::Literal(name => 'Probe
Command', value => $command->description) );
-
- my $scout_description = $probe->scout_for_probe($probe_id);
- $form->add_widget( new RHN::Form::Widget::Literal(name => 'Monitoring
Scout', value => $scout_description) );
-
- if ($command->requirements_description) {
- $form->add_widget(new RHN::Form::Widget::Literal(name => 'Probe
Requirements',
- value => $command->requirements_description));
- }
-
- if ($command->version_support) {
- $form->add_widget(new RHN::Form::Widget::Literal(name => 'Supported
Versions',
- value => $command->version_support));
- }
-
- $form->add_widget(new RHN::Form::Widget::Text(name => 'Probe
Description',
- label => 'probe_description',
- size => 50,
- value => $probe->description,
- maxlength => 100,
- requires => {response => 1}));
-
- my $probe_notifications = $pxt->dirty_param('probe_notifications');
- # This relies on the edit_callback defining the value as 0 if it was a
- # javascript submit.
- if (not defined $probe_notifications) {
- $probe_notifications = $probe->notify_critical;
- }
- $form->add_widget(new RHN::Form::Widget::Checkbox(name => 'Probe
Notifications',
- label => 'probe_notifications',
- auto_submit => 1,
- value => 1,
- checked => $probe_notifications));
- my @intervals = ( { value => '1', label => '1 minute' },
- { value => '5', label => '5 minutes' },
- { value => '10', label => '10 minutes' },
- { value => '15', label => '15 minutes' },
- { value => '30', label => '30 minutes' },
- { value => '45', label => '45 minutes' },
- { value => '60', label => '1 hour' },
- { value => '120', label => '2 hours' },
- { value => '360', label => '6 hours' },
- { value => '720', label => '12 hours' },
- { value => '1440', label => '24 hours' }
- );
-
-
- if ($probe_notifications) {
- # We're taking advantage of the fact that we've kept the name of the contact
group and the
- # one member contact method in sync to present the contact group name which the user
will
- # assume is the contact method.
- my $contact_groups = RHN::ContactGroup->list_groups($pxt->user, $sid);
- my @contact_group_options = map {{ value => $_->{ID},
- label => $_->{CONTACT_GROUP_NAME} }} @{$contact_groups};
-
- if (not @contact_group_options) {
- # setting the param to 0 effectively unchecks the checkbox. So here we uncheck
the
- # checkbox and issue a message indicating that theres nothing to select.
- $pxt->dirty_param('probe_notifications', 0);
- $pxt->push_message(local_alert => "No notification methods have been
defined.");
- }
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Notification
Interval',
- label => 'probe_notification_interval_min',
- size => 1,
- value => $probe->notification_interval_minutes,
- options => [ @intervals ],
- requires => {response => 1}));
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Notification
Method',
- label => 'cgid',
- size => 1,
- value => $probe->contact_group_id,
- options => [ @contact_group_options ],
- requires => {response => 1}));
- }
-
- $form->add_widget(new RHN::Form::Widget::Select(name => 'Probe Check
Interval',
- label => 'probe_check_interval_min',
- size => 1,
- value => $probe->check_interval_minutes,
- options => [ @intervals ],
- requires => {response => 1}));
-
-
- my $command_params = RHN::CommandParameter->list_by_command($probe->command_id);
-
- my $saved_params = RHN::ProbeParam->list_probe_param_values($probe_id,
$probe->command_id);
-
- my $formvar_prefix = 'param_';
-
- # XXX FIXME: this is probably woefully incomplete...
- my %validation_methods = ( float => [regexp => '^(\d+(\.(\d)+)?)?$'],
- integer => [numeric => 1],
- probestate => [regexp => '(OK|WARNING|CRITICAL|UNKNOWN)'],
- );
-
- foreach my $param (@{$command_params}) {
- next unless $param->{FIELD_VISIBLE};
-
- my $param_value = $pxt->dirty_param($param->{PARAM_NAME});
-
- foreach my $saved (@{$saved_params}) {
- if ($param->{PARAM_NAME} eq $saved->{PARAM_NAME}) {
- $param_value = $saved->{VALUE};
- }
- }
-
- my $field_type = $param->{FIELD_WIDGET_NAME};
- if ($field_type eq 'text') {
-
- my $data_type = $param->{DATA_TYPE_NAME};
- my @extra_requirements = exists $validation_methods{$data_type} ?
@{$validation_methods{$data_type}} : ();
-
- if ($data_type eq 'password') {
- $form->add_widget(new RHN::Form::Widget::Password(name =>
$param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- default => $param_value,
- size => $param->{FIELD_VISIBLE_LENGTH},
- maxlength => $param->{FIELD_MAXIMUM_LENGTH},
- requires => [{response => $param->{MANDATORY} ? 1 : 0},
- @extra_requirements]
- ));
- }
- else {
- $form->add_widget(new RHN::Form::Widget::Text(name => $param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- size => $param->{FIELD_VISIBLE_LENGTH},
- maxlength => $param->{FIELD_MAXIMUM_LENGTH},
- #default => $param->{DEFAULT_VALUE},
- value => $param_value,
- requires => [{response => $param->{MANDATORY} ? 1 : 0},
- @extra_requirements]
- ));
- }
- }
- elsif ($field_type eq 'checkbox') {
- $form->add_widget(new RHN::Form::Widget::Checkbox(name =>
$param->{DESCRIPTION},
- label => $formvar_prefix . $param->{PARAM_NAME},
- value => 1,
- #checked => $param->{DEFAULT_VALUE} ? 1 : 0,
- checked => $param_value));
- }
- else {
- throw 'unknown widget type';
- }
- }
-
- $form->add_widget(new RHN::Form::Widget::Submit(name => 'Update
Probe'));
- $form->add_widget(new RHN::Form::Widget::Hidden(name => 'sid', value
=> $sid));
- $form->add_widget(new RHN::Form::Widget::Hidden(name => 'probe_id', value
=> $probe_id));
-
- $form->add_widget(new RHN::Form::Widget::Hidden(name => 'pxt:trap', value
=> 'rhn:system_probe_edit_cb'));
-
- return $form;
-
-}
-
-###########################
-sub system_probe_edit_cb {
-###########################
- my $pxt = shift;
-
- #It's likely that we're here because of a javascript submit. Make sure that
for
- #this case $pxt->('probe_notifications') is defined so that the checkbox
knows what to do.
- if (not defined $pxt->dirty_param('probe_notifications')) {
- $pxt->param(probe_notifications => 0);
- }
-
- unless ($pxt->dirty_param('Update Probe')) {
- #return w/o doing anything if the update probe button wasn't pushed
- return;
- }
-
- my $form = build_system_probe_edit_form($pxt);
- my $response = $form->prepare_response;
-
- my $errors = Sniglets::Forms::load_params($pxt, $response);
-
- if (@{$errors}) {
- foreach my $error (@{$errors}) {
- $pxt->push_message(local_alert => $error);
- }
- return;
- }
-
- my $sid = $pxt->param('sid');
- throw "no sid" unless $sid;
-
- my $probe_id = $pxt->param('probe_id');
- throw "no probe id" unless $probe_id;
-
- my $probe = RHN::Probe->lookup(recid => $probe_id);
-
- my $probe_description = $pxt->dirty_param('probe_description');
- if ($probe_description ne $probe->description) {
- $probe->description($probe_description);
- }
-
- my $probe_notifications = $pxt->dirty_param('probe_notifications') || 0;
-
- if ($probe_notifications ne $probe->notify_critical) {
- $probe->notify_critical($probe_notifications);
- $probe->notify_warning($probe_notifications);
- $probe->notify_unknown($probe_notifications);
- $probe->notify_recovery($probe_notifications);
- }
-
- my $contact_group_id = $pxt->param('cgid');
- if ($contact_group_id ne $probe->contact_group_id) {
- $probe->contact_group_id($contact_group_id);
- }
-
- my $probe_check_interval_min =
$pxt->dirty_param('probe_check_interval_min');
- if ($probe_check_interval_min ne $probe->check_interval_minutes) {
- $probe->check_interval_minutes($probe_check_interval_min);
- $probe->retry_interval_minutes($probe_check_interval_min);
- }
-
- #as the notif interval is a NOT NULL field, must default to something if notifs
- #are dropped from the probe configuration.
- my $probe_notification_interval_min =
$pxt->dirty_param('probe_notification_interval_min') || 5;
- if ($probe_notification_interval_min ne $probe->notification_interval_minutes) {
- $probe->notification_interval_minutes($probe_notification_interval_min);
- }
-
- my $saved_params = RHN::ProbeParam->list_probe_param_values($probe_id,
$probe->command_id);
-
- my @param_formvars = grep { m/param_/ } $pxt->param();
- my %modified_params;
-
- foreach my $param_formvar (@param_formvars) {
- my $param_name = $param_formvar;
- $param_name =~ s{^param_}{};
-
- # test the params to see if they've changed
- foreach my $saved (@{$saved_params}) {
- if ($param_name eq $saved->{PARAM_NAME} && ($saved->{VALUE} ne
$pxt->dirty_param($param_formvar))) {
- $modified_params{$param_name} = $pxt->dirty_param($param_formvar);
- }
- }
- }
-
- ## Can we move probes from one scout to another?
- #if ($probe->sat_cluser_id ne $scout_id) {
- # $probe->sat_cluster_id($scout_id);
- #}
-
- if ($probe->last_update_user ne $pxt->user->id) {
- $probe->last_update_user($pxt->user->id);
- }
-
- my $transaction = RHN::DB->connect();
- $transaction->nest_transactions();
-
- my $params_to_update = RHN::ProbeParam->create;
-
- eval {
- $probe->commit;
- $params_to_update->update_probe_param_values($probe_id, %modified_params);
- };
-
- if ($@ and catchable($@)) {
- my $E = $@;
- $transaction->nested_rollback();
- throw $E;
- }
- elsif ($@) {
- $transaction->nested_rollback();
- die $@;
- }
- $transaction->nested_commit();
-
- my $escaped = PXT::Utils->escapeHTML($probe->description());
-
- $pxt->push_message(site_info => "System Probe
<strong>$escaped</strong> updated.");
-}
-
sub probe_state_summary {
my $pxt = shift;
commit efc2cc3357b7568e1553891a9a39b0720da8cf3d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 21 19:49:47 2009 +0100
rhn:delete_probe_cb is not used, removing, as well as delete_probe_cb.
diff --git a/web/modules/sniglets/Sniglets/Probes.pm
b/web/modules/sniglets/Sniglets/Probes.pm
index 526fbba..51925ff 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -55,7 +55,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:system_probe_creation_cb' =>
\&system_probe_creation_cb);
$pxt->register_callback('rhn:system_probe_edit_cb' =>
\&system_probe_edit_cb);
- $pxt->register_callback('rhn:delete_probe_cb' => \&delete_probe_cb);
}
######################################
@@ -706,31 +705,6 @@ sub system_probe_edit_cb {
$pxt->push_message(site_info => "System Probe
<strong>$escaped</strong> updated.");
}
-#####################
-sub delete_probe_cb {
-#####################
- my $pxt = shift;
-
- my $sid = $pxt->param('sid');
- my $probe_id = $pxt->param('probe_id');
-
- unless ($pxt->dirty_param('brb_confirm')) {
- my $redir = $pxt->dirty_param('delete_confirm_page');
- throw "param 'delete_confirm_page' needed but not provided." unless
$redir;
- $pxt->redirect($redir);
- }
-
- my $probe = RHN::Probe->lookup(-recid => $probe_id);
-
- $probe->delete_probe;
-
- my $desc = $probe->description;
- my $redir = $pxt->dirty_param('delete_success_page');
- throw "param 'delete_success_page' needed but not provided." unless
$redir;
- $pxt->push_message(site_info => "System Probe \'$desc\'
deleted.");
- $pxt->redirect($redir);
-}
-
sub probe_state_summary {
my $pxt = shift;