backend/server/handlers/xmlrpc/__init__.py
| 2
backend/server/handlers/xmlrpc/abrt.py
| 59 +++++
backend/server/rhnCapability.py
| 1
client/rhel/rhn-client-tools/src/bin/rhn_check.py
| 40 +++
client/rhel/spacewalk-abrt/Makefile
| 6
client/rhel/spacewalk-abrt/Makefile.spacewalk-abrt
| 28 ++
client/rhel/spacewalk-abrt/abrt
| 1
client/rhel/spacewalk-abrt/abrt.py
| 21 ++
client/rhel/spacewalk-abrt/spacewalk-abrt.spec
| 40 +++
java/code/src/com/redhat/rhn/domain/server/Crashes.hbm.xml
| 22 ++
java/code/src/com/redhat/rhn/domain/server/Crashes.java
| 102 ++++++++++
java/code/src/com/redhat/rhn/domain/server/Server.java
| 15 +
java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
| 3
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
| 28 ++
java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
| 20 +
schema/spacewalk/common/tables/rhnAbrtInfo.sql
| 29 ++
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.oracle
| 30 ++
schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.postgresql
| 30 ++
18 files changed, 476 insertions(+), 1 deletion(-)
New commits:
commit 28f762163fbae116d8dd1fdba90e63dc7fe7cf13
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:18 2012 +0200
Add translation strings for crash information
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index a70da57..8172c4d 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -17890,6 +17890,34 @@ The Tree Path, Kickstart RPM, Base Channel, and Installer
Generation should alwa
</context-group>
</trans-unit>
+ <trans-unit id="sdc.details.overview.crashes.application">
+ <source>Application crashes</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/systems/details/Overview.do</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="sdc.details.overview.crashes.nodata">
+ <source>To get application crash data install spacewalk-abrt on this
system.</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/systems/details/Overview.do</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="sdc.details.overview.crashes.lastreport">
+ <source>Last report</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/systems/details/Overview.do</context>
+ </context-group>
+ </trans-unit>
+
+ <trans-unit id="sdc.details.overview.crashes.crashcount">
+ <source>Crash count</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/systems/details/Overview.do</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="sdc.details.migrate.header">
<source>Migrate System Between Organizations</source>
<context-group name="ctx">
diff --git a/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
b/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
index afed8cb..123bddf 100644
--- a/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
@@ -346,19 +346,19 @@
</table>
</div>
<div style="width: 45%; float: left;">
- <h2>Application crashes</h2>
+ <h2><bean:message
key="sdc.details.overview.crashes.application"/></h2>
<table class="details">
<c:choose>
<c:when test="${system.crashes.created == null}">
- To get application crash data install spacewalk-abrt on this system.
+ <bean:message key="sdc.details.overview.crashes.nodata"/>
</c:when>
<c:otherwise>
<tr>
- <th>Last report</th>
+ <th><bean:message
key="sdc.details.overview.crashes.lastreport"/></th>
<td><fmt:formatDate value="${system.crashes.created}"
type="both" dateStyle="short"
timeStyle="long"/></td>
</tr>
<tr>
- <th>Crash count</th>
+ <th><bean:message
key="sdc.details.overview.crashes.crashcount"/></th>
<td><c:out
value="${system.crashes.crashCount}"/></td>
</tr>
</c:otherwise>
commit dcf781b238c2babd8c2beaaff7ca511c97ebacbe
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:17 2012 +0200
Show crash count on system detail page
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
b/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
index 94eba0d..afed8cb 100644
--- a/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
+++ b/java/code/webapp/WEB-INF/pages/systems/sdc/overview.jsp
@@ -345,6 +345,26 @@
</tr>
</table>
</div>
+ <div style="width: 45%; float: left;">
+ <h2>Application crashes</h2>
+ <table class="details">
+ <c:choose>
+ <c:when test="${system.crashes.created == null}">
+ To get application crash data install spacewalk-abrt on this system.
+ </c:when>
+ <c:otherwise>
+ <tr>
+ <th>Last report</th>
+ <td><fmt:formatDate value="${system.crashes.created}"
type="both" dateStyle="short"
timeStyle="long"/></td>
+ </tr>
+ <tr>
+ <th>Crash count</th>
+ <td><c:out
value="${system.crashes.crashCount}"/></td>
+ </tr>
+ </c:otherwise>
+ </c:choose>
+ </table>
+ </div>
<div style="clear: left; width: 45%; float: left; line-height: 200%">
<h2><bean:message key="sdc.details.overview.subscribedchannels"
arg0="/rhn/systems/details/SystemChannels.do?sid=${system.id}"/></h2>
commit a00da43eb9818def31f6df578b38ac25bde444b9
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:16 2012 +0200
Update server class to use crash information
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/java/code/src/com/redhat/rhn/domain/server/Server.java
b/java/code/src/com/redhat/rhn/domain/server/Server.java
index 0922281..4d5f10c 100644
--- a/java/code/src/com/redhat/rhn/domain/server/Server.java
+++ b/java/code/src/com/redhat/rhn/domain/server/Server.java
@@ -112,6 +112,7 @@ public class Server extends BaseDomainHelper implements Identifiable
{
private ProxyInfo proxyInfo;
private Set<? extends ServerGroup> groups;
private Set<Capability> capabilities;
+ private Crashes crashes;
public static final String VALID_CNAMES = "valid_cnames_";
@@ -1868,4 +1869,18 @@ public class Server extends BaseDomainHelper implements
Identifiable {
return SystemRecord.lookupById(con, getCobblerId());
}
+ /**
+ * @return Return application crashes.
+ */
+ public Crashes getCrashes() {
+ return crashes;
+ }
+
+ /**
+ * @param crashIn Set application crashes.
+ */
+ public void setCrashes(Crashes crashIn) {
+ crashes = crashIn;
+ }
+
}
diff --git a/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
b/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
index 45fea45..04bbec2 100644
--- a/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
+++ b/java/code/src/com/redhat/rhn/domain/server/Server_legacyUser.hbm.xml
@@ -118,6 +118,9 @@ PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<one-to-one name="cpu"
class="com.redhat.rhn.domain.server.CPU"
property-ref="server" cascade="all"
lazy="proxy"/>
+ <one-to-one name="crashes"
class="com.redhat.rhn.domain.server.Crashes"
+ property-ref="server" cascade="all"
lazy="proxy"/>
+
<one-to-one name="lock"
class="com.redhat.rhn.domain.server.ServerLock"
cascade="all" lazy="proxy"/>
commit c4eddc528bb725a92df503e76090a95fbc0659c9
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:15 2012 +0200
Add Crashes class and database mapping
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/java/code/src/com/redhat/rhn/domain/server/Crashes.hbm.xml
b/java/code/src/com/redhat/rhn/domain/server/Crashes.hbm.xml
new file mode 100644
index 0000000..95a11f4
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/Crashes.hbm.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping
+PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
+<hibernate-mapping>
+ <class name="com.redhat.rhn.domain.server.Crashes"
table="rhnAbrtInfo">
+ <id name="id" type="long" column="id">
+ <meta attribute="scope-set">protected</meta>
+ <generator class="sequence">
+ <param
name="sequence">rhn_abrt_info_id_seq</param>
+ </generator>
+ </id>
+
+ <many-to-one name="server"
+ class="com.redhat.rhn.domain.server.Server"
+ column="server_id" />
+ <property name="crashCount" column="num_crashes"
type="long" />
+ <property name="created" column="created"
type="timestamp"
+ insert="false" update="false"/>
+
+ </class>
+</hibernate-mapping>
diff --git a/java/code/src/com/redhat/rhn/domain/server/Crashes.java
b/java/code/src/com/redhat/rhn/domain/server/Crashes.java
new file mode 100644
index 0000000..5b1605d
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/domain/server/Crashes.java
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2009--2010 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 com.redhat.rhn.domain.server;
+
+import com.redhat.rhn.domain.BaseDomainHelper;
+
+import java.util.Date;
+
+/**
+ * Represents the number of crashes on a particular server.
+ * @version $Rev$
+ */
+public class Crashes extends BaseDomainHelper {
+
+ private Long id;
+ private Server server;
+ private Date created;
+ private long crashCount;
+
+ /**
+ * Represents application crash information.
+ */
+ public Crashes() {
+ super();
+ }
+
+ /**
+ * Returns the database id of the crashes object.
+ * @return Returns the id.
+ */
+ public Long getId() {
+ return id;
+ }
+
+ /**
+ * Sets the database id of the crashes object.
+ * @param idIn The id to set.
+ */
+ public void setId(Long idIn) {
+ id = idIn;
+ }
+
+ /**
+ * Returns the date of the last update.
+ * @return the date of the last update.
+ */
+ public Date getCreated() {
+ return created;
+ }
+
+ /**
+ * Sets the date of the last update.
+ * @param lastmod Last modification date.
+ */
+ public void setCreated(Date lastmod) {
+ created = lastmod;
+ }
+
+ /**
+ * The parent server.
+ * @return Returns the server.
+ */
+ public Server getServer() {
+ return server;
+ }
+
+ /**
+ * Sets the parent server.
+ * @param serverIn The server to set.
+ */
+ public void setServer(Server serverIn) {
+ server = serverIn;
+ }
+
+ /**
+ * Returns the total number of application crashes.
+ * @return the total number of application crashes.
+ */
+ public long getCrashCount() {
+ return crashCount;
+ }
+
+ /**
+ * Sets the total number of application crashes.
+ * @param count The total number of crashes.
+ */
+ public void setCrashCount(long count) {
+ crashCount = count;
+ }
+}
commit 31c761dc41e3106bf23ffad2a0f3d28b2042d21a
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:14 2012 +0200
Update rhn_check to send abrt data to the server
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/client/rhel/rhn-client-tools/src/bin/rhn_check.py
b/client/rhel/rhn-client-tools/src/bin/rhn_check.py
index 1a6747b..2d0d0b0 100755
--- a/client/rhel/rhn-client-tools/src/bin/rhn_check.py
+++ b/client/rhel/rhn-client-tools/src/bin/rhn_check.py
@@ -86,6 +86,13 @@ class CheckCli(rhncli.RhnCli):
if s.capabilities.hasCapability('staging_content', 1) and
cfg['stagingContent'] != 0:
self.__check_future_actions()
+ if s.capabilities.hasCapability('abrt.handle') and \
+ 'abrt.check' in clientCaps.caps.keys():
+ log.log_debug("abrt support found")
+ version = s.capabilities.parseCapVersion(
+ s.capabilities.data['abrt.handle']['version'])[0]
+ self.__check_abrt(version)
+
sys.exit(0)
def __get_action(self, status_report):
@@ -274,7 +281,38 @@ class CheckCli(rhncli.RhnCli):
xmlrpclib.Fault(-99, "Can not handle this
version"))
return False
return True
-
+
+ def __check_abrt(self, version):
+ ret = CheckCli.__run_action('abrt.check',
+ ('version=%d' % version,))
+ log.log_debug("check_abrt status: %s" % (ret,))
+ (status, message, data) = ret
+
+ self.server = CheckCli.__get_server()
+
+ try:
+ ret = self.server.abrt.handle(up2dateAuth.getSystemId(),
+ version, status, message, data)
+ log.log_debug("abrt.handle successful")
+ except xmlrpclib.Fault, f:
+ print "Could not submit results to server %s" % self.server
+ print "Error code: %d%s" % (f.faultCode, f.faultString)
+ sys.exit(-1)
+ # XXX: what if no SSL in socket?
+ except socket.sslerror:
+ print "ERROR: SSL handshake to %s failed" % self.server
+ print """
+ This could signal that you are *NOT* talking to a server
+ whose certificate was signed by a Certificate Authority
+ listed in the %s file or that the
+ RHNS-CA-CERT file is invalid.""" % self.rhns_ca_cert
+ sys.exit(-1)
+ except socket.error:
+ print "Could not submit to %s.\n"\
+ "Possible networking problem?" % str(self.server)
+ sys.exit(-1)
+ return ret
+
@staticmethod
def __get_server():
""" Initialize a server connection and set up capability info.
"""
commit c978e55e676c2be9c1fdb01ac0313c754d70edf1
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:13 2012 +0200
Add abrt data handling functionality
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/backend/server/handlers/xmlrpc/__init__.py
b/backend/server/handlers/xmlrpc/__init__.py
index 9287d6a..afe29d6 100644
--- a/backend/server/handlers/xmlrpc/__init__.py
+++ b/backend/server/handlers/xmlrpc/__init__.py
@@ -24,6 +24,7 @@ import queue
import errata
import proxy
import get_handler
+import abrt
rpcClasses = {
"registration" : registration.Registration,
@@ -32,6 +33,7 @@ rpcClasses = {
"errata" : errata.Errata,
"proxy" : proxy.Proxy,
"servers" : up2date.Servers,
+ "abrt" : abrt.Abrt,
}
getHandler = get_handler.GetHandler
diff --git a/backend/server/handlers/xmlrpc/abrt.py
b/backend/server/handlers/xmlrpc/abrt.py
new file mode 100644
index 0000000..dc3eaea
--- /dev/null
+++ b/backend/server/handlers/xmlrpc/abrt.py
@@ -0,0 +1,59 @@
+#
+# Copyright (c) 2012 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.
+#
+
+from spacewalk.server import rhnSQL
+from spacewalk.common.rhnLog import log_debug
+from spacewalk.server.rhnHandler import rhnHandler
+
+_query_delete_data = rhnSQL.Statement("""
+delete from rhnAbrtInfo where server_id = :server_id
+""")
+
+_query_store_data = rhnSQL.Statement("""
+insert into rhnAbrtInfo(
+ id,
+ server_id,
+ num_crashes,
+ created)
+values (
+ sequence_nextval('rhn_abrt_info_id_seq'),
+ :server_id,
+ :num_crashes,
+ current_timestamp
+ )
+""")
+
+class Abrt(rhnHandler):
+ def __init__(self):
+ rhnHandler.__init__(self)
+ self.functions.append('handle')
+
+ def handle(self, system_id, version, status, message, data):
+ self.auth_system(system_id)
+ log_debug(1, self.server_id, version, status, message, data)
+
+ if status == 0:
+ h = rhnSQL.prepare(_query_delete_data)
+ h.execute(server_id=self.server_id)
+
+ h = rhnSQL.prepare(_query_store_data)
+ h.execute(server_id=self.server_id,
+ num_crashes=data['num_crashes'])
+
+ rhnSQL.commit()
+
+ return True
+
+ return False
diff --git a/backend/server/rhnCapability.py b/backend/server/rhnCapability.py
index 4c54870..9f2a82f 100644
--- a/backend/server/rhnCapability.py
+++ b/backend/server/rhnCapability.py
@@ -166,6 +166,7 @@ def _set_server_capabilities():
'xmlrpc.errata.patch_names' : {'version' : 1,
'value' : 1},
'staging_content' : {'version' : 1,
'value' : 1},
'ipv6' : {'version' : 1,
'value' : 1},
+ 'abrt.handle' : {'version' : 1,
'value' : 1},
}
l = []
for name, hashval in capabilities.items():
commit 60cbfa48655833bc5f4b509b8e2ae82cd6528f1b
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:12 2012 +0200
Add schema and migration files for rhnAbrtInfo table
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/schema/spacewalk/common/tables/rhnAbrtInfo.sql
b/schema/spacewalk/common/tables/rhnAbrtInfo.sql
new file mode 100644
index 0000000..3e433c2
--- /dev/null
+++ b/schema/spacewalk/common/tables/rhnAbrtInfo.sql
@@ -0,0 +1,29 @@
+--
+-- Copyright (c) 2012 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.
+--
+
+CREATE TABLE rhnAbrtInfo
+(
+ id NUMBER NOT NULL,
+ server_id NUMBER NOT NULL
+ CONSTRAINT rhn_abrt_info_srvr_fk
+ REFERENCES rhnServer (id)
+ ON DELETE CASCADE,
+ num_crashes NUMBER NOT NULL,
+ created DATE NOT NULL
+)
+ENABLE ROW MOVEMENT
+;
+
+CREATE SEQUENCE rhn_abrt_info_id_seq;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.oracle
new file mode 100644
index 0000000..84d9824
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.oracle
@@ -0,0 +1,30 @@
+--
+-- Copyright (c) 2012 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.
+--
+
+CREATE TABLE rhnAbrtInfo
+(
+ id NUMBER NOT NULL
+ CONSTRAINT rhn_abrt_info_pk PRIMARY KEY,
+ server_id NUMBER NOT NULL
+ CONSTRAINT rhn_abrt_info_srvr_fk
+ REFERENCES rhnServer (id)
+ ON DELETE CASCADE,
+ num_crashes NUMBER NOT NULL,
+ created DATE NOT NULL
+)
+ENABLE ROW MOVEMENT
+;
+
+CREATE SEQUENCE rhn_abrt_info_id_seq;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.postgresql
new file mode 100644
index 0000000..c2c9343
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.7-to-spacewalk-schema-1.8/111-rhnAbrtInfo_create.sql.postgresql
@@ -0,0 +1,30 @@
+--
+-- Copyright (c) 2012 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.
+--
+
+CREATE TABLE rhnAbrtInfo
+(
+ id NUMERIC NOT NULL
+ CONSTRAINT rhn_abrt_info_pk PRIMARY KEY,
+ server_id NUMERIC NOT NULL
+ CONSTRAINT rhn_abrt_info_srvr_fk
+ REFERENCES rhnServer (id)
+ ON DELETE CASCADE,
+ num_crashes NUMERIC NOT NULL,
+ created TIMESTAMPTZ NOT NULL
+)
+
+;
+
+CREATE SEQUENCE rhn_abrt_info_id_seq;
commit 59632a5f8d85ce3731a536dfa18dce02a19528bc
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:11 2012 +0200
Add specfile for spacewalk-abrt
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/client/rhel/spacewalk-abrt/spacewalk-abrt.spec
b/client/rhel/spacewalk-abrt/spacewalk-abrt.spec
new file mode 100644
index 0000000..b91b469
--- /dev/null
+++ b/client/rhel/spacewalk-abrt/spacewalk-abrt.spec
@@ -0,0 +1,40 @@
+Name: spacewalk-abrt
+Version: 0.0.1
+Release: 1%{?dist}
+Summary: ABRT plug-in for rhn-check
+
+Group: Applications/System
+License: GPLv2
+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
+BuildRequires: python-devel
+BuildRequires: rhnlib
+Requires: abrt
+Requires: rhnlib
+Requires: rhn-check
+%description
+spacewalk-abrt - rhn-check plug-in for collecting information about crashes handled by
ABRT.
+
+%prep
+%setup -q
+
+%build
+make -f Makefile.spacewalk-abrt
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make -f Makefile.spacewalk-abrt install PREFIX=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%config /etc/sysconfig/rhn/clientCaps.d/abrt
+%{_datadir}/rhn/actions/abrt.*
+
+%changelog
+* Mon Jul 09 2012 Richard Marko <rmarko(a)redhat.com> 0.0.1-1
+- initial packaging
+
commit 511e10613f979834aff459024eb44459f85eb0d7
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:10 2012 +0200
Add makefiles for spacewalk-abrt
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/client/rhel/spacewalk-abrt/Makefile b/client/rhel/spacewalk-abrt/Makefile
new file mode 100644
index 0000000..442ff62
--- /dev/null
+++ b/client/rhel/spacewalk-abrt/Makefile
@@ -0,0 +1,6 @@
+NAME := spacewalk-abrt
+
+SPECFILE = $(NAME).spec
+DO_TAR_GZ := git-tree-sha1
+
+include ../../../rel-eng/Makefile
diff --git a/client/rhel/spacewalk-abrt/Makefile.spacewalk-abrt
b/client/rhel/spacewalk-abrt/Makefile.spacewalk-abrt
new file mode 100644
index 0000000..9d2b264
--- /dev/null
+++ b/client/rhel/spacewalk-abrt/Makefile.spacewalk-abrt
@@ -0,0 +1,28 @@
+# Makefile for spacewalk-abrt
+#
+
+ACTIONS = abrt
+PYFILES = $(addsuffix .py, $(ACTIONS)) $(addsuffix .pyc, $(ACTIONS))
+CAPABILITY = abrt
+OBJECTS = $(PYFILES) $(XSLT)
+
+PREFIX ?=
+ACTIONDIR = $(PREFIX)/usr/share/rhn/actions
+CAPSDIR = $(PREFIX)/etc/sysconfig/rhn/clientCaps.d
+INSTALL = /usr/bin/install -c
+FILE = -m 644
+DIR = -m 755 --verbose -d
+
+
+all: $(OBJECTS)
+
+%.pyc: %.py
+ python -c "import py_compile; py_compile.compile('$<')"
+
+install: all
+ $(INSTALL) $(DIR) $(ACTIONDIR) $(CAPSDIR)
+ $(INSTALL) $(FILE) $(PYFILES) $(ACTIONDIR)
+ $(INSTALL) $(FILE) $(CAPABILITY) $(CAPSDIR)
+
+clean:
+ @rm -rf *.pyc *~ .*~
commit ec49264d16a613fc87ef86503a6492232278165f
Author: Richard Marko <rmarko(a)redhat.com>
Date: Wed Jul 18 15:38:09 2012 +0200
spacewalk-abrt initial
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
diff --git a/client/rhel/spacewalk-abrt/abrt b/client/rhel/spacewalk-abrt/abrt
new file mode 100644
index 0000000..db7b604
--- /dev/null
+++ b/client/rhel/spacewalk-abrt/abrt
@@ -0,0 +1 @@
+abrt.check(1)=1
diff --git a/client/rhel/spacewalk-abrt/abrt.py b/client/rhel/spacewalk-abrt/abrt.py
new file mode 100644
index 0000000..a43419f
--- /dev/null
+++ b/client/rhel/spacewalk-abrt/abrt.py
@@ -0,0 +1,21 @@
+import os
+import sys
+sys.path.append("/usr/share/rhn/")
+
+__rhnexport__ = [ 'check' ]
+
+ABRT_DIR = '/var/spool/abrt'
+
+def check(version):
+ if not os.path.isdir(ABRT_DIR):
+ return (1, 'no ABRT_DIR "%s" found' % ABRT_DIR)
+
+ if not os.access(ABRT_DIR, os.R_OK):
+ return (2, 'no permission to read ABRT_DIR "%s"' % ABRT_DIR)
+
+ crash_dirs = [ name for name in os.listdir(ABRT_DIR) if
+ os.path.isdir(os.path.join(ABRT_DIR, name)) ]
+
+ return (0, 'abrt check completed', {
+ 'num_crashes': len(crash_dirs),
+ })