4 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB.pm | 11 -
web/modules/rhn/RHN/DB/UserGroup.pm | 253 ---------------------------
web/modules/rhn/RHN/UserGroup.pm | 47 -----
web/modules/sniglets/Sniglets/ServerGroup.pm | 1
web/modules/sniglets/Sniglets/Users.pm | 1
5 files changed, 313 deletions(-)
New commits:
commit 9dd29241e6935b82b492eddb3d6bca279406710c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:40:20 2010 +0100
RHN::UserGroup was use'd but not used, removing, which makes RHN::DB::UserGroup obsolete as well, removing.
diff --git a/web/modules/rhn/RHN/DB/UserGroup.pm b/web/modules/rhn/RHN/DB/UserGroup.pm
deleted file mode 100644
index 7dfeb2a..0000000
--- a/web/modules/rhn/RHN/DB/UserGroup.pm
+++ /dev/null
@@ -1,253 +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.
-#
-
-# See POD at bottom for additional comments
-use strict;
-use DBI;
-
-package RHN::DB::UserGroup;
-
-use Params::Validate qw/:all/;
-Params::Validate::validation_options(strip_leading => "-");
-
-use RHN::DB;
-use Carp;
-use RHN::DB::TableClass;
-use Data::Dumper;
-
-my @ug_fields = qw { id name description max_members group_type org_id };
-my $ug_table = new RHN::DB::TableClass("rhnUserGroup", "UG", "", @ug_fields);
-
-sub list_group_types {
- my $class = shift;
-
- my $dbh = RHN::DB->connect;
- my $sth = $dbh->prepare("SELECT id, name, label FROM rhnUserGroupType ORDER BY UPPER(label)");
- $sth->execute;
-
- my @ret;
- while (my @row = $sth->fetchrow) {
- push @ret, [ @row ];
- }
-
- return @ret;
-}
-
-#
-# Create a usergroup object to propagate back to the caller
-#
-sub blank_usergrp {
- my $class = shift;
- my $self = bless { }, $class;
- return $self;
-}
-
-#
-# Retrieve a group given a group id
-#
-sub lookup {
- my $class = shift;
- my %params = validate(@_, {id => 1});
- my $id = $params{id};
-
- my $dbh;
- my $sqlstmt;
- my $sth;
- my $usergrp;
- my @columns;
-
- $dbh = RHN::DB->connect;
- $sqlstmt = $ug_table->select_query("UG.ID = ?");
- $sth = $dbh->prepare($sqlstmt);
- $sth->execute($id);
- @columns = $sth->fetchrow;
- $sth->finish;
-
- if ($columns[0]) {
- $usergrp = $class->blank_usergrp;
- $usergrp->{id} = $columns[0];
- foreach ($ug_table->method_names) {
- $usergrp->$_(shift @columns)
- }
- delete $usergrp->{":modified:"};
- }
- else {
- local $" = ", ";
- die "Error loading usergroup $id (@columns)";
- }
-
- return $usergrp;
-}
-
-sub create {
- my $class = shift;
-
- my $ug = $class->blank_usergrp;
- $ug->{id} = -1;
-
- return $ug;
-}
-
-#
-# Delete a group given a group id
-#
-sub remove {
- my $class = shift;
- my $id = shift;
- my $dbh;
- my $sqlstmt;
- my $sth;
-
- $dbh = RHN::DB->connect;
-
- $sqlstmt = "DELETE FROM " . $ug_table->table_name . " WHERE id=?";
- $sth = $dbh->prepare($sqlstmt);
- $sth->execute($id);
-
- $dbh->commit;
- $sth->finish;
-}
-
-#
-# build some accessors
-#
-foreach my $field ($ug_table->method_names) {
- my $sub = q {
- sub [[field]] {
- my $self = shift;
- if (@_ and "[[field]]" ne "id") {
- $self->{":modified:"}->{[[field]]} = 1;
- $self->{[[field]]} = shift;
- }
- return $self->{[[field]]};
- }
- };
-
- $sub =~ s/\[\[field\]\]/$field/g;
- eval $sub;
-
- if ($@) {
- warn $@;
- }
-}
-
-#
-# Commit fields iff they have been updated
-#
-sub commit {
- my $self = shift;
- my $mode = 'update';
-
- if ($self->id == -1) {
- my $dbh = RHN::DB->connect;
-
- my $sth = $dbh->prepare("SELECT rhn_user_group_id_seq.nextval FROM DUAL");
- $sth->execute;
- my ($id) = $sth->fetchrow;
- #warn "id: $id";
- die "No new ugroup id from seq rhn_user_group_id_seq (possible error: " . $sth->errstr . ")" unless $id;
- $sth->finish;
-
- $self->{":modified:"}->{id} = 1;
- $self->{id} = $id;
- $mode = 'insert';
- }
-
- die "$self->commit called on usergroup without valid id" unless $self->id;
-
- my @modified = keys %{$self->{":modified:"}};
- my %modified = map { $_ => 1 } @modified;
-
- return unless @modified;
-
- my $dbh = RHN::DB->connect;
-
- my $query;
- if ($mode eq 'update') {
- $query = $ug_table->update_query($ug_table->methods_to_columns(@modified));
- $query .= "UG.ID = ?";
- }
- else {
- $query = $ug_table->insert_query($ug_table->methods_to_columns(@modified));
- }
-
- #warn "ins/upd query: $query";
-
- my $sth = $dbh->prepare($query);
- $sth->execute((map { $self->$_() } grep { $modified{$_} } $ug_table->method_names), ($mode eq 'update') ? ($self->id) : ());
-
- $dbh->commit;
-
- delete $self->{":modified:"};
-}
-
-sub member_count {
- my $self_or_pkg = shift;
- my $id;
-
- if (ref $self_or_pkg) {
- $id = $self_or_pkg->id;
- }
- else {
- $id = shift;
- }
-
- my $dbh = RHN::DB->connect;
-
- my $sqlstmt = sprintf <<EOT;
-SELECT COUNT(user_id)
- FROM rhnUserGroupMembers UGM
- WHERE UGM.user_group_id = ?
-EOT
-
- my $sth = $dbh->prepare($sqlstmt);
- $sth->execute($id);
-
- my ($count) = $sth->fetchrow;
- $sth->finish;
-
- return $count;
-}
-
-#
-# Return all users in the given group id
-#
-sub users_in_group {
- my $class = shift;
- my $id = shift;
-
- die "Attempt to lookup users in group without a group id" if(!$id);
- my $dbh = RHN::DB->connect;
-
- my $sqlstmt = sprintf <<EOT;
-SELECT U.id, U.login
-FROM rhnUser U, rhnUserGroupMembers M
-WHERE U.id = M.user_id AND M.user_group_id = ?
-ORDER BY U.login_uc
-EOT
-
- my $sth = $dbh->prepare($sqlstmt);
- $sth->execute($id);
-
- my @users;
-
- while (my ($id, $login) = $sth->fetchrow) {
- push @users, [ $id, $login ];
- }
-
- return @users;
-}
-
-1;
diff --git a/web/modules/rhn/RHN/UserGroup.pm b/web/modules/rhn/RHN/UserGroup.pm
deleted file mode 100644
index 4bde83f..0000000
--- a/web/modules/rhn/RHN/UserGroup.pm
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# Copyright (c) 2008 Red Hat, Inc.
-#
-# This software is licensed to you under the GNU General Public License,
-# version 2 (GPLv2). There is NO WARRANTY for this software, express or
-# implied, including the implied warranties of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
-# along with this software; if not, see
-# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
-#
-# Red Hat trademarks are not licensed under GPLv2. No permission is
-# granted to use or replicate Red Hat trademarks that are incorporated
-# in this software or its documentation.
-#
-
-package RHN::UserGroup;
-
-use strict;
-use RHN::DB::UserGroup;
-
-our @ISA = qw/RHN::DB::UserGroup/;
-
-sub lookup {
- my $class = shift;
- my $first_arg = $_[0];
-
- die "No argument to $class->lookup"
- unless $first_arg;
-
- if (substr($first_arg,0,1) eq '-') {
- return $class->SUPER::lookup(@_);
- }
- else {
- warn "deprecated use of unparameterized $class->lookup from (" . join(', ', caller) . ")\n";
- return $class->SUPER::lookup(-id => $first_arg);
- }
-}
-
-1;
diff --git a/web/modules/sniglets/Sniglets/ServerGroup.pm b/web/modules/sniglets/Sniglets/ServerGroup.pm
index 52abe26..bf1b234 100644
--- a/web/modules/sniglets/Sniglets/ServerGroup.pm
+++ b/web/modules/sniglets/Sniglets/ServerGroup.pm
@@ -19,7 +19,6 @@ package Sniglets::ServerGroup;
use RHN::Server;
use RHN::ServerGroup;
-use RHN::UserGroup;
use RHN::Org;
use RHN::ServerActions;
use RHN::User;
diff --git a/web/modules/sniglets/Sniglets/Users.pm b/web/modules/sniglets/Sniglets/Users.pm
index f79d5eb..40f4c87 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -20,7 +20,6 @@ package Sniglets::Users;
use PXT::Utils;
use RHN::User;
-use RHN::UserGroup;
use RHN::Org;
use RHN::Grail;
use PXT::HTML;
commit 6049892a2f1ddd5255896bd0859a7667bb0f9867
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:31:05 2010 +0100
lookup_user_group is not called from anywhere, removing.
diff --git a/web/modules/rhn/RHN/UserGroup.pm b/web/modules/rhn/RHN/UserGroup.pm
index 53a6cad..4bde83f 100644
--- a/web/modules/rhn/RHN/UserGroup.pm
+++ b/web/modules/rhn/RHN/UserGroup.pm
@@ -36,12 +36,4 @@ sub lookup {
}
}
-sub lookup_user_group {
- my $class = shift;
-
- warn "deprecated use of $class->lookup_foo from (" . join(', ', caller) . "). Using $class->lookup instead\n";
-
- return $class->lookup(@_);
-}
-
1;
commit abc75b01f8ae42716f205395d6c274c7d814244e
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:26:51 2010 +0100
reset_profiling is not called from anywhere, removing as dead code.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm
index 1fa978e..cdddc90 100644
--- a/web/modules/rhn/RHN/DB.pm
+++ b/web/modules/rhn/RHN/DB.pm
@@ -352,12 +352,6 @@ sub profile_format {
return @ret;
}
-sub reset_profiling {
- my $self = shift;
-
- $self->{Profile}->{Data} = undef;
-}
-
sub init_db_handle {
my $self = shift;
commit d7176a9bbc37fff3d21ca2f2df476e1ddb397b81
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:21:12 2010 +0100
Removal of pxtdb.conf and load_dsn_aliases made clear_aliases unused, removing.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm
index e30327e..1fa978e 100644
--- a/web/modules/rhn/RHN/DB.pm
+++ b/web/modules/rhn/RHN/DB.pm
@@ -37,11 +37,6 @@ sub add_alias {
$aliases{$dbi_connection_string} = [ @_ ];
}
-sub clear_aliases {
- my $class = shift;
- %aliases = ();
-}
-
sub lookup_alias {
my $class = shift;
my $alias = shift;
14 years, 2 months
2 commits - web/modules
by Jan Pazdziora
web/modules/rhn/RHN/DB/DataSource/xml/KSTree_queries.xml | 11 -----------
web/modules/rhn/RHN/DB/KSTree.pm | 7 -------
2 files changed, 18 deletions(-)
New commits:
commit 41dcf48d9637ce9be127ce45a94fbe637234c6cf
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:06:24 2010 +0100
Removal of install_types makes KSTree_queries unused, removing.
diff --git a/web/modules/rhn/RHN/DB/DataSource/xml/KSTree_queries.xml b/web/modules/rhn/RHN/DB/DataSource/xml/KSTree_queries.xml
deleted file mode 100644
index 27bb4c3..0000000
--- a/web/modules/rhn/RHN/DB/DataSource/xml/KSTree_queries.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<datasource_modes>
-
-<mode name="install_types">
- <query params="">
- SELECT KSIT.id, KSIT.label, KSIT.name
- FROM rhnKSInstallType KSIT
-ORDER BY KSIT.label
- </query>
-</mode>
-
-</datasource_modes>
\ No newline at end of file
commit ffbf142a5775deca96b485e235d519c9c2434f40
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 11:05:39 2010 +0100
install_types is not called, removing.
diff --git a/web/modules/rhn/RHN/DB/KSTree.pm b/web/modules/rhn/RHN/DB/KSTree.pm
index 0c75646..380092d 100644
--- a/web/modules/rhn/RHN/DB/KSTree.pm
+++ b/web/modules/rhn/RHN/DB/KSTree.pm
@@ -251,13 +251,6 @@ sub name {
return sprintf('%s (%s)', $channel->name, $self->label);
}
-sub install_types {
- my $class = shift;
-
- my $ds = new RHN::DataSource::Simple(-querybase => 'KSTree_queries', -mode => 'install_types');
- return $ds->execute_query();
-}
-
sub compatible_tree {
my $self = shift;
my $kstid = shift;
14 years, 2 months
web/html web/modules
by Jan Pazdziora
web/html/formletters/forgot_accounts.xml | 4 ++--
web/html/formletters/forgot_password.xml | 2 +-
web/modules/rhn/RHN/Postal.pm | 7 ++++++-
3 files changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 57eabc2f3d86e3345205c442bc002be5bc628908
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:49:35 2010 +0100
Do not confuse people by calling Spacewalk logins Red Hat logins.
diff --git a/web/html/formletters/forgot_accounts.xml b/web/html/formletters/forgot_accounts.xml
index 90d8bbf..175a5da 100644
--- a/web/html/formletters/forgot_accounts.xml
+++ b/web/html/formletters/forgot_accounts.xml
@@ -1,10 +1,10 @@
-<postal-letter subject="Red Hat Login Information">
+<postal-letter subject="&product_name; Login Information">
[ This is an automated email sent to <email-address /> at your request. ]
You have requested a list of all <product-name /> logins associated
with the email address <email-address />.
-Red Hat Login(s):
+Existing login(s):
<account-list />
You may reset the passwords for any of the above Red Hat logins at:
diff --git a/web/html/formletters/forgot_password.xml b/web/html/formletters/forgot_password.xml
index 42de045..51a22b4 100644
--- a/web/html/formletters/forgot_password.xml
+++ b/web/html/formletters/forgot_password.xml
@@ -1,4 +1,4 @@
-<postal-letter subject="Red Hat Network Password">
+<postal-letter subject="&product_name; Password Reset">
[ This is an automated email sent to <email-address /> at your request. ]
Your <product-name /> password has been reset. To sign in, go to:
diff --git a/web/modules/rhn/RHN/Postal.pm b/web/modules/rhn/RHN/Postal.pm
index 7932e2a..5510bba 100644
--- a/web/modules/rhn/RHN/Postal.pm
+++ b/web/modules/rhn/RHN/Postal.pm
@@ -164,7 +164,12 @@ sub render {
$p->register_tag("postal-letter" =>
sub {
my %params = @_;
- $self->subject($params{subject}) if exists $params{subject};
+ if (exists $params{subject}) {
+ my $subject = $params{subject};
+ my $product_name = PXT::Config->get('product_name');
+ $subject =~ s!&product_name;!$product_name!g;
+ $self->subject($subject);
+ }
return $params{__block__};
}
);
14 years, 2 months
web/html
by Jan Pazdziora
web/html/formletters/forgot_accounts.xml | 2 +-
web/html/formletters/forgot_password.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 685c9c354c8d867c8f0f49f14308eeb30542386d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:31:57 2010 +0100
Do not point to rhn.redhat.com in emails sent by Spacewalk.
diff --git a/web/html/formletters/forgot_accounts.xml b/web/html/formletters/forgot_accounts.xml
index fe8144a..90d8bbf 100644
--- a/web/html/formletters/forgot_accounts.xml
+++ b/web/html/formletters/forgot_accounts.xml
@@ -9,7 +9,7 @@ Red Hat Login(s):
You may reset the passwords for any of the above Red Hat logins at:
- https://<postal-template-replace label="hostname" default="rhn.redhat.com" />/help/forgot_password.pxt
+ https://<postal-template-replace label="hostname" default=" unknown hostname " />/help/forgot_password.pxt
If you continue to have difficulties logging in, please contact
your <product-name /> administrator for further assistance.
diff --git a/web/html/formletters/forgot_password.xml b/web/html/formletters/forgot_password.xml
index 81ad952..42de045 100644
--- a/web/html/formletters/forgot_password.xml
+++ b/web/html/formletters/forgot_password.xml
@@ -3,7 +3,7 @@
Your <product-name /> password has been reset. To sign in, go to:
-https://<postal-template-replace label="hostname" default="rhn.redhat.com" />/
+https://<postal-template-replace label="hostname" default=" unknown hostname " />/
And use the following username and password:
14 years, 2 months
Changes to 'refs/tags/spacewalk-utils-0.8.1-1'
by Michael Mraka
Tag 'spacewalk-utils-0.8.1-1' created by Michael Mraka <michael.mraka(a)redhat.com> at 2010-01-05 09:26 +0000
Tagging package [spacewalk-utils] version [0.8.1-1] in directory [utils/].
Changes since spacewalk-reports-0.7.1-1:
Jan Pazdziora (7):
spacewalk-reports: bump up version.
Drop rhn-browser-css-compliance and browser_css_compliance and always assume some CSS compliance.
equals_sign.pxt does not seem to be used, removing.
Daily summaries are sent from Java stack now, removing.
Information about new user is now sent from the Java stack, removing.
Fixing the forgot_* emails. We are always satellite (non-hosted), but the product name becomes important instead.
You should never disregard situation when someone else might have changed your password.
Michael Mraka (2):
added scr.cgi sample script
Automatic commit of package [spacewalk-utils] release [0.8.1-1].
Milan Zazrivec (2):
546676 - blocking and nostate are always just running
552271 - -host needs to require specific version of -common package
---
branding/templates/c.pxt | 10
branding/templates/equals_sign.pxt | 38 -
client/tools/rhn-virtualization/rhn-virtualization.spec | 2
client/tools/rhn-virtualization/virtualization/constants.py | 11
rel-eng/packages/spacewalk-utils | 2
reporting/spacewalk-reports.spec | 2
utils/Makefile | 2
utils/scr.cgi | 304 ++++++++++++
utils/spacewalk-utils.spec | 5
web/html/errata_hidden/rh_template.pxt | 9
web/html/formletters/daily_summary.xml | 21
web/html/formletters/forgot_accounts.xml | 8
web/html/formletters/forgot_password.xml | 7
web/html/formletters/new_user.xml | 15
web/modules/pxt/PXT/Request.pm | 15
web/modules/sniglets/Sniglets/HTML.pm | 18
web/modules/sniglets/Sniglets/Navi/Style.pm | 10
web/modules/sniglets/Sniglets/Users.pm | 4
18 files changed, 330 insertions(+), 153 deletions(-)
---
14 years, 2 months
2 commits - rel-eng/packages utils/Makefile utils/scr.cgi utils/spacewalk-utils.spec
by Michael Mraka
rel-eng/packages/spacewalk-utils | 2
utils/Makefile | 2
utils/scr.cgi | 304 +++++++++++++++++++++++++++++++++++++++
utils/spacewalk-utils.spec | 5
4 files changed, 310 insertions(+), 3 deletions(-)
New commits:
commit 593762cc74d89c52f4321f1bf897c2d0d3f8eadf
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Tue Jan 5 10:26:27 2010 +0100
Automatic commit of package [spacewalk-utils] release [0.8.1-1].
diff --git a/rel-eng/packages/spacewalk-utils b/rel-eng/packages/spacewalk-utils
index e83e4ac..04743fa 100644
--- a/rel-eng/packages/spacewalk-utils
+++ b/rel-eng/packages/spacewalk-utils
@@ -1 +1 @@
-0.7.1-1 utils/
+0.8.1-1 utils/
diff --git a/utils/spacewalk-utils.spec b/utils/spacewalk-utils.spec
index 424992e..cc368cc 100644
--- a/utils/spacewalk-utils.spec
+++ b/utils/spacewalk-utils.spec
@@ -1,7 +1,7 @@
%define rhnroot %{_prefix}/share/rhn
Name: spacewalk-utils
-Version: 0.8.0
+Version: 0.8.1
Release: 1%{?dist}
Summary: Utilities that may be run against a Spacewalk server.
@@ -57,6 +57,9 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Tue Jan 05 2010 Michael Mraka <michael.mraka(a)redhat.com> 0.8.1-1
+- added scr.cgi and apply_errata scripts
+
* Wed Nov 25 2009 Miroslav Suchý <msuchy(a)redhat.com> 0.7.1-1
- migration of system profile should be able to run as non root now that it can run on any client and not just satellite. (pkilambi(a)redhat.com)
- bumping Version to 0.7.0 (jmatthew(a)redhat.com)
commit 2eb031166a3ec145ff598c6f973014aa9a75b4a1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Jan 4 14:48:09 2010 +0100
added scr.cgi sample script
see https://www.redhat.com/archives/spacewalk-devel/2009-December/msg00010.html
diff --git a/utils/Makefile b/utils/Makefile
index 00d54e7..cc8b252 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -7,7 +7,7 @@ NAME := spacewalk-utils
SUBDIR = utils
FILES = __init__ systemSnapshot migrateSystemProfile rhnLockfile rhn_fcntl
-SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api apply_errata
+SCRIPTS = sw-system-snapshot migrate-system-profile spacewalk-api apply_errata scr.cgi
DOCBOOK = $(wildcard /usr/bin/docbook2man)
diff --git a/utils/scr.cgi b/utils/scr.cgi
new file mode 100644
index 0000000..f4ad493
--- /dev/null
+++ b/utils/scr.cgi
@@ -0,0 +1,304 @@
+#!/usr/bin/perl
+
+###########################################################################
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# Copyright 2009 Colin Coe <colin.coe(a)gmail.com>
+#
+# Portions of code reused from the Satellite/Spacewalk documentation,
+# various sources on the Internet and from code produced by Murray Barton.
+#
+# for more description see
+# https://www.redhat.com/archives/spacewalk-devel/2009-December/msg00010.html
+#
+###########################################################################
+
+use strict;
+use warnings;
+use CGI;
+use Data::Dumper;
+use Frontier::Client;
+use POSIX 'strftime';
+use Switch;
+
+$|=1;
+
+my $cgi = new CGI;
+my ($sat_host, $sat_user, $sat_passwd) = ('127.0.0.1', 'admin', 'password');
+
+# i.e. 7 critical errata will cause the critical errata column to be yellow
+my %Thresholds = (
+ 'red_crit' => 10,
+ 'yel_crit' => 5,
+ 'red_imp' => 15,
+ 'yel_imp' => 7,
+ 'red_mod' => 20,
+ 'yel_mod' => 10,
+ 'red_low' => 25,
+ 'yel_low' => 12,
+ 'red_bug' => 20,
+ 'yel_bug' => 10,
+);
+
+# These are the multiplier values
+my %Formula = (
+ 'crit' => 20,
+ 'imp' => 15,
+ 'mod' => 10,
+ 'low' => 5,
+ 'bug' => 3,
+ 'enh' => 1,
+);
+
+my %Errata;
+
+# These are the counters for the errata types
+my (%cc, %ic, %mc, %lc, %bc, %ec);
+
+# Start html...
+my $onclick = <<'end_java_script';
+function are_you_sure (message) {
+ return confirm( message );
+}
+
+end_java_script
+
+print $cgi->header();
+print $cgi->start_html(
+ -title => 'System Currency Report',
+ -fgcolor => "#000000",
+ -bgcolor => "#FFFFFF",
+ -script => $onclick,
+);
+
+my ($count, $data) = (0, "");
+my $return = processForm();
+if ($return) {
+ printForm();
+ print $data;
+ print "<p>$count hosts examined</p>\n";
+}
+print $cgi->end_html(), "\n";
+
+exit;
+
+sub printForm {
+
+ $cgi->delete('_host_name'); # clear the old stuff
+ my %colours = ( 0 => "#FFFFF2", 1 => "#EEFFFA", );
+
+ print $cgi->start_form();
+ print $cgi->b("<font color=\"blue\" size=\"+2\">System Currency Report</font>"),
+ $cgi->table( { border => 0 },
+ $cgi->Tr(
+ $cgi->td("Host regexp: "),
+ $cgi->td(
+ $cgi->textfield(
+ -name => '_host_name',
+ -size => 16,
+ -maxlength => 16,
+ ),
+ ),
+ $cgi->td("(empty for all hosts)"),
+ $cgi->td($cgi->submit( -name => '_do_search', -value => 'Search' ),
+ ),
+
+ ),
+ ),
+ $cgi->end_table();
+ print <<__END_OF_HTML;
+<hr>
+<h2>Notes</h2>
+<h3>Formula</h3>
+<table border=1>
+ <tr>
+ <th>Security (Critical)</th>
+ <td>Count * $Formula{'crit'}</td>
+ </tr>
+ <tr>
+ <th>Security (Important)</th>
+ <td>Count * $Formula{'imp'}</td>
+ </tr>
+ <tr>
+ <th>Security (Moderate)</th>
+ <td>Count * $Formula{'mod'}</td>
+ </tr>
+ <tr>
+ <th>Security (Low)</th>
+ <td>Count * $Formula{'low'}</td>
+ </tr>
+ <tr>
+ <th>Bug</th>
+ <td>Count * $Formula{'bug'}</td>
+ </tr>
+ <tr>
+ <th>Enhancement
+ <td>Count * $Formula{'enh'}</td>
+ </tr>
+</table>
+<h3>Thresholds</h3>
+<table border=1>
+ <tr>
+ <th></th>
+ <th bgcolor=\"red\">Red</th>
+ <th bgcolor=\"yellow\">Yellow</th>
+ </tr>
+ <tr>
+ <th>Security (Critical)</th>
+ <td>greater than $Thresholds{'red_crit'}</td>
+ <td>greater than $Thresholds{'yel_crit'}</td>
+ </tr>
+ <tr>
+ <th>Security (Important)</th>
+ <td>greater than $Thresholds{'red_imp'}</td>
+ <td>greater than $Thresholds{'yel_imp'}</td>
+ </tr>
+ <tr>
+ <th>Security (Moderate)</th>
+ <td>greater than $Thresholds{'red_mod'}</td>
+ <td>greater than $Thresholds{'yel_mod'}</td>
+ </tr>
+ <tr>
+ <th>Security (Low)</th>
+ <td>greater than $Thresholds{'red_low'}</td>
+ <td>greater than $Thresholds{'yel_low'}</td>
+ </tr>
+ <tr>
+ <th>Bug</th>
+ <td>greater than $Thresholds{'red_bug'}</td>
+ <td>greater than $Thresholds{'yel_bug'}</td>
+ </tr>
+</table>
+<ul>
+</ul>
+__END_OF_HTML
+
+
+ # Finish the html form.
+ print $cgi->end_form();
+
+ return 0;
+}
+
+sub processForm {
+ readData($cgi->param('_host_name')) if ($cgi->param('_do_search') eq 'Search');
+
+ return 1;
+}
+
+# Get the data from the Satellite/Spacewalk server and return it in a CSV list
+sub getData($) {
+ my $search = shift;
+ my $client = new Frontier::Client(url => "http://$sat_host/rpc/api", debug => 0);
+ my $session = $client->call('auth.login', $sat_user, $sat_passwd);
+
+ my (%Systems, @out, $line);
+
+ my $systems = $client->call('system.listUserSystems', $session);
+ for my $sys (sort { $a->{'name'} cmp $b->{'name'} } @$systems) {
+ next unless $sys->{'name'} =~ m/$search/;
+ my $errata = $client->call('system.getRelevantErrata', $session, $sys->{'id'});
+ my $details = $client->call('system.getSubscribedBaseChannel', $session, $sys->{'id'});
+ $line = "$sys->{'id'}|$sys->{'name'}|$details->{'name'}|";
+ if (scalar @$errata) {
+ for my $err (@$errata) {
+ $line .= ",$err->{'advisory_name'}|$err->{'advisory_synopsis'}|"
+ }
+ }
+ push @out, $line;
+ }
+
+ # Lets play nicely and logout when we're finished
+ $client->call('auth.logout', $session);
+ return @out;
+}
+
+# Process the data returned from getData and produce/return HTML code
+sub readData() {
+ my $search = shift;
+ my @in = getData($search);
+ $data = "
+<hr>
+<p>
+<table border=1>
+<tr>
+<th>Hosts</th>
+<th>Base Channel</th>
+<th>Security<br>(Critical)</th>
+<th>Security<br>(Important)</th>
+<th>Security<br>(Moderate)</th>
+<th>Security<br>(Low)</th>
+<th>Bug Fix</th>
+<th>Enhancement</th>
+<th>Overall<br>Score</th>";
+
+ for my $line (@in) {
+ $count++;
+ my $colour = 'white';
+ my ($host, $errata) = (split(',', $line, 2));
+ my $hostname = (split(/\|/, $host))[1];
+ my @details = (split(/\|/, $host));
+ my %colour = ('crit' => 'white', 'imp' => 'white', 'mod' => 'white', 'low' => 'white', 'bug' => 'white' );
+ $cc{$hostname} = 0;
+ $ic{$hostname} = 0;
+ $mc{$hostname} = 0;
+ $lc{$hostname} = 0;
+ $bc{$hostname} = 0;
+ $ec{$hostname} = 0;
+ for my $err ($errata) {
+ for my $e (split(/,/, $err)) {
+ $Errata{(split(/\|/, $e))[0]} = (split(/\|/, $e))[1];
+ switch (substr($e,0,4)) {
+ case('RHSA') {
+ switch (substr((split(/\|/, $e))[1],0,3)) {
+ case('Cri') { $cc{$hostname}++; }
+ case('Imp') { $ic{$hostname}++; }
+ case('Mod') { $mc{$hostname}++; }
+ case('Low') { $lc{$hostname}++; }
+ }
+ }
+ case('RHBA') { $bc{$hostname}++; }
+ case('RHEA') { $ec{$hostname}++; }
+ }
+ }
+ }
+ $data .= "<tr>";
+ $data .= $cgi->td($hostname);
+ $data .= $cgi->td({-bgcolor=>$colour},(split(/\|/, $host))[2]);
+
+ $colour{'crit'} = 'yellow' if ($cc{$hostname} >= $Thresholds{'yel_crit'});
+ $colour{'crit'} = 'red' if ($cc{$hostname} >= $Thresholds{'red_crit'});
+ $data .= $cgi->td({-bgcolor=>$colour{'crit'}},$cc{$hostname});
+
+ $colour{'imp'} = 'yellow' if ($ic{$hostname} >= $Thresholds{'yel_imp'});
+ $colour{'imp'} = 'red' if ($ic{$hostname} >= $Thresholds{'red_imp'});
+ $data .= $cgi->td({-bgcolor=>$colour{'imp'}},$ic{$hostname});
+
+ $colour{'mod'} = 'yellow' if ($mc{$hostname} >= $Thresholds{'yel_mod'});
+ $colour{'mod'} = 'red' if ($mc{$hostname} >= $Thresholds{'red_mod'});
+ $data .= $cgi->td({-bgcolor=>$colour{'mod'}},$mc{$hostname});
+
+ $colour{'low'} = 'yellow' if ($lc{$hostname} >= $Thresholds{'yel_low'});
+ $colour{'low'} = 'red' if ($lc{$hostname} >= $Thresholds{'red_low'});
+ $data .= $cgi->td({-bgcolor=>$colour{'low'}},$lc{$hostname});
+
+ $colour{'bug'} = 'yellow' if ($bc{$hostname} >= $Thresholds{'yel_bug'});
+ $colour{'bug'} = 'red' if ($bc{$hostname} >= $Thresholds{'red_bug'});
+ $data .= $cgi->td({-bgcolor=>$colour{'bug'}},$bc{$hostname});
+
+ $data .= $cgi->td($ec{$hostname});
+ $data .= $cgi->td($cc{$hostname} * $Formula{'crit'} + $ic{$hostname} * $Formula{'imp'} + $mc{$hostname} * $Formula{'mod'} + $lc{$hostname} * $Formula{'low'} + $bc{$hostname} * $Formula{'bug'} + $ec{$hostname} * $Formula{'enh'});
+ $data .= "</tr>";
+ }
+ $data .= $cgi->end_table();
+}
+
+__END__
14 years, 2 months
2 commits - web/html web/modules
by Jan Pazdziora
web/html/formletters/forgot_accounts.xml | 8 ++++----
web/html/formletters/forgot_password.xml | 7 +++----
web/modules/sniglets/Sniglets/Users.pm | 4 ++--
3 files changed, 9 insertions(+), 10 deletions(-)
New commits:
commit ae60d52b8f203784cd0426e8e8e93e7f37d24f99
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:21:28 2010 +0100
You should never disregard situation when someone else might have changed your password.
diff --git a/web/html/formletters/forgot_password.xml b/web/html/formletters/forgot_password.xml
index 984923f..81ad952 100644
--- a/web/html/formletters/forgot_password.xml
+++ b/web/html/formletters/forgot_password.xml
@@ -14,7 +14,6 @@ Once you have logged in, you may then change your password.
If you continue to have difficulties logging in, please contact
your <product-name /> administrator for further assistance.
-If you did not request this email be sent, please disregard this message.
Thank you for using <product-name />.
<postal-template-replace label="email_footer"/>
commit 5de51fc8cfcc0acb76b3270c83e376b62e1a9ca8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:20:49 2010 +0100
Fixing the forgot_* emails. We are always satellite (non-hosted), but the product name becomes important instead.
diff --git a/web/html/formletters/forgot_accounts.xml b/web/html/formletters/forgot_accounts.xml
index 526d0f2..fe8144a 100644
--- a/web/html/formletters/forgot_accounts.xml
+++ b/web/html/formletters/forgot_accounts.xml
@@ -1,7 +1,7 @@
<postal-letter subject="Red Hat Login Information">
[ This is an automated email sent to <email-address /> at your request. ]
-You have requested a list of all Red Hat logins associated
+You have requested a list of all <product-name /> logins associated
with the email address <email-address />.
Red Hat Login(s):
@@ -12,9 +12,9 @@ You may reset the passwords for any of the above Red Hat logins at:
https://<postal-template-replace label="hostname" default="rhn.redhat.com" />/help/forgot_password.pxt
If you continue to have difficulties logging in, please contact
-<helpful-email-address /> for further assistance. If you did not
-request this email be sent, please disregard this message.
+your <product-name /> administrator for further assistance.
+If you did not request this email be sent, please disregard this message.
-Thank you for using Red Hat Network.
+Thank you for using <product-name />.
<postal-template-replace label="email_footer"/>
</postal-letter>
diff --git a/web/html/formletters/forgot_password.xml b/web/html/formletters/forgot_password.xml
index 116b9eb..984923f 100644
--- a/web/html/formletters/forgot_password.xml
+++ b/web/html/formletters/forgot_password.xml
@@ -1,7 +1,7 @@
<postal-letter subject="Red Hat Network Password">
[ This is an automated email sent to <email-address /> at your request. ]
-Your Red Hat Network password has been reset. To sign in, go to:
+Your <product-name /> password has been reset. To sign in, go to:
https://<postal-template-replace label="hostname" default="rhn.redhat.com" />/
@@ -13,9 +13,9 @@ Password: <password />
Once you have logged in, you may then change your password.
If you continue to have difficulties logging in, please contact
-<helpful-email-address /> for further assistance. If you did not
-request this email be sent, please disregard this message.
+your <product-name /> administrator for further assistance.
+If you did not request this email be sent, please disregard this message.
-Thank you for using Red Hat Network.
+Thank you for using <product-name />.
<postal-template-replace label="email_footer"/>
</postal-letter>
diff --git a/web/modules/sniglets/Sniglets/Users.pm b/web/modules/sniglets/Sniglets/Users.pm
index 9fbcd13..f79d5eb 100644
--- a/web/modules/sniglets/Sniglets/Users.pm
+++ b/web/modules/sniglets/Sniglets/Users.pm
@@ -251,7 +251,7 @@ sub forgot_password_cb {
my $letter = new RHN::Postal;
$letter->template("forgot_password.xml");
$letter->set_tag('email-address' => $email);
- $letter->set_tag('helpful-email-address' => PXT::Config->get('satellite') ? "your satellite administrator" : "dev-null\(a)redhat.com");
+ $letter->set_tag('product-name' => PXT::Config->get('product_name'));
$letter->set_tag('username' => $username);
$letter->set_tag('password' => $password);
$letter->render;
@@ -287,7 +287,7 @@ sub forgot_accounts_cb {
my $letter = new RHN::Postal;
$letter->template("forgot_accounts.xml");
$letter->set_tag('email-address' => $email);
- $letter->set_tag('helpful-email-address' => PXT::Config->get('satellite') ? "your satellite administrator" : "dev-null\(a)redhat.com");
+ $letter->set_tag('product-name' => PXT::Config->get('product_name'));
$letter->set_tag('account-list' => join("\n", map { " " . $_->login } @users));
$letter->set_header("X-RHN-Info" => "account_list");
$letter->render;
14 years, 2 months
2 commits - web/html
by Jan Pazdziora
web/html/formletters/daily_summary.xml | 21 ---------------------
web/html/formletters/new_user.xml | 15 ---------------
2 files changed, 36 deletions(-)
New commits:
commit f272d524162fdbf239a601156318b0465f022e91
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:09:06 2010 +0100
Information about new user is now sent from the Java stack, removing.
diff --git a/web/html/formletters/new_user.xml b/web/html/formletters/new_user.xml
deleted file mode 100644
index 63a02f9..0000000
--- a/web/html/formletters/new_user.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<postal-letter>
-Hello,
-
-A new user has been added to your account.
-
-<postal-template-replace label="email_account_info"/>
-
-To see all the users and Red Hat logins associated with your account,
-please visit:
-
- https://<hostname />/rhn/users/index.jsp
-
-Thank you for using Red Hat Network.
-<postal-template-replace label="email_footer"/>
-</postal-letter>
commit 7c5a9951538087640c7ded0e2383628533db99f8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Tue Jan 5 10:07:21 2010 +0100
Daily summaries are sent from Java stack now, removing.
diff --git a/web/html/formletters/daily_summary.xml b/web/html/formletters/daily_summary.xml
deleted file mode 100644
index 10ccb2a..0000000
--- a/web/html/formletters/daily_summary.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<postal-letter>This is the RHN Status Report for your account <login />, as of <calculation-date-time />.
-
-This email will be sent when any of the following apply to the specified systems:
-
-1. The system fails to check in with RHN within a 24-hour window.
-2. The system registers scheduled action activity.
-
-<action-counts-message />
-<awol-systems-message />
-Disabling this email:
-----------------------
-
-To learn how to disable this email for systems:
-
-https://<hostname />/help/reference/s1-sm-your-rhn.html#S2-SM-YOUR-RHN-PREFS
-
-
-Thank you for using Red Hat Network.
-<postal-template-replace label="email_footer"/>
-<postal-template-replace label="email_account_info"/>
-</postal-letter>
14 years, 2 months
branding/templates
by Jan Pazdziora
branding/templates/equals_sign.pxt | 29 -----------------------------
1 file changed, 29 deletions(-)
New commits:
commit f8a22bfbc19a4856861a0837432aa27e3dad0293
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jan 4 15:55:17 2010 +0100
equals_sign.pxt does not seem to be used, removing.
diff --git a/branding/templates/equals_sign.pxt b/branding/templates/equals_sign.pxt
deleted file mode 100644
index e8b3104..0000000
--- a/branding/templates/equals_sign.pxt
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<pxt-passthrough>
-<pxt-comment>
-Header at the top, sidebar at the left, mainview at the right, footer at the bottom.
-</pxt-comment>
-
-<pxt-use class="Grail::Frame" />
-<pxt-use class="Sniglets::Navi" />
-<pxt-use class="Sniglets::HTML" />
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<pxt-include-late file="/templates/header.pxt" />
-
- <body>
-<div id="wrap">
-
- <rhn-navi-nav depth="0" style="topnav"/>
- <pxt-include-late file="/network/components/status_bar/main.pxi" />
-
-<pxt-include-late file="/network/components/message_queues/site.pxi" />
- <grail-canvas mode="main_canvas" />
-<pxt-include-late file="/templates/footer.pxt" />
-
-</div>
- </body>
-
-</html>
-
-</pxt-passthrough>
14 years, 2 months
client/tools
by Milan Zazrivec
client/tools/rhn-virtualization/rhn-virtualization.spec | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 463f87ed83e95b15ddecfe0e9b32953e270f5e21
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Mon Jan 4 15:46:44 2010 +0100
552271 - -host needs to require specific version of -common package
Same version to be more specific: this will avoid problems caused by
situations in which rhn-virtualization-host was upgraded, though
rhn-virtualization-common was not.
diff --git a/client/tools/rhn-virtualization/rhn-virtualization.spec b/client/tools/rhn-virtualization/rhn-virtualization.spec
index f0484ba..131c845 100644
--- a/client/tools/rhn-virtualization/rhn-virtualization.spec
+++ b/client/tools/rhn-virtualization/rhn-virtualization.spec
@@ -34,7 +34,7 @@ package.
Summary: RHN/Spacewalk Virtualization support specific to the Host system
Group: System Environment/Base
Requires: libvirt-python
-Requires: rhn-virtualization-common
+Requires: rhn-virtualization-common = %{version}-%{release}
Requires: /usr/sbin/crond
%description host
14 years, 2 months