client/rhel
by Milan Zazrivec
client/rhel/rhn-client-tools/src/up2date_client/tui.py | 2 --
1 file changed, 2 deletions(-)
New commits:
commit a17c078a58d99d53fa93e6bba35103e10dbf257e
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Mon Dec 14 14:42:48 2009 +0100
516207 - drop extraneous 'Why Register' windows from rhn_register (TUI)
Originally added in svn rev. 104803, bug #211376
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/tui.py b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
index c6bea78..669e9f3 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
@@ -219,8 +219,6 @@ class WhyRegisterWindow:
self.g = toplevel
- self.screen.gridWrappedWindow(toplevel, 'WhyRegisterWindow', 80, 24)
-
def run(self):
log.log_debug("Running %s" % self.__class__.__name__)
result = self.g.runOnce()
14 years, 4 months
5 commits - web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Channel.pm | 53 --------------------------
web/modules/sniglets/Sniglets/Probes.pm | 38 ------------------
web/modules/sniglets/Sniglets/PublicErrata.pm | 10 ----
web/modules/sniglets/Sniglets/ServerNotes.pm | 19 ---------
4 files changed, 120 deletions(-)
New commits:
commit 10af8deeb9eafb033368914d352d6ac7011555b3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:45:16 2009 +0100
rhn-system-probe-edit-form not used anywhere, removing, as well as system_probe_edit_form.
diff --git a/web/modules/sniglets/Sniglets/Probes.pm b/web/modules/sniglets/Sniglets/Probes.pm
index a66ecda..526fbba 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -46,7 +46,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag("rhn-system-probe-edit-form", \&system_probe_edit_form);
$pxt->register_tag("rhn-probe-state-summary", \&probe_state_summary);
}
@@ -407,24 +406,6 @@ sub system_probe_creation_cb {
}
-############################
-sub system_probe_edit_form {
-############################
- my $pxt = shift;
- my %params = @_;
-
- my $form = build_system_probe_edit_form($pxt, %params);
- my $rform = $form->realize;
- undef $form;
-
- Sniglets::Forms::load_params($pxt, $rform);
-
- my $style = new Sniglets::Forms::Style('standard');
- my $html = $rform->render($style);
-
- return $html;
-}
-
##################################
sub build_system_probe_edit_form {
##################################
commit 3248bd1f6b4156fa7a161d3432a285bc39e31d3c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:44:10 2009 +0100
rhn-system-probe-creation-form not used anywhere, removing, as well as system_probe_creation_form.
diff --git a/web/modules/sniglets/Sniglets/Probes.pm b/web/modules/sniglets/Sniglets/Probes.pm
index 361876e..a66ecda 100644
--- a/web/modules/sniglets/Sniglets/Probes.pm
+++ b/web/modules/sniglets/Sniglets/Probes.pm
@@ -46,7 +46,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag("rhn-system-probe-creation-form", \&system_probe_creation_form);
$pxt->register_tag("rhn-system-probe-edit-form", \&system_probe_edit_form);
$pxt->register_tag("rhn-probe-state-summary", \&probe_state_summary);
}
@@ -304,24 +303,6 @@ sub build_system_probe_creation_form {
return $form;
}
-################################
-sub system_probe_creation_form {
-################################
- my $pxt = shift;
- my %params = @_;
-
- my $form = build_system_probe_creation_form($pxt, %params);
- my $rform = $form->realize;
- undef $form;
-
- Sniglets::Forms::load_params($pxt, $rform);
-
- my $style = new Sniglets::Forms::Style('standard');
- my $html = $rform->render($style);
-
- return $html;
-}
-
##############################
sub system_probe_creation_cb {
##############################
commit d01c8dc810ad634fc43c5cd41ad5771cc3f852d0
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:38:17 2009 +0100
public-attempted-errata not used anywhere, removing, as well as public_attempted_errata.
diff --git a/web/modules/sniglets/Sniglets/PublicErrata.pm b/web/modules/sniglets/Sniglets/PublicErrata.pm
index e385954..7ee91ea 100644
--- a/web/modules/sniglets/Sniglets/PublicErrata.pm
+++ b/web/modules/sniglets/Sniglets/PublicErrata.pm
@@ -41,7 +41,6 @@ sub register_tags {
# for www.redhat.com'ish public errata display
$pxt->register_tag('public-errata-product-list' => \&public_errata_product_list);
$pxt->register_tag('public-errata-affected-products' => \&public_errata_affected_products, 2);
- $pxt->register_tag('public-attempted-errata' => \&public_attempted_errata);
$pxt->register_tag('public-errata-list-vs-details' => \&public_errata_list_vs_details);
$pxt->register_tag('public-errata-filter' => \&public_errata_filter);
$pxt->register_tag('public-errata-filter-type-url' => \&public_errata_filter_type_url);
@@ -130,15 +129,6 @@ sub errata_in_db {
return $errata;
}
-sub public_attempted_errata {
- my $pxt = shift;
-
- return '' unless $pxt->dirty_param('attempted_adv');
-
- return PXT::Utils->escapeHTML($pxt->dirty_param('attempted_adv'));
-}
-
-
sub public_errata_product_list {
my $pxt = shift;
my %params = @_;
commit d16c63a2f344013b947833ba1617af3af64bf80d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:35:20 2009 +0100
rhn-channel-relationships not used anywhere, removing, as well as channel_relationships.
diff --git a/web/modules/sniglets/Sniglets/Channel.pm b/web/modules/sniglets/Sniglets/Channel.pm
index c56c496..69e238a 100644
--- a/web/modules/sniglets/Sniglets/Channel.pm
+++ b/web/modules/sniglets/Sniglets/Channel.pm
@@ -35,7 +35,6 @@ sub register_tags {
my $pxt = shift;
$pxt->register_tag('rhn-channel-details' => \&channel_details);
- $pxt->register_tag('rhn-channel-relationships' => \&channel_relationships);
$pxt->register_tag('rhn-channel-gpg-key' => \&channel_gpg_key);
@@ -548,58 +547,6 @@ EOQ
return ($subscribable_checkbox, $message, $submit_html);
}
-sub channel_relationships {
- my $pxt = shift;
- my %params = @_;
-
- my $cid = $pxt->param('cid');
-
- throw "no channel id" unless $cid;
-
- my $channel = RHN::Channel->lookup(-id => $cid);
-
- my %rel = $channel->relationships;
-
- my @ships;
-
- foreach my $to_cid (keys %rel) {
- next unless $pxt->user->verify_channel_access($to_cid);
-
- my $to_link;
- if ($cid == $to_cid) {
- $to_link = 'This channel';
- }
- else {
- my $to_label = RHN::Channel->lookup(-id => $to_cid)->label;
- $to_link = PXT::HTML->link("/network/software/channels/details.pxt?cid=${to_cid}", $to_label);
- }
-
- foreach my $label (keys %{$rel{$to_cid}}) {
- my $descrip = $rel{$to_cid}->{$label}->{description};
-
- foreach my $from_cid (@{$rel{$to_cid}->{$label}->{channels}}) {
- next unless $pxt->user->verify_channel_access($from_cid);
-
- my $from_link;
- if ($cid == $from_cid) {
- $from_link = 'this channel'
- }
- else {
- my $from_label = RHN::Channel->lookup(-id => $from_cid)->label;
- $from_link = PXT::HTML->link("/network/software/channels/details.pxt?cid=${from_cid}", $from_label);
- }
- push @ships, join " ", ($to_link, $descrip, $from_link);
- }
- }
- }
-
- return unless @ships;
-
- my $relationships = join "<br/>\n", @ships;
-
- return PXT::Utils->perform_substitutions($params{__block__}, { relationships => $relationships });
-}
-
sub viewed_channel_name {
my $pxt = shift;
my %params = @_;
commit 251ff30b26707ceef06d18fc41c790707741f9cf
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:34:10 2009 +0100
rhn-display-server-note not used anywhere, removing, as well as display_server_note.
diff --git a/web/modules/sniglets/Sniglets/ServerNotes.pm b/web/modules/sniglets/Sniglets/ServerNotes.pm
index 1faf4f0..4704ca7 100644
--- a/web/modules/sniglets/Sniglets/ServerNotes.pm
+++ b/web/modules/sniglets/Sniglets/ServerNotes.pm
@@ -27,7 +27,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-display-server-note' => \&display_server_note);
$pxt->register_tag('rhn-server-note-edit-form' => \&server_note_edit_form);
}
@@ -38,24 +37,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:server_note_cb' => \&server_note_cb);
}
-# display a single note
-sub display_server_note {
- my $pxt = shift;
- my %params = @_;
-
- my $sid = $pxt->param('sid');
-
- my $sn = RHN::ServerNotes->lookup(-id => $sid);
- my $block = $params{__block__};
-
- if($sn) {
- $block =~ s/\{$_\}/PXT::Utils->escapeHTML($sn->$_() || '')/eig
- foreach qw { id creator subject note created modified server_id };
- }
-
- return $block;
-}
-
sub server_note_edit_form {
my $pxt = shift;
my %params = @_;
14 years, 4 months
web/modules
by Jan Pazdziora
web/modules/sniglets/Sniglets/Packages.pm | 18 ------------------
1 file changed, 18 deletions(-)
New commits:
commit 8fc629c67930357811c810a2421ab715e4e38519
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:28:56 2009 +0100
rhn-download-privileges not used anywhere, removing, as well as download_privileges.
diff --git a/web/modules/sniglets/Sniglets/Packages.pm b/web/modules/sniglets/Sniglets/Packages.pm
index 6554388..4aacf1c 100644
--- a/web/modules/sniglets/Sniglets/Packages.pm
+++ b/web/modules/sniglets/Sniglets/Packages.pm
@@ -42,8 +42,6 @@ sub register_tags {
$pxt->register_tag('rhn-unknown-package-nvre' => \&unknown_package_nvre);
- $pxt->register_tag('rhn-download-privileges' => \&download_privileges);
-
$pxt->register_tag('rhn-download-package-list' => \&download_package_list);
$pxt->register_tag('rhn-download', \&download, 2);
$pxt->register_tag('rhn-must-select-archs', \&must_select_archs, 2);
@@ -108,22 +106,6 @@ sub must_select_archs {
return $params{__block__} . $hidden_vals;
}
-sub download_privileges {
- my $pxt = shift;
- my $filename = $pxt->dirty_param('filename');
-
- if (defined $filename and $filename =~ m/.*?\.rpm/) {
- #warn "ok, you're allowed to download rpms for free...";
- return '';
- }
-
- unless ($pxt->user->org->is_paying_customer) {
- $pxt->redirect('/network/software/cannot_download.pxt');
- }
-
- return '';
-}
-
sub download {
my $pxt = shift;
my %params = @_;
14 years, 4 months
11 commits - web/html web/modules
by Jan Pazdziora
web/html/forms/edit_template_string.xml | 13 -
web/modules/sniglets/Sniglets/Actions.pm | 129 ---------------
web/modules/sniglets/Sniglets/AppInstall.pm | 1
web/modules/sniglets/Sniglets/Debug.pm | 52 ------
web/modules/sniglets/Sniglets/ErrataEditor.pm | 187 ----------------------
web/modules/sniglets/Sniglets/Forms.pm | 66 -------
web/modules/sniglets/Sniglets/MonitoringConfig.pm | 119 --------------
web/modules/sniglets/Sniglets/Packages.pm | 2
web/modules/sniglets/Sniglets/Sets.pm | 57 ------
web/modules/sniglets/Sniglets/Template.pm | 68 --------
10 files changed, 694 deletions(-)
New commits:
commit fa292a7ae2d69b5a873eac866430b66960d886be
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:27:04 2009 +0100
rhn-package-name not used anywhere, removing.
diff --git a/web/modules/sniglets/Sniglets/Packages.pm b/web/modules/sniglets/Sniglets/Packages.pm
index ad777ae..6554388 100644
--- a/web/modules/sniglets/Sniglets/Packages.pm
+++ b/web/modules/sniglets/Sniglets/Packages.pm
@@ -38,8 +38,6 @@ sub register_tags {
$pxt->register_tag('rhn-package-details' => \&package_details);
$pxt->register_tag('rhn-package-change-log' => \&package_change_log);
- # for above the tabs...
- $pxt->register_tag('rhn-package-name' => sub { (shift)->pnotes('package_name') },2);
$pxt->register_tag('rhn-unknown-package-nvre' => \&unknown_package_nvre);
commit b29f834b5ea1cd683e1025d5bc3bf0ccae48d1e6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:23:45 2009 +0100
Package Sniglets::Template is not used anywhere, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Template.pm b/web/modules/sniglets/Sniglets/Template.pm
deleted file mode 100644
index ec1579f..0000000
--- a/web/modules/sniglets/Sniglets/Template.pm
+++ /dev/null
@@ -1,68 +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 Sniglets::Template;
-
-use RHN::Exception qw/throw/;
-
-use RHN::TemplateString;
-
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag("rhn-template-replace", \&template_replace);
- $pxt->register_tag("rhn-template-block", \&template_block);
-
-}
-
-sub register_callbacks {
- my $class = shift;
- my $pxt = shift;
-
-}
-
-sub template_replace {
- my $pxt = shift;
- my %params = @_;
-
- unless (PXT::Config->get('satellite')) {
- return $params{__block__};
- }
-
- my $label = $params{label};
-
- throw "No label." unless $label;
-
- return RHN::TemplateString->get_string(-label => $label);
-}
-
-sub template_block {
- my $pxt = shift;
- my %params = @_;
-
- unless (PXT::Config->get('satellite')) {
- return '';
- }
-
- my %subst = RHN::TemplateString->load_all;
-
- PXT::Utils->escapeHTML_multi(\%subst);
- return PXT::Utils->perform_substitutions($params{__block__}, \%subst);
-}
-
-1;
commit d6df88f923419066d0d2fc99de4f4b1769aafafe
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:23:09 2009 +0100
Package Sniglets::Debug is not used anywhere, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Debug.pm b/web/modules/sniglets/Sniglets/Debug.pm
deleted file mode 100644
index 835333c..0000000
--- a/web/modules/sniglets/Sniglets/Debug.pm
+++ /dev/null
@@ -1,52 +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 Sniglets::Debug;
-
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag("rhn-debug-dump" => \&dump);
-}
-
-sub dump {
- my $pxt = shift;
-
- my @ret;
- push @ret, map { "$_ => " . $pxt->{apr}->$_() } qw/as_string hostname location/;
- push @ret, map { "$_ => " . $pxt->{apr}->server->$_() } qw/server_hostname/;
- push @ret, map { "$_ => " . $pxt->{apr}->connection->$_() } qw/remote_ip remote_host/;
-
- my @params = $pxt->{apr}->param();
- my $params = "form variables =>\n";
- foreach my $param (@params) {
- $params .= "\t$param: " . join(', ', $pxt->{apr}->param($param)) . "\n";
- }
- push(@ret, $params);
-
- my $subp_env = $pxt->{apr}->subprocess_env('HTTPS');
- push @ret, "SSL => $subp_env" if (defined($subp_env));
-
- push @ret, map { "pxt => " . Data::Dumper->Dump([$pxt])} 1;
- push @ret, map { "pxt_ssl_$_ => " . $pxt->$_()} qw/ssl_available ssl_request/;
- push @ret, map { "pxt_derelative($_) => " . $pxt->derelative_url($_)}
- ("/foo.txt", "bar.txt");
-
-
- return join("", map { "<pre>$_</pre>\n" } @ret);
-}
-
-1;
commit 1cd64af09ad4eb99cc4712db66ff43d2cb6dff38
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:22:28 2009 +0100
rhn-render-form not used anywhere, removing, as well as render_form and prepare_form.
diff --git a/web/modules/sniglets/Sniglets/Forms.pm b/web/modules/sniglets/Sniglets/Forms.pm
index d3433c1..4a65cd7 100644
--- a/web/modules/sniglets/Sniglets/Forms.pm
+++ b/web/modules/sniglets/Sniglets/Forms.pm
@@ -33,8 +33,6 @@ use PXT::ACL;
sub register_tags {
my $class = shift;
my $pxt = shift;
-
- $pxt->register_tag("rhn-render-form", \&render_form);
}
sub register_callbacks {
@@ -44,70 +42,6 @@ sub register_callbacks {
$pxt->register_callback('rhn:catch_form', \&catch_form_cb);
}
-sub render_form {
- my $pxt = shift;
- my %params = @_;
-
- my $rform = prepare_form($pxt, %params);
-
- my $style = new Sniglets::Forms::Style;
- my $html = $rform->render($style);
-
- return $html;
-}
-
-sub prepare_form {
- my $pxt = shift;
- my %params = @_;
-
- my $file = File::Spec->catfile($pxt->document_root, $params{file});
-
- my $pform = RHN::Form::Parser->parse_file($file);
-
- throw "'$pform' is not a RHN::Form::ParsedForm"
- unless (ref $pform && $pform->isa('RHN::Form::ParsedForm'));
-
- my $file_widget = new RHN::Form::Widget::Hidden(label => 'form_file',
- default => $file);
-
- $pform->add_widget($file_widget);
-
- my $acl_parser = new PXT::ACL (mixins => [ $pform->acl_mixins ]);
-# remove widgets based upon ACLs
- foreach my $widget ($pform->widgets) {
- next unless $widget->acl;
-
- if (not $acl_parser->eval_acl($pxt, $widget->acl)) {
- $pform->remove_widget($widget->label);
- }
- }
-
- my $rform = $pform->realize; #A realized form, ready to render
- undef $pform;
-
- my $source = $rform->lookup_value('source');
-
- if ($source) {
- my $id_formvar = $rform->lookup_value('id_formvar');
-
- eval "use $source";
- die $@ if $@;
-
- my $obj = $source->lookup(-id => $pxt->passthrough_param($id_formvar));
-
- foreach my $widget ($rform->widgets) {
- my $label = $widget->label;
- if ($obj->can($label)) {
- $widget->raw_value($obj->$label());
- }
- }
- }
-
- my $errors = load_params($pxt, $rform);
-
- return $rform;
-}
-
sub catch_form_cb {
my $pxt = shift;
commit 1178ac7b91ed1235d78773245fa200fb7770fa61
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:20:30 2009 +0100
edit_template_string.xml is not used anywhere, removing as dead code.
diff --git a/web/html/forms/edit_template_string.xml b/web/html/forms/edit_template_string.xml
deleted file mode 100644
index 678fbfd..0000000
--- a/web/html/forms/edit_template_string.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf8"?>
- <rhn-form name="Edit String" label="edit_template_string" action="edit.pxt" method="post">
- <widget type="literal" name="Category:" label="category_label" />
- <widget type="literal" name="Label:" label="label" />
- <widget type="literal" name="Description:" label="description" />
- <widget type="textarea" name="Value:" label="value" rows="4" cols="60" />
- <widget type="hidden" label="pxt:trap" default="rhn:catch_form" />
- <widget type="hidden" label="source" default="RHN::TemplateString" />
- <widget type="hidden" label="id_formvar" default="string_id" />
- <widget type="hidden" label="string_id" />
- <widget type="hidden" label="url" default="/internal/satellite/string_manager/index.pxt" />
- <widget type="submit" label="Submit" default="Submit"/>
-</rhn-form>
commit 298fcd34fc5bedecb9b1b5b4bdd3a9f271e71cd9
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:17:16 2009 +0100
Package Sniglets::MonitoringConfig is not used anywhere, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/MonitoringConfig.pm b/web/modules/sniglets/Sniglets/MonitoringConfig.pm
deleted file mode 100644
index c64edbc..0000000
--- a/web/modules/sniglets/Sniglets/MonitoringConfig.pm
+++ /dev/null
@@ -1,119 +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 Sniglets::MonitoringConfig;
-
-use Data::Dumper;
-
-use RHN::MonitoringConfigMacro;
-use RHN::SatInstall;
-use RHN::ProxyInstall;
-
-use Sniglets::Forms;
-
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag("rhn-editable-monitoring-macros", \&editable_macros);
- $pxt->register_tag("rhn-squelch-notifications", \&squelch_notifications);
-}
-
-sub register_callbacks {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_callback('rhn:monitoring-config-edit-cb' => \&update_cb);
-}
-
-
-sub squelch_notifications {
- my $pxt = shift;
-
- my $am_squelched = RHN::MonitoringConfigMacro->are_notifications_squelched();
-
- return PXT::HTML->checkbox(-name => 'squelch',
- -value => 1,
- -checked => ($am_squelched ? 1 : 0));
-}
-
-#####################
-sub editable_macros {
-#####################
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
- my $html;
-
- my $macros = RHN::MonitoringConfigMacro->load_editable_macros();
-
- foreach my $macro (@$macros) {
- my $row = $block;
- $row =~ s/{macro_name}/$macro->name()/eg;
- $row =~ s/{macro_definition}/$macro->definition()/eg;
- $row =~ s/{macro_description}/$macro->description()/eg;
- $html .= $row;
- }
-
- return $html;
-}
-
-###############
-sub update_cb {
-###############
- my $pxt = shift;
-
- # Fetch current values to compare against submitted values
- my $macros = RHN::MonitoringConfigMacro->load_editable_macros();
-
- foreach my $macro (@$macros) {
- my $mname = $macro->name();
- my $olddef = $macro->definition();
- my $newdef = $pxt->dirty_param($mname);
-
- if ($olddef ne $newdef) {
- $macro->definition($newdef);
- $macro->update($pxt->user->login) or die "Couldn't update macro: $!";
- }
- }
-
- if (PXT::Config->get('is_monitoring_scout')) {
- RHN::SatInstall->restart_satellite(-delay => 0,
- -service => 'MonitoringScout');
- }
-
- RHN::SatInstall->restart_satellite(-delay => 5,
- -service => 'Monitoring');
-
- $pxt->push_message(site_info => 'Configuration updated, Monitoring services restarted.');
-
- my $proxy_config_aid = RHN::ProxyInstall->push_monitoring_config_changes($pxt->user);
-
- if ($proxy_config_aid) {
- $pxt->push_message(site_info => <<EOQ);
-A Monitoring Proxy configuration update has been
-<strong><a href="/rhn/schedule/ActionDetails.do?aid=$proxy_config_aid">scheduled</a></strong>.
-EOQ
- }
-
- return;
-}
-
-
-
-1;
commit 2d49448ed9a446897029cb74a893e2d2cb0decec
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:13:04 2009 +0100
rhn-appinstall-progress not used anywhere, removing that appinstall_progress does not exist anyway.
diff --git a/web/modules/sniglets/Sniglets/AppInstall.pm b/web/modules/sniglets/Sniglets/AppInstall.pm
index dbaa000..127fb81 100644
--- a/web/modules/sniglets/Sniglets/AppInstall.pm
+++ b/web/modules/sniglets/Sniglets/AppInstall.pm
@@ -36,7 +36,6 @@ sub register_tags {
$pxt->register_tag("rhn-appinstall-start", \&appinstall_start);
$pxt->register_tag("rhn-appinstall-check-requirements", \&appinstall_check_requirements);
- $pxt->register_tag("rhn-appinstall-progress", \&appinstall_progress);
$pxt->register_tag("rhn-appinstall-ts-and-cs", \&appinstall_ts_and_cs);
$pxt->register_tag("rhn-appinstall-engine", \&appinstall_engine);
}
commit 63be56fd9c0b1bed2c9af59fb9f413180da2b704
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:09:51 2009 +0100
Package Sniglets::Actions is not used anywhere, removing as dead code.
diff --git a/web/modules/sniglets/Sniglets/Actions.pm b/web/modules/sniglets/Sniglets/Actions.pm
deleted file mode 100644
index d8a6fe7..0000000
--- a/web/modules/sniglets/Sniglets/Actions.pm
+++ /dev/null
@@ -1,129 +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 Sniglets::Actions;
-
-use Carp;
-use Data::Dumper;
-
-use RHN::User;
-use RHN::Action;
-use PXT::Utils;
-
-sub register_tags {
- my $class = shift;
- my $pxt = shift;
-
- $pxt->register_tag('rhn-action-details', \&action_details);
- $pxt->register_tag('rhn-action-name', \&action_name, 2);
-}
-
-sub register_callbacks {
- my $class = shift;
- my $pxt = shift;
-
-}
-
-sub action_name {
- my $pxt = shift;
-
- my $aid = $pxt->param('aid');
-
- die "no action id!" unless $aid;
-
- my $action_name = $pxt->pnotes('action_name');
-
- return $action_name if $action_name;
-
- my $action = RHN::Action->lookup(-id => $aid);
- # this should change once we add in support for named actions...
- $action_name = $action->name;
- $action_name = $action->action_type_name unless $action_name;
-
- $pxt->pnotes(action_name => $action_name);
-
- return $action_name;
-}
-
-sub action_details {
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__} || "";
-
- my $action_id = $pxt->param('aid');
- croak "No action id!" unless $action_id;
-
- my $action = RHN::Action->lookup(-id => $action_id);
- croak "Failed to load action!" unless $action;
-
- my $notes = '';
-
- if ($action->name) {
- $pxt->pnotes(action_name => $action->name);
- }
- else {
- $pxt->pnotes(action_name => $action->action_type_name);
- }
-
- my %subst;
-
- $subst{action_type} = $action->action_type_name;
- $subst{action_scheduler} = $action->action_scheduler_login;
- $subst{action_earliest_action} = $pxt->user->convert_time($action->earliest_action);
- $subst{action_in_progress_count} = $action->action_in_progress_count;
- $subst{action_successful_count} = $action->action_successful_count;
- $subst{action_failed_count} = $action->action_failed_count;
- $subst{action_total_count} = $action->action_total_count;
-
- PXT::Utils->escapeHTML_multi(\%subst);
-
- if ($subst{action_failed_count} > 0) {
- $notes .= sprintf('<strong><a href="/rhn/schedule/FailedSystems.do?aid=%d">%d system%s</a></strong> failed to complete this action.<br/><br/>', $action_id, $subst{action_failed_count}, $subst{action_failed_count} == 1 ? '' : 's');
- }
-
- if ($subst{action_successful_count} > 0) {
- $notes .= sprintf('<strong><a href="/rhn/schedule/CompletedSystems.do?aid=%d">%d system%s</a></strong> successfully completed this action.<br/><br/>', $action_id, $subst{action_successful_count}, $subst{action_successful_count} == 1 ? '' : 's');
- }
-
- # hack to show errata info straight on this page,
- # assumes that only 1 errata per scheduled action
- if ($action->action_type_label eq 'errata.update') {
- my @errata = $action->associated_errata;
- my $errata = RHN::Errata->lookup(-id => $errata[0]);
-
- if ($errata) {
- $notes .= sprintf('<strong><a href="/network/errata/details/Details.do?eid=%d">%s</a></strong><br/><br/>', $errata->id, $errata->advisory);
- $notes .= "<strong>" . $errata->synopsis . "</strong><br/><br/>";
- $notes .= $errata->advisory_type . "<br/><br/>";
- $notes .= PXT::HTML->htmlify_text($errata->topic || '') . "<br/>";
- $notes .= PXT::HTML->htmlify_text($errata->description || '') . "<br/>";
- }
- }
-
- if ($action->action_type_label eq 'script.run') {
- $notes .= sprintf(<<EOQ, $action->script_username, PXT::HTML->htmlify_text($action->script_script));
-Run as: <strong>%s</strong><br/><br/>
-<div style="padding-left: 1em"><code>%s</code></div><br/>
-EOQ
- }
-
- $subst{action_notes} = $notes || '(none)'; # don't escapeHTML notes
-
- return PXT::Utils->perform_substitutions($block, \%subst);
-}
-
-1;
commit cb6197ae71e5c4fe139762fd468309389a7008af
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:07:34 2009 +0100
rhn-errata-editor-channel-options not used anywhere, removing, as well as errata_channel_options.
diff --git a/web/modules/sniglets/Sniglets/ErrataEditor.pm b/web/modules/sniglets/Sniglets/ErrataEditor.pm
index f973b49..590a7c6 100644
--- a/web/modules/sniglets/Sniglets/ErrataEditor.pm
+++ b/web/modules/sniglets/Sniglets/ErrataEditor.pm
@@ -28,8 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-errata-editor-channel-options' => \&errata_channel_options);
-
$pxt->register_tag('rhn-if-errata-package-list-modified' => \&if_errata_package_list_modified);
$pxt->register_tag('rhn-if-var' => \&if_var, -5);
@@ -510,71 +508,6 @@ sub update_errata_cache {
$pxt->redirect($pxt->uri . "?eid=$eid");
}
-sub errata_channel_options {
- my $pxt = shift;
- my %params = @_;
-
- my $block = $params{__block__};
- my $html;
-
- my $eid = $pxt->param('eid');
- return unless $eid;
-
- my @related_channels;
-
- my $errata = RHN::ErrataTmp->lookup_managed_errata(-id => $eid);
-
- if ($errata->isa('RHN::DB::ErrataTmp')) {
- @related_channels = RHN::ErrataTmp->related_channels_owned_by_org($eid, $pxt->user->org_id);
- }
- else {
- @related_channels = RHN::Errata->channels($eid);
- }
-
- my @selected = @related_channels;
- my @owned_channels = RHN::Channel->channels_owned_by_org($pxt->user->org_id);
-
- unless (scalar @owned_channels) {
- $pxt->push_message(site_info => "Your organization does not own any channels capable of supporting errata. You must create at least one channel before you can publish an errata.");
- my $redir = $params{no_channels_redirect};
- throw "param 'no_channels_redirect' needed but not provided." unless $redir;
- $pxt->redirect($redir);
- }
-
- foreach my $channel (@owned_channels) {
- my $copy = $block;
- my $checked = 0;
-
- $channel->[1] =~ /channel_(\d+)/;
- my $channel_id = $1;
-
- next unless (RHN::Channel->channel_type_capable($channel_id, 'errata'));
-
- if (grep { $_ == $channel_id } @selected) {
- $checked = 1;
- }
-
- my $package_count = scalar($errata->channel_packages_in_errata($channel_id));
- my $packages_link = '0';
-
- if ($package_count) {
- $packages_link = sprintf(qq(<a href="/network/errata/manage/errata_channel_intersection.pxt?cid=%d&eid=%d">%d</a>), $channel_id, $eid, $package_count);
- }
-
- my %subs;
- $subs{channel_id} = $channel_id;
- $subs{channel_name} = PXT::Utils->escapeHTML($channel->[0]);
- $subs{checked} = $checked ? '1' : '';
- $subs{packages_in_errata_and_channel} = $packages_link;
-
- $copy = PXT::Utils->perform_substitutions($copy, \%subs);
-
- $html .= $copy;
- }
-
- return $html;
-}
-
sub if_var {
my $pxt = shift;
my %attr = @_;
commit f04ac87d4f3eaf1f4ab6e37c8eea9447d364d73a
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:06:11 2009 +0100
rhn-edit-errata-form not used anywhere, removing, as well as errata_edit.
diff --git a/web/modules/sniglets/Sniglets/ErrataEditor.pm b/web/modules/sniglets/Sniglets/ErrataEditor.pm
index 4a2ecc8..f973b49 100644
--- a/web/modules/sniglets/Sniglets/ErrataEditor.pm
+++ b/web/modules/sniglets/Sniglets/ErrataEditor.pm
@@ -28,8 +28,6 @@ sub register_tags {
my $class = shift;
my $pxt = shift;
- $pxt->register_tag('rhn-edit-errata-form' => \&errata_edit);
-
$pxt->register_tag('rhn-errata-editor-channel-options' => \&errata_channel_options);
$pxt->register_tag('rhn-if-errata-package-list-modified' => \&if_errata_package_list_modified);
@@ -123,124 +121,6 @@ my $errata_data = {
edit => 0 } };
-sub errata_edit {
- my $pxt = shift;
- my %params = @_;
- my $block = $params{__block__};
- my $html;
-
- my $eid = $pxt->param('eid') || 0;
-
- if ($eid) {
- throw "user '" . $pxt->user->id . "' does not own errata '$eid'"
- unless $pxt->user->verify_errata_admin($eid);
- load_package_set($pxt->user->id, $eid);
- }
-
- my %subs;
-
- $block =~ m(\{errata_edit:template\}(.*)\{/errata_edit:template\})s;
- my $template = $1;
-
- my $errata;
-
- # editing an existing errata
- if ($eid) {
- $errata = RHN::ErrataTmp->lookup_managed_errata(-id => $eid);
-
- foreach my $field (@errata_fields) {
- my $value;
-
- if ($field eq 'keywords') {
- $value = join(", ", $errata->keywords);
- }
- elsif ($field eq 'buglist') {
- my @bugs = RHN::Utils->parameterize([ $errata->bugs_fixed, ['', ''] ], 'id', 'summary');
-
- foreach my $bug (@bugs) {
- $value .= "ID: " . PXT::HTML->text(-name => "errata_buglist_" . $bug->{id} . "_id",
- -value => $bug->{id},
- -size => 6);
- $value .= "\n<br/>\n";
- $value .= "Summary: " . PXT::HTML->text(-name => "errata_buglist_" . $bug->{id} . "_summary",
- -value => PXT::Utils->escapeHTML($bug->{summary} || ''),
- -size => 60);
-
- if ($bug->{id}) {
- $value .= sprintf('<A HREF="edit.pxt?eid=%d&bug_id=%d&pxt:trap=rhn:errata_editor:delete_bug">delete</A>', $errata->id, $bug->{id});
- $value .= "<hr />\n";
- }
- else {
- $value .= PXT::HTML->submit(-value => 'Submit');
- }
- }
- }
- else {
- $value = $errata->$field() || $pxt->dirty_param("errata_$field") || $errata_data->{$field}->{default} || '';
- }
- $errata_data->{$field}{value} = $value;
- }
- }
- # creating a new errata
- else {
-
- foreach my $field (@errata_fields) {
-
- if ($field eq 'buglist') {
- my $value = "ID: " . PXT::HTML->text(-name => "errata_buglist__id",
- -value => '',
- -size => 6);
- $value .= "Summary: " . PXT::HTML->text(-name => "errata_buglist__summary",
- -value => '',
- -size => 60);
- $errata_data->{$field}->{value} = $value;
- }
- else {
- $errata_data->{$field}->{value} = PXT::Utils->escapeHTML($pxt->dirty_param("errata_$field") || $errata_data->{$field}->{default} || '');
- }
- }
- }
-
- foreach my $field (@errata_fields) {
- my $data = $errata_data->{$field};
-
- next unless $data->{display};
-
- $subs{field_name} = $data->{display};
- $subs{field_value} = $data->{value} || '';
- $subs{req_star} = $data->{required} ? '<span class="required-form-field">*</span>' : '';
-
- if ($data->{edit} eq 'text') {
- $subs{field_form_elem} = PXT::HTML->text(-name => "errata_${field}",
- -value => PXT::Utils->escapeHTML($data->{value}),
- -size => $data->{size},
- -maxlength => $data->{maxlength});
- }
- elsif ($data->{edit} eq 'textarea') {
- $subs{field_form_elem} = PXT::HTML->textarea(-name => "errata_${field}",
- -value => PXT::Utils->escapeHTML($data->{value}),
- -rows => $data->{rows},
- -cols => $data->{cols});
- }
- elsif ($data->{edit} eq 'select') {
- my @options = map { [ $_->[0], $_->[0], $_->[0] eq $data->{value} ] } @{$data->{options}};
- $subs{field_form_elem} = PXT::HTML->select(-name => "errata_${field}",
- -options => [ @options ]);
- }
- else {
- $subs{field_form_elem} = $data->{value};
- }
-
- $html .= PXT::Utils->perform_substitutions($template, \%subs);
- }
-
- $block =~ s(\{errata_edit:template\}(.*)\{/errata_edit:template\})($html)s;
- $block =~ s/\{eid\}/ref $errata ? $errata->id : 0/eg;
- $block =~ s(<if_eid>(.*)</if_eid>)(ref $errata ? $1 : '')esg;
-
- return $block;
-}
-
sub errata_edit_cb {
my $pxt = shift;
commit a2e52d41b07ba7f023d1de1e4237d3aad7888bb4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 14:03:47 2009 +0100
rhn-xml-checker not used anywhere, removing, as well as xml_checker.
diff --git a/web/modules/sniglets/Sniglets/Sets.pm b/web/modules/sniglets/Sniglets/Sets.pm
index 09195c3..c320bf7 100644
--- a/web/modules/sniglets/Sniglets/Sets.pm
+++ b/web/modules/sniglets/Sniglets/Sets.pm
@@ -28,7 +28,6 @@ sub register_tags {
my $pxt = shift;
$pxt->register_tag('rhn-set-totals' => \&set_totals);
- $pxt->register_tag('rhn-xml-checker' => \&xml_checker);
}
sub register_callbacks {
@@ -79,60 +78,4 @@ sub clear_set_cb {
$pxt->redirect($pxt->param('set_clear_redirect') || $pxt->uri);
}
-sub xml_checker {
- my $pxt = shift;
-
- $pxt->manual_content(1);
- $pxt->no_cache(1);
- $pxt->content_type('text/xml');
- $pxt->send_http_header;
-
- my %set_var_map = ( system_list => "sid" );
- my $set_label = $pxt->dirty_param('set_label');
-
- if (not $set_label or not exists $set_var_map{$set_label}) {
- $pxt->print("INVALID SET");
- return;
- }
-
- my $set = new RHN::DB::Set $set_label, $pxt->user->id;
-
- my @which = $pxt->param($set_var_map{$set_label});
-
- if ($pxt->dirty_param("checked") and $pxt->dirty_param("checked") eq "on") {
- $set->immediate_add(@which);
- }
- else {
- $set->immediate_remove(@which);
- }
- RHN::DB->connect->commit;
-
- my $count = $set->element_count;
- my $header_message;
-
- if ($count == 0) {
- $header_message = 'No systems selected';
- }
- elsif ($count == 1) {
- $header_message = '1 system selected';
- }
- else {
- $header_message = "$count systems selected";
- }
-
- my $pagination_message = "($count selected)";
-
- my $ret = <<EOS;
-<?xml version="1.0" encoding="utf-8"?>
-
-<ssm-data>
- <ssm-count-header-message>$header_message</ssm-count-header-message>
- <ssm-count-pagination-message>$pagination_message</ssm-count-pagination-message>
- <ssm-count>$count</ssm-count>
-</ssm-data>
-EOS
-
- $pxt->print($ret);
-}
-
1;
14 years, 4 months
Changes to 'refs/tags/spacewalk-reports-0.7.0-1'
by Jan Pazdziora
Tag 'spacewalk-reports-0.7.0-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2009-12-14 12:23 +0000
Tagging package [spacewalk-reports] version [0.7.0-1] in directory [reporting/].
Changes since spacewalk-backend-0.8.10-1:
Jan Pazdziora (3):
reporting: remove extra whitespace.
reporting: move reporting from spacewalk-backend to separate package spacewalk-reports.
Automatic commit of package [spacewalk-reports] release [0.7.0-1].
Milan Zazrivec (1):
510014 - man page typo fix
---
backend/satellite_tools/reports.py | 124 ------------
backend/satellite_tools/reports/data/entitlements | 57 -----
backend/satellite_tools/reports/data/errata-list | 41 ----
backend/satellite_tools/reports/data/errata-systems | 38 ---
backend/satellite_tools/reports/data/inventory | 123 ------------
backend/satellite_tools/reports/data/users | 65 ------
backend/satellite_tools/reports/data/users-systems | 59 ------
backend/satellite_tools/spacewalk-report | 192 --------------------
backend/satellite_tools/spacewalk-report.sgml | 127 -------------
backend/spacewalk-backend.spec | 4
client/rhel/rhn-client-tools/man/en/up2date.5 | 2
rel-eng/packages/spacewalk-reports | 1
reporting/reports.py | 124 ++++++++++++
reporting/reports/data/entitlements | 57 +++++
reporting/reports/data/errata-list | 41 ++++
reporting/reports/data/errata-systems | 38 +++
reporting/reports/data/inventory | 123 ++++++++++++
reporting/reports/data/users | 65 ++++++
reporting/reports/data/users-systems | 59 ++++++
reporting/spacewalk-report | 192 ++++++++++++++++++++
reporting/spacewalk-report.sgml | 127 +++++++++++++
reporting/spacewalk-reports.spec | 45 ++++
22 files changed, 873 insertions(+), 831 deletions(-)
---
14 years, 4 months
2 commits - backend/satellite_tools backend/spacewalk-backend.spec rel-eng/packages reporting/reports reporting/reports.py reporting/spacewalk-report reporting/spacewalk-report.sgml reporting/spacewalk-reports.spec
by Jan Pazdziora
backend/satellite_tools/reports.py | 124 ------------
backend/satellite_tools/reports/data/entitlements | 57 -----
backend/satellite_tools/reports/data/errata-list | 41 ----
backend/satellite_tools/reports/data/errata-systems | 38 ---
backend/satellite_tools/reports/data/inventory | 123 ------------
backend/satellite_tools/reports/data/users | 65 ------
backend/satellite_tools/reports/data/users-systems | 59 ------
backend/satellite_tools/spacewalk-report | 192 --------------------
backend/satellite_tools/spacewalk-report.sgml | 127 -------------
backend/spacewalk-backend.spec | 4
rel-eng/packages/spacewalk-reports | 1
reporting/reports.py | 124 ++++++++++++
reporting/reports/data/entitlements | 57 +++++
reporting/reports/data/errata-list | 41 ++++
reporting/reports/data/errata-systems | 38 +++
reporting/reports/data/inventory | 123 ++++++++++++
reporting/reports/data/users | 65 ++++++
reporting/reports/data/users-systems | 59 ++++++
reporting/spacewalk-report | 192 ++++++++++++++++++++
reporting/spacewalk-report.sgml | 127 +++++++++++++
reporting/spacewalk-reports.spec | 45 ++++
21 files changed, 872 insertions(+), 830 deletions(-)
New commits:
commit 8dfc84f67f9e9da72b746b6f4221ac51538d3cf6
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 13:23:58 2009 +0100
Automatic commit of package [spacewalk-reports] release [0.7.0-1].
diff --git a/rel-eng/packages/spacewalk-reports b/rel-eng/packages/spacewalk-reports
new file mode 100644
index 0000000..32927b2
--- /dev/null
+++ b/rel-eng/packages/spacewalk-reports
@@ -0,0 +1 @@
+0.7.0-1 reporting/
commit 6e3b9f87e0478591ad6827b97000dd99204f5556
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 13:22:20 2009 +0100
reporting: move reporting from spacewalk-backend to separate package spacewalk-reports.
diff --git a/backend/satellite_tools/reports.py b/backend/satellite_tools/reports.py
deleted file mode 100644
index 868ec39..0000000
--- a/backend/satellite_tools/reports.py
+++ /dev/null
@@ -1,124 +0,0 @@
-
-import os
-import re
-
-REPORT_DEFINITIONS = "/usr/share/spacewalk/reports/data"
-
-def available_reports():
- return os.listdir(REPORT_DEFINITIONS)
-
-class report:
- def __init__(self, name):
- full_path = os.path.join(REPORT_DEFINITIONS, name)
- self.sql = None
- self.description = None
- self.synopsis = None
- self.columns = None
- self.column_indexes = None
- self.column_descriptions = None
- self.multival_column_names = {}
- self.multival_columns_reverted = {}
- self.multival_columns_stop = []
- self._load(full_path)
-
- def _load(self, full_path):
- try:
- fd = open(full_path, 'r')
- except (IOError):
- raise spacewalk_unknown_report
- tag = None
- value = ''
- re_comment = re.compile('^\s*#')
- re_tag_name = re.compile('^(\S+):\s*$')
-
- for line in fd:
- result = re_comment.match(line)
- if result != None:
- continue
-
- result = re_tag_name.match(line)
- if result != None:
- if tag != None:
- self._set(tag, value)
- tag = None
- value = ''
- tag = result.group(1)
- else:
- value += line
-
- if tag != None:
- self._set(tag, value)
-
- if self.multival_column_names != None:
- unknown_columns = []
-
- for c in self.multival_column_names:
- if c in self.column_indexes:
- c_id = self.column_indexes[c]
- v = self.multival_column_names[c]
- if v == None:
- self.multival_columns_stop.append(c_id)
- elif v in self.column_indexes:
- v_id = self.column_indexes[v]
- if v_id in self.multival_columns_reverted:
- self.multival_columns_reverted[v_id].append(c_id)
- else:
- self.multival_columns_reverted[v_id] = [ c_id ]
- else:
- unknown_columns.append(c)
- if len(unknown_columns) > 0:
- raise spacewalk_report_unknown_multival_column_exception(unknown_columns)
-
-
- def _set(self, tag, value):
- if tag == 'columns':
- self.columns = []
- self.column_indexes = {}
- self.column_descriptions = {}
- lines = filter(lambda x: x != '', re.split('\s*\n\s*', value))
- i = 0
- for l in lines:
- description = None
- try:
- ( c, description ) = re.split('\s+', l, 1)
- except:
- c = l
- self.columns.append(c)
- self.column_indexes[c] = i
- if description != None:
- self.column_descriptions[c] = description
- i = i + 1
- elif tag == 'multival_columns':
- # the multival_columns specifies either
- # a "stop" column, usually the first one,
- # or a pair of column names separated by colon,
- # where the first on is column which should be
- # joined together and the second one is column
- # whose value should be used to distinguish if
- # we still have the same entity or not.
- for l in filter(lambda x: x != '', re.split('\n', value)):
- m = re.match('^\s*(\S+?)(\s*:\s*(\S*)\s*)?$', l)
- if m == None:
- continue
- ( col, id_col ) = ( m.group(1), m.group(3) )
- if col != None:
- self.multival_column_names[col] = id_col
- elif tag == 'sql':
- self.sql = value
- elif tag == 'synopsis':
- self.synopsis = re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value)
- elif tag == 'description':
- self.description = re.sub('(?m)^\s*', ' ', re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value))
- else:
- raise spacewalk_report_unknown_tag_exception(tag)
-
-
-class spacewalk_unknown_report(Exception):
- pass
-
-class spacewalk_report_unknown_tag_exception(Exception):
- pass
-
-class spacewalk_report_unknown_multival_column_exception(Exception):
- pass
-
diff --git a/backend/satellite_tools/reports/data/entitlements b/backend/satellite_tools/reports/data/entitlements
deleted file mode 100755
index 515d06f..0000000
--- a/backend/satellite_tools/reports/data/entitlements
+++ /dev/null
@@ -1,57 +0,0 @@
-
-synopsis:
-
- Entitlement and channel list and usage
-
-description:
-
- For each organization, list of system entitlements and
- channels to which the organization is entitled, together
- with current usage.
-
-columns:
-
- organization_id Organization identifier
- organization Organization name
- entitlement_type 'system' or 'channel'
- entitlement System entitlement name or channel name
- used How many entitlements are currently used
- total The total number of entitlements
-
-multival_columns:
-
- organization_id
- entitlement_type
- entitlement
-
-sql:
-
- select organization_id,
- web_customer.name as organization,
- entitlement_type,
- entitlement,
- used,
- total
- from (
- select rhnprivatechannelfamily.org_id as organization_id,
- 'channel' as entitlement_type,
- rhnchannelfamily.name as entitlement,
- rhnprivatechannelfamily.current_members as used,
- rhnprivatechannelfamily.max_members as total
- from rhnchannelfamily, rhnprivatechannelfamily
- where rhnchannelfamily.id = rhnprivatechannelfamily.channel_family_id
- union all
- select rhnservergroup.org_id as organization_id,
- 'system' as entitlement_type,
- rhnservergrouptype.name as entitlement,
- rhnservergroup.current_members as used,
- rhnservergroup.max_members as total
- from rhnservergroup, rhnservergrouptype
- where rhnservergroup.group_type = rhnservergrouptype.id
- and rhnservergroup.max_members > 0
- ) entitlements, web_customer
- where entitlements.organization_id = web_customer.id
- order by entitlements.organization_id,
- case when entitlement_type = 'channel' then 1 else 0 end,
- entitlement
-
diff --git a/backend/satellite_tools/reports/data/errata-list b/backend/satellite_tools/reports/data/errata-list
deleted file mode 100755
index 06a1ce0..0000000
--- a/backend/satellite_tools/reports/data/errata-list
+++ /dev/null
@@ -1,41 +0,0 @@
-
-synopsis:
-
- Errata out of compliance information - errata details
-
-description:
-
- List of erratas that are applicable to at least one registered
- system, together with basic info about the errata. Also see
- errata-systems report to get list of systems that are affected.
-
-columns:
-
- advisory Advisory / errata identifier
- type Advisory type (Enhancement, Bug Fix, Security)
- cve List of CVE names (Common Vulnerabilities and Exposures Identifiers) addressed by the errata
- synopsis Synopsis of the errata
- systems_affected Number of systems to which this errata is applicable
-
-multival_columns:
-
- advisory
- cve : cve
-
-sql:
-
- select rhnErrata.advisory_name as advisory,
- rhnErrata.advisory_type as type,
- rhnCVE.name as cve,
- rhnErrata.synopsis,
- count(*) as systems_affected
- from rhnErrata, rhnServerNeededErrataCache, rhnErrataCVE, rhnCVE
- where rhnErrata.id = rhnServerNeededErrataCache.errata_id
- and rhnErrata.id = rhnErrataCVE.errata_id (+)
- and rhnErrataCVE.cve_id = rhnCVE.id (+)
- group by rhnErrata.id,
- rhnErrata.advisory_name,
- rhnErrata.advisory_type,
- rhnCVE.name,
- rhnErrata.synopsis
- order by rhnErrata.advisory_name, rhnCVE.name
diff --git a/backend/satellite_tools/reports/data/errata-systems b/backend/satellite_tools/reports/data/errata-systems
deleted file mode 100755
index f40aa9f..0000000
--- a/backend/satellite_tools/reports/data/errata-systems
+++ /dev/null
@@ -1,38 +0,0 @@
-
-synopsis:
-
- Errata out of compliance information - erratas for systems
-
-description:
-
- List of applicable erratas and systems that are affected.
-
-columns:
-
- advisory Advisory / errata identifier
- server_id System identifier
- profile_name Profile name, as stored on server
- hostname Hostname, as reported by the system
- ip_address IP address, as reported by the system
-
-sql:
-
- select rhnErrata.advisory_name as advisory,
- rhnServerNeededErrataCache.server_id,
- rhnServer.name as profile_name,
- rhnservernetwork.hostname, trim(rhnservernetwork.ipaddr) as ip_address
- from rhnErrata, rhnServerNeededErrataCache, rhnServer,
- (
- select server_id, hostname, ipaddr
- from rhnservernetwork
- where id in (
- select min(id)
- from rhnservernetwork
- group by server_id
- )
- ) rhnservernetwork
- where rhnErrata.id = rhnServerNeededErrataCache.errata_id
- and rhnServerNeededErrataCache.server_id = rhnServer.id
- and rhnServerNeededErrataCache.server_id = rhnservernetwork.server_id (+)
- order by rhnErrata.advisory_name, rhnServerNeededErrataCache.server_id
-
diff --git a/backend/satellite_tools/reports/data/inventory b/backend/satellite_tools/reports/data/inventory
deleted file mode 100755
index 7662898..0000000
--- a/backend/satellite_tools/reports/data/inventory
+++ /dev/null
@@ -1,123 +0,0 @@
-
-synopsis:
-
- Inventory report
-
-description:
-
- List of systems registered to the server, together with
- hardware and software information.
-
-columns:
-
- server_id System identifier
- profile_name Profile name, as stored on server
- hostname Hostname, as reported by the system
- ip_address IP address, as reported by the system
- registered_by User under which the system is registered
- registration_time Registration time
- last_checkin_time Last checkin time
- kernel_version Kernel version, as reported by the system
- packages_out_of_date Number of packages that can be upgraded
- errata_out_of_date Number of erratas that can be applied
- software_channel List of channels to which the system is registered
- configuration_channel List of configuration channels
- entitlements List of entitlements
- system_group List of system group to which the system belongs
- organization Organization name
- virtual_host System identifier of host, if system is a guest
- architecture Architecture of the system
- hardware Hardware information
-
-multival_columns:
-
- server_id
- software_channel : software_channel
- configuration_channel : configuration_channel
- entitlements : entitlements
- system_group : system_group
- virtual_host : virtual_host
-
-sql:
-
- select rhnserver.id as server_id, rhnserver.name as profile_name,
- rhnservernetwork.hostname, trim(rhnservernetwork.ipaddr) as ip_address,
- ( select login from web_contact where rhnserver.creator_id = web_contact.id ) as registered_by,
- to_char(rhnserver.created, 'YYYY-MM-DD HH24:MI:SS') as registration_time,
- ( select to_char(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnserverinfo where rhnserver.id = server_id ) as last_checkin_time,
- running_kernel as kernel_version,
- ( select count(distinct rhnpackage.name_id) from rhnpackage, rhnserverneededpackagecache
- where rhnserver.id = rhnserverneededpackagecache.server_id
- and rhnserverneededpackagecache.package_id = rhnpackage.id ) as packages_out_of_date,
- ( select count(*) from rhnServerNeededErrataCache where rhnserver.id = server_id ) as errata_out_of_date,
- rhnchannel.name as software_channel,
- rhnconfigchannel.name as configuration_channel,
- entitlement_data.name as entitlements,
- group_data.name as system_group,
- (
- select name from web_customer where rhnserver.org_id = web_customer.id
- ) as organization,
- virtual_data.host_system_id as virtual_host,
- (
- select rhnserverarch.name from rhnserverarch where rhnserver.server_arch_id = rhnserverarch.id
- ) as architecture,
- (
- (
- select count(*) || ' CPUs' from rhncpu where rhnserver.id = rhncpu.server_id
- ) || network_data.col
- ) as hardware
- from rhnserver,
- (
- select server_id, hostname, ipaddr
- from rhnservernetwork
- where id in (
- select min(id)
- from rhnservernetwork
- group by server_id
- )
- ) rhnservernetwork,
- rhnserverchannel, rhnchannel,
- rhnserverconfigchannel, rhnconfigchannel,
- (
- select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
- from rhnservergroupmembers, rhnservergroup
- where rhnservergroupmembers.server_group_id = rhnservergroup.id (+)
- and rhnservergroup.group_type is not null
- ) entitlement_data,
- (
- select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
- from rhnservergroupmembers, rhnservergroup
- where rhnservergroupmembers.server_group_id = rhnservergroup.id (+)
- and rhnservergroup.group_type is null
- ) group_data,
- (
- select host_system_id, virtual_system_id
- from rhnvirtualinstance
- where host_system_id is not null
- ) virtual_data,
- (
- select server_id, max(sys_connect_by_path(val, '; ')) col
- from (
- select server_id,
- name||' '||ip_addr||'/'||netmask||' '||hw_addr val,
- row_number() over (partition by server_id order by name, rowid) rn
- from rhnservernetinterface
- )
- start with rn = 1
- connect by prior rn = rn - 1
- and prior server_id = server_id
- group by server_id
- ) network_data
- where rhnserver.id = rhnservernetwork.server_id (+)
- and rhnserver.id = rhnserverchannel.server_id (+)
- and rhnserverchannel.channel_id = rhnchannel.id (+)
- and rhnserver.id = rhnserverconfigchannel.server_id (+)
- and rhnserverconfigchannel.config_channel_id = rhnconfigchannel.id (+)
- and rhnserver.id = entitlement_data.server_id (+)
- and rhnserver.id = group_data.server_id (+)
- and rhnserver.id = virtual_data.virtual_system_id (+)
- and rhnserver.id = network_data.server_id (+)
- order by server_id, rhnchannel.parent_channel nulls first, rhnchannel.id,
- rhnconfigchannel.id, entitlement_data.server_group_id, group_data.server_group_id,
- virtual_data.host_system_id
-
diff --git a/backend/satellite_tools/reports/data/users b/backend/satellite_tools/reports/data/users
deleted file mode 100755
index 0a44b02..0000000
--- a/backend/satellite_tools/reports/data/users
+++ /dev/null
@@ -1,65 +0,0 @@
-
-synopsis:
-
- Users in the system
-
-description:
-
- List of all users for all organizations, with their details
- and roles.
-
-columns:
-
- organization_id Organization identifier
- organization Organization name
- user_id Internal user id
- username User name / login
- last_name Last name
- first_name First name(s)
- position Position of the user
- email Email address
- role Roles assigned to the user
- creation_time Date and time when the user was created
- last_login_time When the user last accessed the system
- active String enabled or disabled
-
-multival_columns:
-
- organization_id
- user_id
- role : role
-
-sql:
-
- select web_contact.org_id as organization_id,
- web_customer.name as organization,
- web_contact.id as user_id,
- login as username,
- web_user_personal_info.last_name,
- web_user_personal_info.first_names as first_name,
- web_user_personal_info.title as position,
- web_user_personal_info.email,
- rhnUserGroupType.name as role,
- to_char(web_contact.created, 'YYYY-MM-DD HH24:MI:SS') as creation_time,
- to_char(rhnUserInfo.last_logged_in, 'YYYY-MM-DD HH24:MI:SS') as last_login_time,
- nvl( ( select distinct wccs.label
- from rhnWebContactChangeLog wccl, rhnWebContactChangeState wccs
- where wccl.change_state_id = wccs.id
- and wccl.web_contact_id = web_contact.id
- and wccl.date_completed = (
- select max(wccl_exists.date_completed)
- from rhnWebContactChangeLog wccl_exists
- where wccl.web_contact_id = wccl_exists.web_contact_id
- )
- ),'enabled') as active
- from web_contact, web_customer, web_user_personal_info,
- rhnUserGroupMembers, rhnUserGroup, rhnUserGroupType,
- rhnUserInfo
- where web_contact.org_id = web_customer.id
- and web_contact.id = web_user_personal_info.web_user_id
- and web_contact.id = rhnUserGroupMembers.user_id (+)
- and rhnUserGroupMembers.user_group_id = rhnUserGroup.id (+)
- and rhnUserGroup.group_type = rhnUserGroupType.id (+)
- and web_contact.id = rhnUserInfo.user_id
- order by web_customer.id, web_contact.id
-
diff --git a/backend/satellite_tools/reports/data/users-systems b/backend/satellite_tools/reports/data/users-systems
deleted file mode 100755
index 94234cd..0000000
--- a/backend/satellite_tools/reports/data/users-systems
+++ /dev/null
@@ -1,59 +0,0 @@
-
-synopsis:
-
- Systems administered by individual users
-
-description:
-
- List of systems that users can administer.
-
-columns:
-
- organization_id Organization identifier
- user_id Internal user id
- username User name / login
- server_id System identifier
- group Group through the user has access to the system
- admin_access 1 if the user has access by being org administrator
-
-multival_columns:
-
- organization_id
- user_id
- server_id
- group : group
-
-# adapted query available_to_uid
-sql:
-
- select organization_id, web_contact_adm.user_id, username, server_id, group_name as "GROUP", admin_access
- from (
- select web_contact.org_id as organization_id,
- web_contact.id as user_id,
- login as username,
- case when web_contact_admin.user_id is not null then 1 else null end as admin_access
- from web_contact, (
- select rhnUserGroupMembers.user_id
- from rhnUserGroupMembers, rhnUserGroup, rhnUserGroupType
- where rhnUserGroupMembers.user_group_id = rhnUserGroup.id
- and rhnUserGroup.group_type = rhnUserGroupType.id
- and rhnUserGroupType.label = 'org_admin'
- ) web_contact_admin
- where web_contact.id = web_contact_admin.user_id (+)
- ) web_contact_adm, (
- select 1 as is_admin, web_contact.id as user_id, rhnServer.id as server_id, null as group_name
- from web_contact, rhnServer
- where web_contact.org_id = rhnServer.org_id
- union all
- select 0 as is_admin,
- rhnUserServerGroupPerms.user_id, rhnServerGroupMembers.server_id, rhnServerGroup.name as group_name
- from rhnUserServerGroupPerms, rhnServerGroupMembers, rhnServerGroup
- where rhnUserServerGroupPerms.server_group_id = rhnServerGroupMembers.server_group_id
- and rhnUserServerGroupPerms.server_group_id = rhnServerGroup.id
- ) rhn_contact_server_group
- where
- nvl(web_contact_adm.admin_access, 0) = rhn_contact_server_group.is_admin (+)
- and web_contact_adm.user_id = rhn_contact_server_group.user_id (+)
- and rhn_contact_server_group.server_id is not null
- order by organization_id, user_id, server_id
-
diff --git a/backend/satellite_tools/spacewalk-report b/backend/satellite_tools/spacewalk-report
deleted file mode 100755
index cd1be9e..0000000
--- a/backend/satellite_tools/spacewalk-report
+++ /dev/null
@@ -1,192 +0,0 @@
-#!/usr/bin/python -u
-#
-# 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.
-#
-
-import sys
-def systemExit(code, msgs=None):
- """ exit with message and code """
- if msgs:
- if type(msgs) not in [type([]), type(())]:
- msgs = (msgs, )
- for msg in msgs:
- sys.stderr.write(str(msg)+'\n')
- sys.exit(code)
-
-try:
- import os
- import csv
- from optparse import Option, OptionParser
-except KeyboardInterrupt:
- systemExit(-1, "\nUser interrupted process.")
-
-
-_LIBPATH = "/usr/share/rhn"
-# add to the path if need be
-if _LIBPATH not in sys.path:
- sys.path.append(_LIBPATH)
-
-sys.path.append('/usr/share/spacewalk')
-import reports
-
-try:
- from server import rhnSQL
- from common import initCFG
-except KeyboardInterrupt:
- systemExit(-1, "\nUser interrupted process.")
-
-
-def processCommandline():
- """ process the commandline """
- optionsTable = [
- Option('--multival-on-rows', action='store_true', dest='multivalonrows',
- help='if there are multiple values for certain field, repeat the rows'),
- Option('--multival-separator', action='store', dest='multivalseparator',
- default=';',
- help='if there are multiple values for certain field, separate them with this string' \
- ' (unless --multival-on-rows)'),
- Option('--db', action='store', type="string",
- help='alternative database string (username/password@sid);' \
- + ' default is default_db from /etc/rhn/rhn.conf'),
- Option('--info', action='store_true',
- help='print synopsis of the report in the list of report, or description of individual reports specified'),
- Option('--list-fields', action='store_true',
- dest='listfields',
- help='list fields of the report instead of running the report'),
- Option('--list-fields-info', action='store_true',
- dest='listfieldsinfo',
- help='as --list-fields but also prints description for each column'),
- ]
-
- optionParser = OptionParser( \
- usage="usage: %s [options] [report_name]" % sys.argv[0], \
- option_list=optionsTable)
- options, args = optionParser.parse_args()
-
- sys.argv[1:] = args
-
- return options
-
-if __name__ == '__main__':
- options = processCommandline()
-
- try:
- if len(sys.argv) > 2:
- systemExit(-5, 'Only one report name expected.')
- if len(sys.argv) > 1:
- report_name = sys.argv[1]
-
- try:
- report = reports.report(report_name)
- except(reports.spacewalk_unknown_report):
- systemExit(-4, 'Unknown report [%s].' % report_name)
-
- need_exit = None
- if options.info:
- if report.synopsis != None:
- print report.synopsis
- else:
- print "No synopsis for report %s." % report_name
- if report.description != None:
- print
- print report.description
- need_exit = True
-
- if options.listfields or options.listfieldsinfo:
- if options.info:
- print
- print "Fields in the report:"
- print
-
- for c in report.columns:
- text = c
- if options.info:
- text = " %s" % c
- if options.listfieldsinfo and report.column_descriptions.has_key(c) :
- text = "%s: %s" % ( text, report.column_descriptions[c] )
- print text
- need_exit = True
-
- if need_exit:
- sys.exit(0)
-
- initCFG('server')
- rhnSQL.initDB(options.db)
-
- writer = csv.writer(sys.stdout)
-
- h = rhnSQL.prepare(report.sql)
- h.execute()
-
- db_columns = map(lambda x: x[0].lower(), h.description)
- if db_columns != report.columns:
- systemExit(-3, \
- "Columns in report spec and in the database do not match:\nexpected %s\n got %s" % ( report.columns, db_columns ))
- writer.writerow(report.columns)
-
- row = h.fetchone()
- prevrow = None
- outrow = None
- multival_dupes = {}
- while row != None:
- if options.multivalonrows or not report.multival_column_names.keys():
- writer.writerow(row)
- row = h.fetchone()
- continue
-
- if outrow != None:
- for m in report.multival_columns_stop:
- if prevrow[m] != row[m]:
- writer.writerow(outrow)
- outrow = None
- break
-
- if outrow != None:
- for m in report.multival_columns_reverted.keys():
- if prevrow[m] != row[m]:
- if not m in multival_dupes:
- multival_dupes[m] = {}
- if not row[m] in multival_dupes[m]:
- outrow[m] = str(outrow[m]) + options.multivalseparator + str(row[m])
- multival_dupes[m][row[m]] = 1
- break
-
- if outrow == None:
- outrow = [ x for x in row ]
- multival_dupes = {}
-
- prevrow = row
- row = h.fetchone()
-
- if outrow != None:
- writer.writerow(outrow)
- else:
- for report_name in reports.available_reports():
- if options.info:
- synopsis = ''
- try:
- report = reports.report(report_name)
- synopsis = report.synopsis
- except:
- None
- print "%s: %s" % ( report_name, synopsis )
- else:
- print report_name
-
- except KeyboardInterrupt:
- systemExit(-1, "\nUser interrupted process.")
- except (rhnSQL.SQLError, rhnSQL.SQLSchemaError, rhnSQL.SQLConnectError), e:
- # really a stub for better exception handling in the future.
- sys.stderr.write("SQL error occurred, traceback follows...\n")
- raise
-
diff --git a/backend/satellite_tools/spacewalk-report.sgml b/backend/satellite_tools/spacewalk-report.sgml
deleted file mode 100644
index d792336..0000000
--- a/backend/satellite_tools/spacewalk-report.sgml
+++ /dev/null
@@ -1,127 +0,0 @@
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
-
-<refentry>
-
-<RefMeta>
-<RefEntryTitle>spacewalk-report</RefEntryTitle><manvolnum>8</manvolnum>
-</RefMeta>
-
-<RefNameDiv>
-<RefName><command>spacewalk-report</command></RefName>
-<RefPurpose>
-Generate reports from Spacewalk server in csv format
-</RefPurpose>
-</RefNameDiv>
-
-<RefSynopsisDiv>
-<Synopsis>
- <cmdsynopsis>
- <command>spacewalk-report</command>
- <arg>--db=<replaceable>connect_string</replaceable></arg>
- <arg>--info</arg>
- </cmdsynopsis>
- <cmdsynopsis>
- <command>spacewalk-report</command>
- <sbr />
- <group>
- <arg>--multival-on-rows</arg>
- <arg>--multival-separator=<replaceable>separator-string</replaceable></arg>
- </group>
- <sbr />
- <arg>--db=<replaceable>connect-string</replaceable></arg>
- <sbr />
- <arg>--info</arg>
- <sbr />
- <group><arg>--list-fields</arg><arg>--list-fields-info</arg></group>
- <sbr />
- <arg choice='plain'><replaceable>report-name</replaceable></arg>
- </cmdsynopsis>
-</Synopsis>
-</RefSynopsisDiv>
-
-<RefSect1><Title>Description</Title>
-<para>
- The <command>spacewalk-report</command> command can be used to
- generate canned reports from Spacewalk server database. The report
- which will be generated is selected by specifying its name as
- a parameter to <command>spacewalk-report</command>.
-</para>
-
-<para>
- If the report name is not specified, list of available report
- names is printed, one name per line.
-</para>
-
-<RefSect1><Title>Options</Title>
-<variablelist>
- <varlistentry>
- <term>--info</term>
- <listitem>
- <para>When listing available reports, also print
- synopsis for each report.</para>
-
- <para>When used with report name specified, print
- synopsis and description for the report, instead
- of running the report.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--multival-on-rows</term>
- <listitem>
- <para>If certain field can have multiple values, you can
- use this option to have records for the entity repeated
- in output in the form of cartesian product. By default,
- those multiple values are presented on one row in one
- field, separated by semicolon.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--multival-separator=<replaceable>separator-string</replaceable></term>
- <listitem>
- <para>If multiple values are output on one row (the
- default), this option can change the string which
- separates multiple values in one field. The default is
- semicolon.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--db=<replaceable>connect-string</replaceable></term>
- <listitem>
- <para>Database connect string in the form of
- <replaceable>username/password@dbname</replaceable> can be
- specified to generated report from user-defined database.
- By default, connect string from default_db option from
- /etc/rhn/rhn.conf is used.</para>
- <para>This option should be considered obsoleted and may
- not be available in next versions of
- <command>spacewalk-report</command>.
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--list-fields</term>
- <listitem>
- <para>Instead of running the report, shows fields that the
- report has, one field name per line.</para>
- </listitem>
- </varlistentry>
- <varlistentry>
- <term>--list-fields-info</term>
- <listitem>
- <para>Instead of running the report, shows fields that the
- report has, one field name per line, and a description of
- that field.</para>
- </listitem>
- </varlistentry>
-</variablelist>
-</RefSect1>
-
-<RefSect1><Title>Authors</Title>
-<simplelist>
- <member>Jan Pazdziora</member>
-</simplelist>
-</RefSect1>
-</RefEntry>
-
-<!--
-vim: sw=4
--->
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index d788672..639bfea 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -522,7 +522,6 @@ rm -f %{rhnconf}/rhnSecret.py*
%attr(755,root,root) %{_bindir}/rhn-ssl-dbstore
%attr(755,root,root) %{_bindir}/satellite-sync
%attr(755,root,root) %{_bindir}/spacewalk-debug
-%attr(755,root,root) %{_bindir}/spacewalk-report
%attr(755,root,root) %{_bindir}/rhn-satellite-exporter
%attr(755,root,root) %{_bindir}/update-packages
%attr(755,root,root) %{_bindir}/spacewalk-repo-sync
@@ -559,8 +558,6 @@ rm -f %{rhnconf}/rhnSecret.py*
%attr(770,root,apache) %dir %{_var}/log/rhn/reposync
%{rhnroot}/satellite_tools/repo_plugins/__init__.py*
%{rhnroot}/satellite_tools/repo_plugins/yum_src.py*
-%{_prefix}/share/spacewalk/reports.py*
-%{_prefix}/share/spacewalk/reports/data/*
%config %attr(644,root,apache) %{rhnconf}/default/rhn_server_iss.conf
%{_mandir}/man8/rhn-satellite-exporter.8*
%{_mandir}/man8/rhn-charsets.8*
@@ -571,7 +568,6 @@ rm -f %{rhnconf}/rhnSecret.py*
%{_mandir}/man8/rhn-schema-stats.8*
%{_mandir}/man8/satellite-sync.8*
%{_mandir}/man8/spacewalk-debug.8*
-%{_mandir}/man8/spacewalk-report.8*
%{_mandir}/man8/satpasswd.8*
%{_mandir}/man8/satwho.8*
diff --git a/reporting/reports.py b/reporting/reports.py
new file mode 100644
index 0000000..868ec39
--- /dev/null
+++ b/reporting/reports.py
@@ -0,0 +1,124 @@
+
+import os
+import re
+
+REPORT_DEFINITIONS = "/usr/share/spacewalk/reports/data"
+
+def available_reports():
+ return os.listdir(REPORT_DEFINITIONS)
+
+class report:
+ def __init__(self, name):
+ full_path = os.path.join(REPORT_DEFINITIONS, name)
+ self.sql = None
+ self.description = None
+ self.synopsis = None
+ self.columns = None
+ self.column_indexes = None
+ self.column_descriptions = None
+ self.multival_column_names = {}
+ self.multival_columns_reverted = {}
+ self.multival_columns_stop = []
+ self._load(full_path)
+
+ def _load(self, full_path):
+ try:
+ fd = open(full_path, 'r')
+ except (IOError):
+ raise spacewalk_unknown_report
+ tag = None
+ value = ''
+ re_comment = re.compile('^\s*#')
+ re_tag_name = re.compile('^(\S+):\s*$')
+
+ for line in fd:
+ result = re_comment.match(line)
+ if result != None:
+ continue
+
+ result = re_tag_name.match(line)
+ if result != None:
+ if tag != None:
+ self._set(tag, value)
+ tag = None
+ value = ''
+ tag = result.group(1)
+ else:
+ value += line
+
+ if tag != None:
+ self._set(tag, value)
+
+ if self.multival_column_names != None:
+ unknown_columns = []
+
+ for c in self.multival_column_names:
+ if c in self.column_indexes:
+ c_id = self.column_indexes[c]
+ v = self.multival_column_names[c]
+ if v == None:
+ self.multival_columns_stop.append(c_id)
+ elif v in self.column_indexes:
+ v_id = self.column_indexes[v]
+ if v_id in self.multival_columns_reverted:
+ self.multival_columns_reverted[v_id].append(c_id)
+ else:
+ self.multival_columns_reverted[v_id] = [ c_id ]
+ else:
+ unknown_columns.append(c)
+ if len(unknown_columns) > 0:
+ raise spacewalk_report_unknown_multival_column_exception(unknown_columns)
+
+
+ def _set(self, tag, value):
+ if tag == 'columns':
+ self.columns = []
+ self.column_indexes = {}
+ self.column_descriptions = {}
+ lines = filter(lambda x: x != '', re.split('\s*\n\s*', value))
+ i = 0
+ for l in lines:
+ description = None
+ try:
+ ( c, description ) = re.split('\s+', l, 1)
+ except:
+ c = l
+ self.columns.append(c)
+ self.column_indexes[c] = i
+ if description != None:
+ self.column_descriptions[c] = description
+ i = i + 1
+ elif tag == 'multival_columns':
+ # the multival_columns specifies either
+ # a "stop" column, usually the first one,
+ # or a pair of column names separated by colon,
+ # where the first on is column which should be
+ # joined together and the second one is column
+ # whose value should be used to distinguish if
+ # we still have the same entity or not.
+ for l in filter(lambda x: x != '', re.split('\n', value)):
+ m = re.match('^\s*(\S+?)(\s*:\s*(\S*)\s*)?$', l)
+ if m == None:
+ continue
+ ( col, id_col ) = ( m.group(1), m.group(3) )
+ if col != None:
+ self.multival_column_names[col] = id_col
+ elif tag == 'sql':
+ self.sql = value
+ elif tag == 'synopsis':
+ self.synopsis = re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value)
+ elif tag == 'description':
+ self.description = re.sub('(?m)^\s*', ' ', re.sub('^(\s*\n)+\s*|(\s*\n)+$', '', value))
+ else:
+ raise spacewalk_report_unknown_tag_exception(tag)
+
+
+class spacewalk_unknown_report(Exception):
+ pass
+
+class spacewalk_report_unknown_tag_exception(Exception):
+ pass
+
+class spacewalk_report_unknown_multival_column_exception(Exception):
+ pass
+
diff --git a/reporting/reports/data/entitlements b/reporting/reports/data/entitlements
new file mode 100755
index 0000000..515d06f
--- /dev/null
+++ b/reporting/reports/data/entitlements
@@ -0,0 +1,57 @@
+
+synopsis:
+
+ Entitlement and channel list and usage
+
+description:
+
+ For each organization, list of system entitlements and
+ channels to which the organization is entitled, together
+ with current usage.
+
+columns:
+
+ organization_id Organization identifier
+ organization Organization name
+ entitlement_type 'system' or 'channel'
+ entitlement System entitlement name or channel name
+ used How many entitlements are currently used
+ total The total number of entitlements
+
+multival_columns:
+
+ organization_id
+ entitlement_type
+ entitlement
+
+sql:
+
+ select organization_id,
+ web_customer.name as organization,
+ entitlement_type,
+ entitlement,
+ used,
+ total
+ from (
+ select rhnprivatechannelfamily.org_id as organization_id,
+ 'channel' as entitlement_type,
+ rhnchannelfamily.name as entitlement,
+ rhnprivatechannelfamily.current_members as used,
+ rhnprivatechannelfamily.max_members as total
+ from rhnchannelfamily, rhnprivatechannelfamily
+ where rhnchannelfamily.id = rhnprivatechannelfamily.channel_family_id
+ union all
+ select rhnservergroup.org_id as organization_id,
+ 'system' as entitlement_type,
+ rhnservergrouptype.name as entitlement,
+ rhnservergroup.current_members as used,
+ rhnservergroup.max_members as total
+ from rhnservergroup, rhnservergrouptype
+ where rhnservergroup.group_type = rhnservergrouptype.id
+ and rhnservergroup.max_members > 0
+ ) entitlements, web_customer
+ where entitlements.organization_id = web_customer.id
+ order by entitlements.organization_id,
+ case when entitlement_type = 'channel' then 1 else 0 end,
+ entitlement
+
diff --git a/reporting/reports/data/errata-list b/reporting/reports/data/errata-list
new file mode 100755
index 0000000..06a1ce0
--- /dev/null
+++ b/reporting/reports/data/errata-list
@@ -0,0 +1,41 @@
+
+synopsis:
+
+ Errata out of compliance information - errata details
+
+description:
+
+ List of erratas that are applicable to at least one registered
+ system, together with basic info about the errata. Also see
+ errata-systems report to get list of systems that are affected.
+
+columns:
+
+ advisory Advisory / errata identifier
+ type Advisory type (Enhancement, Bug Fix, Security)
+ cve List of CVE names (Common Vulnerabilities and Exposures Identifiers) addressed by the errata
+ synopsis Synopsis of the errata
+ systems_affected Number of systems to which this errata is applicable
+
+multival_columns:
+
+ advisory
+ cve : cve
+
+sql:
+
+ select rhnErrata.advisory_name as advisory,
+ rhnErrata.advisory_type as type,
+ rhnCVE.name as cve,
+ rhnErrata.synopsis,
+ count(*) as systems_affected
+ from rhnErrata, rhnServerNeededErrataCache, rhnErrataCVE, rhnCVE
+ where rhnErrata.id = rhnServerNeededErrataCache.errata_id
+ and rhnErrata.id = rhnErrataCVE.errata_id (+)
+ and rhnErrataCVE.cve_id = rhnCVE.id (+)
+ group by rhnErrata.id,
+ rhnErrata.advisory_name,
+ rhnErrata.advisory_type,
+ rhnCVE.name,
+ rhnErrata.synopsis
+ order by rhnErrata.advisory_name, rhnCVE.name
diff --git a/reporting/reports/data/errata-systems b/reporting/reports/data/errata-systems
new file mode 100755
index 0000000..f40aa9f
--- /dev/null
+++ b/reporting/reports/data/errata-systems
@@ -0,0 +1,38 @@
+
+synopsis:
+
+ Errata out of compliance information - erratas for systems
+
+description:
+
+ List of applicable erratas and systems that are affected.
+
+columns:
+
+ advisory Advisory / errata identifier
+ server_id System identifier
+ profile_name Profile name, as stored on server
+ hostname Hostname, as reported by the system
+ ip_address IP address, as reported by the system
+
+sql:
+
+ select rhnErrata.advisory_name as advisory,
+ rhnServerNeededErrataCache.server_id,
+ rhnServer.name as profile_name,
+ rhnservernetwork.hostname, trim(rhnservernetwork.ipaddr) as ip_address
+ from rhnErrata, rhnServerNeededErrataCache, rhnServer,
+ (
+ select server_id, hostname, ipaddr
+ from rhnservernetwork
+ where id in (
+ select min(id)
+ from rhnservernetwork
+ group by server_id
+ )
+ ) rhnservernetwork
+ where rhnErrata.id = rhnServerNeededErrataCache.errata_id
+ and rhnServerNeededErrataCache.server_id = rhnServer.id
+ and rhnServerNeededErrataCache.server_id = rhnservernetwork.server_id (+)
+ order by rhnErrata.advisory_name, rhnServerNeededErrataCache.server_id
+
diff --git a/reporting/reports/data/inventory b/reporting/reports/data/inventory
new file mode 100755
index 0000000..7662898
--- /dev/null
+++ b/reporting/reports/data/inventory
@@ -0,0 +1,123 @@
+
+synopsis:
+
+ Inventory report
+
+description:
+
+ List of systems registered to the server, together with
+ hardware and software information.
+
+columns:
+
+ server_id System identifier
+ profile_name Profile name, as stored on server
+ hostname Hostname, as reported by the system
+ ip_address IP address, as reported by the system
+ registered_by User under which the system is registered
+ registration_time Registration time
+ last_checkin_time Last checkin time
+ kernel_version Kernel version, as reported by the system
+ packages_out_of_date Number of packages that can be upgraded
+ errata_out_of_date Number of erratas that can be applied
+ software_channel List of channels to which the system is registered
+ configuration_channel List of configuration channels
+ entitlements List of entitlements
+ system_group List of system group to which the system belongs
+ organization Organization name
+ virtual_host System identifier of host, if system is a guest
+ architecture Architecture of the system
+ hardware Hardware information
+
+multival_columns:
+
+ server_id
+ software_channel : software_channel
+ configuration_channel : configuration_channel
+ entitlements : entitlements
+ system_group : system_group
+ virtual_host : virtual_host
+
+sql:
+
+ select rhnserver.id as server_id, rhnserver.name as profile_name,
+ rhnservernetwork.hostname, trim(rhnservernetwork.ipaddr) as ip_address,
+ ( select login from web_contact where rhnserver.creator_id = web_contact.id ) as registered_by,
+ to_char(rhnserver.created, 'YYYY-MM-DD HH24:MI:SS') as registration_time,
+ ( select to_char(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnserverinfo where rhnserver.id = server_id ) as last_checkin_time,
+ running_kernel as kernel_version,
+ ( select count(distinct rhnpackage.name_id) from rhnpackage, rhnserverneededpackagecache
+ where rhnserver.id = rhnserverneededpackagecache.server_id
+ and rhnserverneededpackagecache.package_id = rhnpackage.id ) as packages_out_of_date,
+ ( select count(*) from rhnServerNeededErrataCache where rhnserver.id = server_id ) as errata_out_of_date,
+ rhnchannel.name as software_channel,
+ rhnconfigchannel.name as configuration_channel,
+ entitlement_data.name as entitlements,
+ group_data.name as system_group,
+ (
+ select name from web_customer where rhnserver.org_id = web_customer.id
+ ) as organization,
+ virtual_data.host_system_id as virtual_host,
+ (
+ select rhnserverarch.name from rhnserverarch where rhnserver.server_arch_id = rhnserverarch.id
+ ) as architecture,
+ (
+ (
+ select count(*) || ' CPUs' from rhncpu where rhnserver.id = rhncpu.server_id
+ ) || network_data.col
+ ) as hardware
+ from rhnserver,
+ (
+ select server_id, hostname, ipaddr
+ from rhnservernetwork
+ where id in (
+ select min(id)
+ from rhnservernetwork
+ group by server_id
+ )
+ ) rhnservernetwork,
+ rhnserverchannel, rhnchannel,
+ rhnserverconfigchannel, rhnconfigchannel,
+ (
+ select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
+ from rhnservergroupmembers, rhnservergroup
+ where rhnservergroupmembers.server_group_id = rhnservergroup.id (+)
+ and rhnservergroup.group_type is not null
+ ) entitlement_data,
+ (
+ select rhnservergroupmembers.server_id, rhnservergroupmembers.server_group_id, rhnservergroup.name
+ from rhnservergroupmembers, rhnservergroup
+ where rhnservergroupmembers.server_group_id = rhnservergroup.id (+)
+ and rhnservergroup.group_type is null
+ ) group_data,
+ (
+ select host_system_id, virtual_system_id
+ from rhnvirtualinstance
+ where host_system_id is not null
+ ) virtual_data,
+ (
+ select server_id, max(sys_connect_by_path(val, '; ')) col
+ from (
+ select server_id,
+ name||' '||ip_addr||'/'||netmask||' '||hw_addr val,
+ row_number() over (partition by server_id order by name, rowid) rn
+ from rhnservernetinterface
+ )
+ start with rn = 1
+ connect by prior rn = rn - 1
+ and prior server_id = server_id
+ group by server_id
+ ) network_data
+ where rhnserver.id = rhnservernetwork.server_id (+)
+ and rhnserver.id = rhnserverchannel.server_id (+)
+ and rhnserverchannel.channel_id = rhnchannel.id (+)
+ and rhnserver.id = rhnserverconfigchannel.server_id (+)
+ and rhnserverconfigchannel.config_channel_id = rhnconfigchannel.id (+)
+ and rhnserver.id = entitlement_data.server_id (+)
+ and rhnserver.id = group_data.server_id (+)
+ and rhnserver.id = virtual_data.virtual_system_id (+)
+ and rhnserver.id = network_data.server_id (+)
+ order by server_id, rhnchannel.parent_channel nulls first, rhnchannel.id,
+ rhnconfigchannel.id, entitlement_data.server_group_id, group_data.server_group_id,
+ virtual_data.host_system_id
+
diff --git a/reporting/reports/data/users b/reporting/reports/data/users
new file mode 100755
index 0000000..0a44b02
--- /dev/null
+++ b/reporting/reports/data/users
@@ -0,0 +1,65 @@
+
+synopsis:
+
+ Users in the system
+
+description:
+
+ List of all users for all organizations, with their details
+ and roles.
+
+columns:
+
+ organization_id Organization identifier
+ organization Organization name
+ user_id Internal user id
+ username User name / login
+ last_name Last name
+ first_name First name(s)
+ position Position of the user
+ email Email address
+ role Roles assigned to the user
+ creation_time Date and time when the user was created
+ last_login_time When the user last accessed the system
+ active String enabled or disabled
+
+multival_columns:
+
+ organization_id
+ user_id
+ role : role
+
+sql:
+
+ select web_contact.org_id as organization_id,
+ web_customer.name as organization,
+ web_contact.id as user_id,
+ login as username,
+ web_user_personal_info.last_name,
+ web_user_personal_info.first_names as first_name,
+ web_user_personal_info.title as position,
+ web_user_personal_info.email,
+ rhnUserGroupType.name as role,
+ to_char(web_contact.created, 'YYYY-MM-DD HH24:MI:SS') as creation_time,
+ to_char(rhnUserInfo.last_logged_in, 'YYYY-MM-DD HH24:MI:SS') as last_login_time,
+ nvl( ( select distinct wccs.label
+ from rhnWebContactChangeLog wccl, rhnWebContactChangeState wccs
+ where wccl.change_state_id = wccs.id
+ and wccl.web_contact_id = web_contact.id
+ and wccl.date_completed = (
+ select max(wccl_exists.date_completed)
+ from rhnWebContactChangeLog wccl_exists
+ where wccl.web_contact_id = wccl_exists.web_contact_id
+ )
+ ),'enabled') as active
+ from web_contact, web_customer, web_user_personal_info,
+ rhnUserGroupMembers, rhnUserGroup, rhnUserGroupType,
+ rhnUserInfo
+ where web_contact.org_id = web_customer.id
+ and web_contact.id = web_user_personal_info.web_user_id
+ and web_contact.id = rhnUserGroupMembers.user_id (+)
+ and rhnUserGroupMembers.user_group_id = rhnUserGroup.id (+)
+ and rhnUserGroup.group_type = rhnUserGroupType.id (+)
+ and web_contact.id = rhnUserInfo.user_id
+ order by web_customer.id, web_contact.id
+
diff --git a/reporting/reports/data/users-systems b/reporting/reports/data/users-systems
new file mode 100755
index 0000000..94234cd
--- /dev/null
+++ b/reporting/reports/data/users-systems
@@ -0,0 +1,59 @@
+
+synopsis:
+
+ Systems administered by individual users
+
+description:
+
+ List of systems that users can administer.
+
+columns:
+
+ organization_id Organization identifier
+ user_id Internal user id
+ username User name / login
+ server_id System identifier
+ group Group through the user has access to the system
+ admin_access 1 if the user has access by being org administrator
+
+multival_columns:
+
+ organization_id
+ user_id
+ server_id
+ group : group
+
+# adapted query available_to_uid
+sql:
+
+ select organization_id, web_contact_adm.user_id, username, server_id, group_name as "GROUP", admin_access
+ from (
+ select web_contact.org_id as organization_id,
+ web_contact.id as user_id,
+ login as username,
+ case when web_contact_admin.user_id is not null then 1 else null end as admin_access
+ from web_contact, (
+ select rhnUserGroupMembers.user_id
+ from rhnUserGroupMembers, rhnUserGroup, rhnUserGroupType
+ where rhnUserGroupMembers.user_group_id = rhnUserGroup.id
+ and rhnUserGroup.group_type = rhnUserGroupType.id
+ and rhnUserGroupType.label = 'org_admin'
+ ) web_contact_admin
+ where web_contact.id = web_contact_admin.user_id (+)
+ ) web_contact_adm, (
+ select 1 as is_admin, web_contact.id as user_id, rhnServer.id as server_id, null as group_name
+ from web_contact, rhnServer
+ where web_contact.org_id = rhnServer.org_id
+ union all
+ select 0 as is_admin,
+ rhnUserServerGroupPerms.user_id, rhnServerGroupMembers.server_id, rhnServerGroup.name as group_name
+ from rhnUserServerGroupPerms, rhnServerGroupMembers, rhnServerGroup
+ where rhnUserServerGroupPerms.server_group_id = rhnServerGroupMembers.server_group_id
+ and rhnUserServerGroupPerms.server_group_id = rhnServerGroup.id
+ ) rhn_contact_server_group
+ where
+ nvl(web_contact_adm.admin_access, 0) = rhn_contact_server_group.is_admin (+)
+ and web_contact_adm.user_id = rhn_contact_server_group.user_id (+)
+ and rhn_contact_server_group.server_id is not null
+ order by organization_id, user_id, server_id
+
diff --git a/reporting/spacewalk-report b/reporting/spacewalk-report
new file mode 100755
index 0000000..cd1be9e
--- /dev/null
+++ b/reporting/spacewalk-report
@@ -0,0 +1,192 @@
+#!/usr/bin/python -u
+#
+# 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.
+#
+
+import sys
+def systemExit(code, msgs=None):
+ """ exit with message and code """
+ if msgs:
+ if type(msgs) not in [type([]), type(())]:
+ msgs = (msgs, )
+ for msg in msgs:
+ sys.stderr.write(str(msg)+'\n')
+ sys.exit(code)
+
+try:
+ import os
+ import csv
+ from optparse import Option, OptionParser
+except KeyboardInterrupt:
+ systemExit(-1, "\nUser interrupted process.")
+
+
+_LIBPATH = "/usr/share/rhn"
+# add to the path if need be
+if _LIBPATH not in sys.path:
+ sys.path.append(_LIBPATH)
+
+sys.path.append('/usr/share/spacewalk')
+import reports
+
+try:
+ from server import rhnSQL
+ from common import initCFG
+except KeyboardInterrupt:
+ systemExit(-1, "\nUser interrupted process.")
+
+
+def processCommandline():
+ """ process the commandline """
+ optionsTable = [
+ Option('--multival-on-rows', action='store_true', dest='multivalonrows',
+ help='if there are multiple values for certain field, repeat the rows'),
+ Option('--multival-separator', action='store', dest='multivalseparator',
+ default=';',
+ help='if there are multiple values for certain field, separate them with this string' \
+ ' (unless --multival-on-rows)'),
+ Option('--db', action='store', type="string",
+ help='alternative database string (username/password@sid);' \
+ + ' default is default_db from /etc/rhn/rhn.conf'),
+ Option('--info', action='store_true',
+ help='print synopsis of the report in the list of report, or description of individual reports specified'),
+ Option('--list-fields', action='store_true',
+ dest='listfields',
+ help='list fields of the report instead of running the report'),
+ Option('--list-fields-info', action='store_true',
+ dest='listfieldsinfo',
+ help='as --list-fields but also prints description for each column'),
+ ]
+
+ optionParser = OptionParser( \
+ usage="usage: %s [options] [report_name]" % sys.argv[0], \
+ option_list=optionsTable)
+ options, args = optionParser.parse_args()
+
+ sys.argv[1:] = args
+
+ return options
+
+if __name__ == '__main__':
+ options = processCommandline()
+
+ try:
+ if len(sys.argv) > 2:
+ systemExit(-5, 'Only one report name expected.')
+ if len(sys.argv) > 1:
+ report_name = sys.argv[1]
+
+ try:
+ report = reports.report(report_name)
+ except(reports.spacewalk_unknown_report):
+ systemExit(-4, 'Unknown report [%s].' % report_name)
+
+ need_exit = None
+ if options.info:
+ if report.synopsis != None:
+ print report.synopsis
+ else:
+ print "No synopsis for report %s." % report_name
+ if report.description != None:
+ print
+ print report.description
+ need_exit = True
+
+ if options.listfields or options.listfieldsinfo:
+ if options.info:
+ print
+ print "Fields in the report:"
+ print
+
+ for c in report.columns:
+ text = c
+ if options.info:
+ text = " %s" % c
+ if options.listfieldsinfo and report.column_descriptions.has_key(c) :
+ text = "%s: %s" % ( text, report.column_descriptions[c] )
+ print text
+ need_exit = True
+
+ if need_exit:
+ sys.exit(0)
+
+ initCFG('server')
+ rhnSQL.initDB(options.db)
+
+ writer = csv.writer(sys.stdout)
+
+ h = rhnSQL.prepare(report.sql)
+ h.execute()
+
+ db_columns = map(lambda x: x[0].lower(), h.description)
+ if db_columns != report.columns:
+ systemExit(-3, \
+ "Columns in report spec and in the database do not match:\nexpected %s\n got %s" % ( report.columns, db_columns ))
+ writer.writerow(report.columns)
+
+ row = h.fetchone()
+ prevrow = None
+ outrow = None
+ multival_dupes = {}
+ while row != None:
+ if options.multivalonrows or not report.multival_column_names.keys():
+ writer.writerow(row)
+ row = h.fetchone()
+ continue
+
+ if outrow != None:
+ for m in report.multival_columns_stop:
+ if prevrow[m] != row[m]:
+ writer.writerow(outrow)
+ outrow = None
+ break
+
+ if outrow != None:
+ for m in report.multival_columns_reverted.keys():
+ if prevrow[m] != row[m]:
+ if not m in multival_dupes:
+ multival_dupes[m] = {}
+ if not row[m] in multival_dupes[m]:
+ outrow[m] = str(outrow[m]) + options.multivalseparator + str(row[m])
+ multival_dupes[m][row[m]] = 1
+ break
+
+ if outrow == None:
+ outrow = [ x for x in row ]
+ multival_dupes = {}
+
+ prevrow = row
+ row = h.fetchone()
+
+ if outrow != None:
+ writer.writerow(outrow)
+ else:
+ for report_name in reports.available_reports():
+ if options.info:
+ synopsis = ''
+ try:
+ report = reports.report(report_name)
+ synopsis = report.synopsis
+ except:
+ None
+ print "%s: %s" % ( report_name, synopsis )
+ else:
+ print report_name
+
+ except KeyboardInterrupt:
+ systemExit(-1, "\nUser interrupted process.")
+ except (rhnSQL.SQLError, rhnSQL.SQLSchemaError, rhnSQL.SQLConnectError), e:
+ # really a stub for better exception handling in the future.
+ sys.stderr.write("SQL error occurred, traceback follows...\n")
+ raise
+
diff --git a/reporting/spacewalk-report.sgml b/reporting/spacewalk-report.sgml
new file mode 100644
index 0000000..d792336
--- /dev/null
+++ b/reporting/spacewalk-report.sgml
@@ -0,0 +1,127 @@
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN">
+
+<refentry>
+
+<RefMeta>
+<RefEntryTitle>spacewalk-report</RefEntryTitle><manvolnum>8</manvolnum>
+</RefMeta>
+
+<RefNameDiv>
+<RefName><command>spacewalk-report</command></RefName>
+<RefPurpose>
+Generate reports from Spacewalk server in csv format
+</RefPurpose>
+</RefNameDiv>
+
+<RefSynopsisDiv>
+<Synopsis>
+ <cmdsynopsis>
+ <command>spacewalk-report</command>
+ <arg>--db=<replaceable>connect_string</replaceable></arg>
+ <arg>--info</arg>
+ </cmdsynopsis>
+ <cmdsynopsis>
+ <command>spacewalk-report</command>
+ <sbr />
+ <group>
+ <arg>--multival-on-rows</arg>
+ <arg>--multival-separator=<replaceable>separator-string</replaceable></arg>
+ </group>
+ <sbr />
+ <arg>--db=<replaceable>connect-string</replaceable></arg>
+ <sbr />
+ <arg>--info</arg>
+ <sbr />
+ <group><arg>--list-fields</arg><arg>--list-fields-info</arg></group>
+ <sbr />
+ <arg choice='plain'><replaceable>report-name</replaceable></arg>
+ </cmdsynopsis>
+</Synopsis>
+</RefSynopsisDiv>
+
+<RefSect1><Title>Description</Title>
+<para>
+ The <command>spacewalk-report</command> command can be used to
+ generate canned reports from Spacewalk server database. The report
+ which will be generated is selected by specifying its name as
+ a parameter to <command>spacewalk-report</command>.
+</para>
+
+<para>
+ If the report name is not specified, list of available report
+ names is printed, one name per line.
+</para>
+
+<RefSect1><Title>Options</Title>
+<variablelist>
+ <varlistentry>
+ <term>--info</term>
+ <listitem>
+ <para>When listing available reports, also print
+ synopsis for each report.</para>
+
+ <para>When used with report name specified, print
+ synopsis and description for the report, instead
+ of running the report.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>--multival-on-rows</term>
+ <listitem>
+ <para>If certain field can have multiple values, you can
+ use this option to have records for the entity repeated
+ in output in the form of cartesian product. By default,
+ those multiple values are presented on one row in one
+ field, separated by semicolon.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>--multival-separator=<replaceable>separator-string</replaceable></term>
+ <listitem>
+ <para>If multiple values are output on one row (the
+ default), this option can change the string which
+ separates multiple values in one field. The default is
+ semicolon.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>--db=<replaceable>connect-string</replaceable></term>
+ <listitem>
+ <para>Database connect string in the form of
+ <replaceable>username/password@dbname</replaceable> can be
+ specified to generated report from user-defined database.
+ By default, connect string from default_db option from
+ /etc/rhn/rhn.conf is used.</para>
+ <para>This option should be considered obsoleted and may
+ not be available in next versions of
+ <command>spacewalk-report</command>.
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>--list-fields</term>
+ <listitem>
+ <para>Instead of running the report, shows fields that the
+ report has, one field name per line.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>--list-fields-info</term>
+ <listitem>
+ <para>Instead of running the report, shows fields that the
+ report has, one field name per line, and a description of
+ that field.</para>
+ </listitem>
+ </varlistentry>
+</variablelist>
+</RefSect1>
+
+<RefSect1><Title>Authors</Title>
+<simplelist>
+ <member>Jan Pazdziora</member>
+</simplelist>
+</RefSect1>
+</RefEntry>
+
+<!--
+vim: sw=4
+-->
diff --git a/reporting/spacewalk-reports.spec b/reporting/spacewalk-reports.spec
new file mode 100644
index 0000000..f3845c9
--- /dev/null
+++ b/reporting/spacewalk-reports.spec
@@ -0,0 +1,45 @@
+Name: spacewalk-reports
+Summary: Script based reporting
+Group: Applications/Internet
+License: GPLv2
+Version: 0.7.0
+Release: 1%{?dist}
+URL: https://fedorahosted.org/spacewalk
+Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+Requires: python
+BuildRequires: /usr/bin/docbook2man
+
+%description
+Script based reporting to retrieve data from Spacewalk server in CSV format.
+
+%prep
+%setup -q
+
+%build
+/usr/bin/docbook2man *.sgml
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/%{_bindir}
+install -d $RPM_BUILD_ROOT/%{_prefix}/share/spacewalk
+install -d $RPM_BUILD_ROOT/%{_prefix}/share/spacewalk/reports/data
+install -d $RPM_BUILD_ROOT/%{_mandir}/man8
+install spacewalk-report $RPM_BUILD_ROOT/%{_bindir}
+install reports.py $RPM_BUILD_ROOT/%{_prefix}/share/spacewalk
+install reports/data/* $RPM_BUILD_ROOT/%{_prefix}/share/spacewalk/reports/data
+install *.8 $RPM_BUILD_ROOT/%{_mandir}/man8
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%attr(755,root,root) %{_bindir}/spacewalk-report
+%{_prefix}/share/spacewalk/reports.py*
+%{_prefix}/share/spacewalk/reports/data/*
+%{_mandir}/man8/spacewalk-report.8*
+
+%changelog
+* Mon Dec 14 2009 Jan Pazdziora 0.7.0-1
+- moved reports from spacewalk-backend-0.8.10-1 separate package
14 years, 4 months
backend/satellite_tools
by Jan Pazdziora
backend/satellite_tools/reports/data/users-systems | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 44f08d55bafa18321572315d2fb9293164f62b97
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 11:56:33 2009 +0100
reporting: remove extra whitespace.
diff --git a/backend/satellite_tools/reports/data/users-systems b/backend/satellite_tools/reports/data/users-systems
index 7b45f90..94234cd 100755
--- a/backend/satellite_tools/reports/data/users-systems
+++ b/backend/satellite_tools/reports/data/users-systems
@@ -21,7 +21,7 @@ multival_columns:
organization_id
user_id
server_id
- group : group
+ group : group
# adapted query available_to_uid
sql:
14 years, 4 months
client/rhel
by Milan Zazrivec
client/rhel/rhn-client-tools/man/en/up2date.5 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 8af6c2d6d9e59b9fc18afdb0b2da664f95d5e418
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Mon Dec 14 11:26:17 2009 +0100
510014 - man page typo fix
diff --git a/client/rhel/rhn-client-tools/man/en/up2date.5 b/client/rhel/rhn-client-tools/man/en/up2date.5
index d071658..f563f6b 100644
--- a/client/rhel/rhn-client-tools/man/en/up2date.5
+++ b/client/rhel/rhn-client-tools/man/en/up2date.5
@@ -66,7 +66,7 @@ Disable the reboot action. Can be either 0 (False) or 1 (True).
.br
.IP \fBdisallowConfChanges\fR
Config options that can not be overwritten by a config update action. Expects a
-semi-colon seperated list of config option names.
+semi-colon separated list of config option names.
.IP \fBhostedWhitelist\fR
Override the default list of URLs the RHN Register client treats as official RHN hosted servers. This only affects the RHN Register graphical- and text-based clients, as it changes some of the options that appear. This option is included for testing purposes only.
.br
14 years, 4 months
Changes to 'refs/tags/spacewalk-backend-0.8.10-1'
by Jan Pazdziora
Tag 'spacewalk-backend-0.8.10-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2009-12-14 10:20 +0000
Tagging package [spacewalk-backend] version [0.8.10-1] in directory [backend/].
Changes since spacewalk-backend-0.8.9-1:
Jan Pazdziora (2):
reporting: add column total to show total entitlements in the entitlements report.
Automatic commit of package [spacewalk-backend] release [0.8.10-1].
---
backend/satellite_tools/reports/data/entitlements | 11 ++++++++---
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 13 insertions(+), 5 deletions(-)
---
14 years, 4 months
2 commits - backend/satellite_tools backend/spacewalk-backend.spec rel-eng/packages
by Jan Pazdziora
backend/satellite_tools/reports/data/entitlements | 11 ++++++++---
backend/spacewalk-backend.spec | 5 ++++-
rel-eng/packages/spacewalk-backend | 2 +-
3 files changed, 13 insertions(+), 5 deletions(-)
New commits:
commit 5d294802f716338224dd911d9fb8864b6aaf6d75
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 11:20:08 2009 +0100
Automatic commit of package [spacewalk-backend] release [0.8.10-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 5522a81..d788672 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 0.8.9
+Version: 0.8.10
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -597,6 +597,9 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Mon Dec 14 2009 Jan Pazdziora 0.8.10-1
+- reporting: add column total to the entitlements report
+
* Mon Dec 14 2009 Michael Mraka <michael.mraka(a)redhat.com> 0.8.9-1
- fixed satellite-sync errata import
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 7ce7113..2b81d8f 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-0.8.9-1 backend/
+0.8.10-1 backend/
commit 56d0f35155b12973121d1dadd257f10ee6f68682
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Dec 14 11:19:31 2009 +0100
reporting: add column total to show total entitlements in the entitlements report.
diff --git a/backend/satellite_tools/reports/data/entitlements b/backend/satellite_tools/reports/data/entitlements
index c9eb2f8..515d06f 100755
--- a/backend/satellite_tools/reports/data/entitlements
+++ b/backend/satellite_tools/reports/data/entitlements
@@ -16,6 +16,7 @@ columns:
entitlement_type 'system' or 'channel'
entitlement System entitlement name or channel name
used How many entitlements are currently used
+ total The total number of entitlements
multival_columns:
@@ -29,21 +30,25 @@ sql:
web_customer.name as organization,
entitlement_type,
entitlement,
- used
+ used,
+ total
from (
select rhnprivatechannelfamily.org_id as organization_id,
'channel' as entitlement_type,
rhnchannelfamily.name as entitlement,
- rhnprivatechannelfamily.current_members as used
+ rhnprivatechannelfamily.current_members as used,
+ rhnprivatechannelfamily.max_members as total
from rhnchannelfamily, rhnprivatechannelfamily
where rhnchannelfamily.id = rhnprivatechannelfamily.channel_family_id
union all
select rhnservergroup.org_id as organization_id,
'system' as entitlement_type,
rhnservergrouptype.name as entitlement,
- rhnservergroup.current_members as used
+ rhnservergroup.current_members as used,
+ rhnservergroup.max_members as total
from rhnservergroup, rhnservergrouptype
where rhnservergroup.group_type = rhnservergrouptype.id
+ and rhnservergroup.max_members > 0
) entitlements, web_customer
where entitlements.organization_id = web_customer.id
order by entitlements.organization_id,
14 years, 4 months