java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
| 15
java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
| 18 +
java/code/src/com/redhat/rhn/frontend/action/audit/AuditSearchAction.java
| 1
java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
| 36 --
java/code/src/com/redhat/rhn/frontend/dto/SystemOverview.java
| 13
java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
| 164 +++++++---
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
| 7
java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
| 4
java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
| 21 +
java/code/src/com/redhat/rhn/manager/system/SystemManager.java
| 12
java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
| 103 ++++++
java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
| 17 -
java/conf/default/rhn_taskomatic.conf
| 4
schema/spacewalk/oracle/views/rhnServerOverview.sql
| 20 +
schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/151-rhnServerOverview.sql
| 100 ++++++
15 files changed, 460 insertions(+), 75 deletions(-)
New commits:
commit a04235810ba4353e4e6dc171204908139d240227
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Tue Nov 3 11:27:59 2009 +0100
standart Red Hat header added to CompareConfigFilesTask.java
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
b/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
index 9609238..bc0127b 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
@@ -1,4 +1,17 @@
-
+/**
+ * Copyright (c) 2009 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.taskomatic.task;
import com.redhat.rhn.domain.action.Action;
commit 4a7715cac0e35f31bec4576a15e0becbc1e89b5b
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Fri Oct 9 11:28:02 2009 -0400
Show number of differing config files in overview
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
index 6a5979a..74d293d 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
@@ -1100,6 +1100,7 @@ ORDER BY S.ID
SELECT /*+ RULE */ SERVER_ID AS ID, OUTDATED_PACKAGES, SERVER_NAME, security_errata,
bug_errata, enhancement_errata,
SERVER_ADMINS, GROUP_COUNT, NOTE_COUNT, MODIFIED, CHANNEL_LABELS, CHANNEL_ID,
HISTORY_COUNT,
LAST_CHECKIN_DAYS_AGO, PENDING_UPDATES, OS, RELEASE, SERVER_ARCH_NAME,
LAST_CHECKIN, LOCKED,
+ config_files_with_differences,
( SELECT DECODE(
MAX(DECODE(PS.state, 'OK', 1, 'PENDING', 2,
'UNKNOWN', 3, 'WARNING', 4, 'CRITICAL', 5)),
1, 'OK', 2, 'PENDING', 3, 'UNKNOWN', 4,
'WARNING', 5, 'CRITICAL') ST
@@ -1132,6 +1133,7 @@ select distinct sgm.server_id as ID, 1 as virtual_host
SELECT SERVER_ID AS ID, SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
OUTDATED_PACKAGES, SERVER_NAME,
SERVER_ADMINS, GROUP_COUNT, NOTE_COUNT, MODIFIED, CHANNEL_LABELS,
HISTORY_COUNT,
LAST_CHECKIN_DAYS_AGO, PENDING_UPDATES, OS, RELEASE, SERVER_ARCH_NAME,
LAST_CHECKIN, LOCKED,
+ config_files_with_differences,
( SELECT DECODE(
MAX(DECODE(PS.state, 'OK', 1, 'PENDING', 2,
'UNKNOWN', 3, 'WARNING', 4, 'CRITICAL', 5)),
1, 'OK', 2, 'PENDING', 3, 'UNKNOWN', 4,
'WARNING', 5, 'CRITICAL') ST
@@ -1149,6 +1151,7 @@ ORDER BY SECURITY_ERRATA DESC, BUG_ERRATA DESC, ENHANCEMENT_ERRATA
DESC
SERVER_ID as system_id, SECURITY_ERRATA, BUG_ERRATA, ENHANCEMENT_ERRATA,
OUTDATED_PACKAGES, SERVER_NAME,
SERVER_ADMINS, GROUP_COUNT, NOTE_COUNT, OV.MODIFIED, CHANNEL_LABELS,
CHANNEL_ID, HISTORY_COUNT,
LAST_CHECKIN_DAYS_AGO, PENDING_UPDATES, OS, RELEASE, SERVER_ARCH_NAME,
LAST_CHECKIN, LOCKED,
+ config_files_with_differences,
( SELECT DECODE(
MAX(DECODE(PS.state, 'OK', 1, 'PENDING', 2,
'UNKNOWN', 3, 'WARNING', 4, 'CRITICAL', 5)),
1, 'OK', 2, 'PENDING', 3, 'UNKNOWN', 4,
'WARNING', 5, 'CRITICAL') ST
diff --git a/java/code/src/com/redhat/rhn/frontend/dto/SystemOverview.java
b/java/code/src/com/redhat/rhn/frontend/dto/SystemOverview.java
index ff7c41d..5a18f5c 100644
--- a/java/code/src/com/redhat/rhn/frontend/dto/SystemOverview.java
+++ b/java/code/src/com/redhat/rhn/frontend/dto/SystemOverview.java
@@ -39,6 +39,7 @@ public class SystemOverview extends BaseDto implements Serializable {
private Long bugErrata = 0L;
private Long enhancementErrata = 0L;
private Long outdatedPackages;
+ private Long configFilesWithDifferences;
private String serverName;
private Long serverAdmins;
private Long groupCount;
@@ -318,6 +319,18 @@ public class SystemOverview extends BaseDto implements Serializable
{
this.outdatedPackages = outdatedPackagesIn;
}
/**
+ * @return Returns the configFilesWithDifferences.
+ */
+ public Long getConfigFilesWithDifferences() {
+ return configFilesWithDifferences;
+ }
+ /**
+ * @param configFilesWithDifferencesIn The configFilesWithDifferences to set.
+ */
+ public void setConfigFilesWithDifferences(Long configFilesWithDifferencesIn) {
+ this.configFilesWithDifferences = configFilesWithDifferencesIn;
+ }
+ /**
* @return Returns the pendingUpdates.
*/
public Long getPendingUpdates() {
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 221f448..5a485c2 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
@@ -5292,6 +5292,13 @@ value for this entitlement, excluding the default
organization's consumption.</s
</context-group>
</trans-unit>
+ <trans-unit id="systemlist.jsp.configfiles">
+<source>Configs</source>
+ <context-group name="ctx">
+ <context
context-type="sourcefile">/rhn/systems/SystemList</context>
+ </context-group>
+ </trans-unit>
+
<trans-unit id="systemlist.jsp.packages">
<source>Packages</source>
<context-group name="ctx">
diff --git
a/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
b/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
index 6a48ef8..7110391 100644
--- a/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
+++ b/java/code/webapp/WEB-INF/pages/common/fragments/systems/system_listdisplay.jspf
@@ -85,7 +85,22 @@
</c:choose>
</rl:column>
</c:if>
-
+ <c:if test = "${empty noConfigFiles}">
+ <rl:column sortable="false"
+ bound="false"
+ headerkey="systemlist.jsp.configfiles"
+ styleclass="center"
+ headerclass="thin-column">
+ <c:choose>
+ <c:when test="${(current.configFilesWithDifferences) == 0}">
+ <c:out value="0" />
+ </c:when>
+ <c:otherwise>
+ <c:out value="<a
href='/rhn/systems/details/configuration/Overview.do?sid=${current.id}'>${current.configFilesWithDifferences}</a>"
escapeXml="false" />
+ </c:otherwise>
+ </c:choose>
+ </rl:column>
+ </c:if>
<!-- Name Channel Column -->
<rl:column sortable="true"
bound="false"
diff --git a/schema/spacewalk/oracle/views/rhnServerOverview.sql
b/schema/spacewalk/oracle/views/rhnServerOverview.sql
index 274da86..cd9d51f 100644
--- a/schema/spacewalk/oracle/views/rhnServerOverview.sql
+++ b/schema/spacewalk/oracle/views/rhnServerOverview.sql
@@ -31,6 +31,7 @@ rhnServerOverview
bug_errata,
enhancement_errata,
outdated_packages,
+ config_files_with_differences,
last_checkin_days_ago,
last_checkin,
pending_updates,
@@ -77,7 +78,24 @@ select
where
snpc.server_id = S.id
and p.id = snpc.package_id
- ),
+ ),
+ ( select count(*)
+ from rhnActionConfigRevision ACR
+ INNER JOIN rhnActionConfigRevisionResult ACRR on ACR.id =
ACRR.action_config_revision_id
+ where ACR.server_id = S.id
+ and ACR.action_id = (
+ select MAX(rA.id)
+ from rhnAction rA
+ INNER JOIN rhnServerAction rSA on rSA.action_id = rA.id
+ INNER JOIN rhnActionStatus rAS on rAS.id = rSA.status
+ INNER JOIN rhnActionType rAT on rAT.id = rA.action_type
+ where rSA.server_id = S.id
+ and rAS.name in ('Completed', 'Failed')
+ and rAT.label = 'configfiles.diff'
+ )
+ and ACR.failure_id is null
+ and ACRR.result is not null
+ ),
( select sysdate - checkin from rhnServerInfo where server_id = S.id ),
( select TO_CHAR(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnServerInfo where
server_id = S.id ),
( select count(1)
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/151-rhnServerOverview.sql
b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/151-rhnServerOverview.sql
new file mode 100644
index 0000000..068e6b5
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-0.6-to-spacewalk-schema-0.7/151-rhnServerOverview.sql
@@ -0,0 +1,100 @@
+--
+-- Add in config_files_with_differences
+--
+
+create or replace view
+rhnServerOverview
+(
+ org_id,
+ server_id,
+ server_name,
+ note_count,
+ modified,
+ server_admins,
+ group_count,
+ channel_id,
+ channel_labels,
+ history_count,
+ security_errata,
+ bug_errata,
+ enhancement_errata,
+ outdated_packages,
+ config_files_with_differences,
+ last_checkin_days_ago,
+ last_checkin,
+ pending_updates,
+ os,
+ release,
+ server_arch_name,
+ locked
+)
+as
+select
+ s.org_id, s.id, s.name, 0, s.modified,
+ ( select count(user_id) from rhnUserServerPerms ap
+ where server_id = s.id ),
+ ( select count(server_group_id) from rhnVisibleServerGroupMembers
+ where server_id = s.id ),
+ ( select C.id
+ from rhnChannel C,
+ rhnServerChannel SC
+ where SC.server_id = S.id
+ and SC.channel_id = C.id
+ and C.parent_channel IS NULL),
+ NVL(( select C.name
+ from rhnChannel C,
+ rhnServerChannel SC
+ where SC.server_id = S.id
+ and SC.channel_id = C.id
+ and C.parent_channel IS NULL), '(none)'),
+ ( select count(id) from rhnServerHistory
+ where
+ server_id = S.id),
+ ( select count(*) from rhnServerErrataTypeView setv
+ where
+ setv.server_id = s.id
+ and setv.errata_type = 'Security Advisory'),
+ ( select count(*) from rhnServerErrataTypeView setv
+ where
+ setv.server_id = s.id
+ and setv.errata_type = 'Bug Fix Advisory'),
+ ( select count(*) from rhnServerErrataTypeView setv
+ where
+ setv.server_id = s.id
+ and setv.errata_type = 'Product Enhancement Advisory'),
+ ( select count(distinct p.name_id) from rhnPackage p, rhnServerNeededPackageCache
snpc
+ where
+ snpc.server_id = S.id
+ and p.id = snpc.package_id
+ ),
+ ( select count(*)
+ from rhnActionConfigRevision ACR
+ INNER JOIN rhnActionConfigRevisionResult ACRR on ACR.id =
ACRR.action_config_revision_id
+ where ACR.server_id = S.id
+ and ACR.action_id = (
+ select MAX(rA.id)
+ from rhnAction rA
+ INNER JOIN rhnServerAction rSA on rSA.action_id = rA.id
+ INNER JOIN rhnActionStatus rAS on rAS.id = rSA.status
+ INNER JOIN rhnActionType rAT on rAT.id = rA.action_type
+ where rSA.server_id = S.id
+ and rAS.name in ('Completed', 'Failed')
+ and rAT.label = 'configfiles.diff'
+ )
+ and ACR.failure_id is null
+ and ACRR.result is not null
+ ),
+ ( select sysdate - checkin from rhnServerInfo where server_id = S.id ),
+ ( select TO_CHAR(checkin, 'YYYY-MM-DD HH24:MI:SS') from rhnServerInfo where
server_id = S.id ),
+ ( select count(1)
+ from rhnServerAction
+ where server_id = S.id
+ and status in (0, 1)),
+ os,
+ release,
+ ( select name from rhnServerArch where id = s.server_arch_id),
+ NVL((select 1 from rhnServerLock SL WHERE SL.server_id = S.id), 0)
+from
+ rhnServer S
+/
+
commit 7d1fb1cbca9215fd6f742f9449ad68b42388d5a7
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Thu Oct 8 10:06:39 2009 -0400
Set CompareConfigFilesTask to run at 11pm
diff --git a/java/conf/default/rhn_taskomatic.conf
b/java/conf/default/rhn_taskomatic.conf
index 6fe0b3c..fea70a6 100644
--- a/java/conf/default/rhn_taskomatic.conf
+++ b/java/conf/default/rhn_taskomatic.conf
@@ -22,7 +22,8 @@ com.redhat.rhn.taskomatic.task.ErrataCacheTask,\
com.redhat.rhn.taskomatic.task.CobblerSyncTask,\
com.redhat.rhn.taskomatic.task.ChannelRepodata,\
com.redhat.rhn.taskomatic.task.KickstartFileSyncTask,\
-com.redhat.rhn.taskomatic.task.RepoSyncTask
+com.redhat.rhn.taskomatic.task.RepoSyncTask,\
+com.redhat.rhn.taskomatic.task.CompareConfigFilesTask
# additional tasks
taskomatic.tasks =
@@ -70,6 +71,7 @@ taskomatic.com.redhat.rhn.taskomatic.task.CleanCurrentAlerts.schedule =
0 35 4 ?
# Once a day at 11:00 PM
taskomatic.com.redhat.rhn.taskomatic.task.SummaryPopulation.schedule = 0 0 23 ? * *
+taskomatic.com.redhat.rhn.taskomatic.task.CompareConfigFilesTask.schedule = 0 0 23 ? * *
# Once a day at 5:00:00 AM
taskomatic.com.redhat.rhn.taskomatic.task.DailySummary.schedule = 0 0 5 ? * *
commit 5c993c5784f4e521002f5be36be3e84dca3833cd
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Thu Oct 8 09:36:04 2009 -0400
Add task to schedule config file comparisons
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
index 0bcd46b..6a5979a 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/System_queries.xml
@@ -422,6 +422,18 @@ ORDER BY UPPER(NVL(S.name, '(none)')), S.id
<elaborator name="is_virtual_host" />
</mode>
+<mode name="all_systems"
class="com.redhat.rhn.frontend.dto.SystemOverview">
+ <query>
+ SELECT DISTINCT S.id,
+ S.name AS SERVER_NAME,
+ (SELECT 1
+ FROM rhnServerFeaturesView SFV
+ WHERE SFV.server_id = S.id
+ AND SFV.label = 'ftr_system_grouping') AS selectable
+ FROM rhnServer S
+ </query>
+ <elaborator name="system_overview" />
+</mode>
<mode name="most_critical_systems"
class="com.redhat.rhn.frontend.dto.SystemOverview">
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
index bc769f1..e964f2f 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/config_queries.xml
@@ -1265,6 +1265,24 @@ ORDER BY CFN.path
<elaborator name="file_name_elab" />
</mode>
+<mode name="automated_file_names_for_system"
class="com.redhat.rhn.frontend.dto.ConfigFileNameDto">
+ <query params="sid">
+SELECT DISTINCT CFN.id, CFN.path
+ FROM rhnConfigFileName CFN, rhnServerConfigChannel SCC,
+ rhnConfigFile CF, rhnUserServerPerms USP,
+ rhnConfigChannel CC, rhnConfigChannelType CCT
+ WHERE SCC.server_id = :sid
+ AND USP.server_id = SCC.server_id
+ AND SCC.config_channel_id = CF.config_channel_id
+ AND SCC.config_channel_id = CC.id
+ AND CC.confchan_type_id = CCT.id
+ AND CCT.label != 'server_import'
+ AND CF.config_file_name_id = CFN.id
+ORDER BY CFN.path
+ </query>
+ <elaborator name="file_name_elab" />
+</mode>
+
<mode name="file_names_for_system"
class="com.redhat.rhn.frontend.dto.ConfigFileNameDto">
<query params="sid, user_id">
SELECT DISTINCT CFN.id, CFN.path
diff --git a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
index 4d7a5cf..b7c487e 100644
--- a/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
+++ b/java/code/src/com/redhat/rhn/manager/configuration/ConfigurationManager.java
@@ -517,8 +517,25 @@ public class ConfigurationManager extends BaseManager {
DataResult dr = makeDataResult(params, elabParams, pc, m);
return dr;
}
-
-
+
+ /**
+ * Lists the file names to which the given server is subscribed
+ * Finds the deployable revisions for each file name.
+ * @param server The server to which these files must be relevant
+ * @return A list of config file names in DTO format.
+ */
+ public DataResult <ConfigFileNameDto> listAllFileNamesForSystem(Server server)
{
+ SelectMode m = ModeFactory.getMode("config_queries",
+ "automated_file_names_for_system");
+ Map params = new HashMap();
+ Map elabParams = new HashMap();
+ params.put("sid", server.getId());
+ elabParams.put("sid", server.getId());
+ DataResult dr = makeDataResult(params, elabParams, null, m);
+ dr.elaborate();
+ return dr;
+ }
+
/**
* Lists the file names to which the given server is subscribed
* Finds the deployable revisions for each file name.
diff --git a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
index b393eee..6e1221c 100644
--- a/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
+++ b/java/code/src/com/redhat/rhn/manager/system/SystemManager.java
@@ -288,7 +288,17 @@ public class SystemManager extends BaseManager {
return makeDataResult(params, elabParams, pc, m);
}
-
+ /**
+ * Returns a list of all systems
+ * @return list of SystemOverviews
+ */
+ public static DataResult<SystemOverview> listAllSystems() {
+ SelectMode m = ModeFactory.getMode("System_queries",
"all_systems");
+ DataResult dr = makeDataResult(new HashMap(), new HashMap(), null, m);
+ dr.elaborate();
+ return dr;
+ }
+
/**
* Returns list of all systems that are visible to user
* but not in the given server group.
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
b/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
new file mode 100644
index 0000000..9609238
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/CompareConfigFilesTask.java
@@ -0,0 +1,90 @@
+
+package com.redhat.rhn.taskomatic.task;
+
+import com.redhat.rhn.domain.action.Action;
+import com.redhat.rhn.domain.action.ActionFactory;
+import com.redhat.rhn.domain.action.config.ConfigAction;
+import com.redhat.rhn.domain.config.ConfigFile;
+import com.redhat.rhn.domain.config.ConfigRevision;
+import com.redhat.rhn.domain.config.ConfigurationFactory;
+import com.redhat.rhn.domain.server.Server;
+import com.redhat.rhn.domain.server.ServerFactory;
+import com.redhat.rhn.frontend.dto.ConfigFileNameDto;
+import com.redhat.rhn.frontend.dto.SystemOverview;
+import com.redhat.rhn.manager.configuration.ConfigurationManager;
+import com.redhat.rhn.manager.system.SystemManager;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+/**
+ * Compare Config Files
+ * Schedules a comparison of config files on all systems
+ *
+ * @version $Rev$
+ */
+public class CompareConfigFilesTask implements Job {
+
+ /**
+ * Used to log stats in the RHNDAEMONSTATE table
+ */
+ public static final String DISPLAY_NAME = "compare_config_files";
+
+ private static Logger log = Logger.getLogger(CompareConfigFilesTask.class);
+
+ /**
+ * Default constructor
+ */
+ public CompareConfigFilesTask() {
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute(JobExecutionContext context)
+ throws JobExecutionException {
+
+ log.info("running config compare");
+
+ ConfigurationManager cm = ConfigurationManager.getInstance();
+
+ for (SystemOverview sys : SystemManager.listAllSystems()) {
+ Action act =
ActionFactory.createAction(ActionFactory.TYPE_CONFIGFILES_DIFF);
+ ConfigAction cfact = (ConfigAction) act;
+ Server server = ServerFactory.lookupById(sys.getId());
+
+ if (server.isInactive()) {
+ continue;
+ }
+
+ // set up needed fields for the action
+ act.setName(act.getActionType().getName());
+ act.setOrg(server.getOrg());
+
+ // add the server to the action
+ ActionFactory.addServerToAction(server, act);
+
+ // add file revisions to the action
+ for (ConfigFileNameDto cfn : cm.listAllFileNamesForSystem(server)) {
+ Long cfid = cfn.getConfigFileId();
+ ConfigFile cf = ConfigurationFactory.lookupConfigFileById(cfid);
+ ConfigRevision crev = cf.getLatestConfigRevision();
+
+ ActionFactory.addConfigRevisionToAction(crev, server, cfact);
+ }
+
+ if (act.getServerActions().size() < 1) {
+ continue;
+ }
+ if (cfact.getConfigRevisionActions().size() < 1) {
+ continue;
+ }
+
+ ActionFactory.save(act);
+ }
+ }
+}
+
+// vim: ts=4:expandtab
commit 275fe193b49ac4b1f27ebeaf7ce557ee8208f72c
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Fri Oct 9 09:31:04 2009 -0400
Fix two more fd leaks
diff --git a/java/code/src/com/redhat/rhn/frontend/action/audit/AuditSearchAction.java
b/java/code/src/com/redhat/rhn/frontend/action/audit/AuditSearchAction.java
index 074aab9..61b51c4 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/audit/AuditSearchAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/audit/AuditSearchAction.java
@@ -134,6 +134,7 @@ public class AuditSearchAction extends RhnAction {
brdr.readLine(); // Argument is required for -m
str = brdr.readLine(); // Valid message types are: ...
str = str.substring(str.indexOf(':') + 2);
+ brdr.close();
}
catch (IOException ioex) {
log.warn("failed to get ausearch types", ioex);
diff --git a/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
b/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
index a94706d..82b154c 100644
--- a/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
+++ b/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
@@ -445,6 +445,8 @@ public class AuditManager /* extends BaseManager */ {
}
}
+ brdr.close();
+
return events;
}
}
commit d2a4d27d9a38b75e8e7491cd3de1115e9e6126f9
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Thu Oct 8 15:29:44 2009 -0400
Plug fd leak
This is possibly disastrous if you have a lot of audit files.
diff --git a/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
b/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
index 9e11d01..a94706d 100644
--- a/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
+++ b/java/code/src/com/redhat/rhn/manager/audit/AuditManager.java
@@ -386,6 +386,8 @@ public class AuditManager /* extends BaseManager */ {
}
}
+ brdr.close();
+
return new AuditReviewDto(machine, new Date(start), new Date(end),
reviewedBy, reviewedOn);
}
commit b1a280727f236143c08efda60ade5d9cadc9af24
Author: Joshua Roys <joshua.roys(a)gtri.gatech.edu>
Date: Fri Sep 18 14:40:49 2009 -0400
Fix system comparison file/dir/symlink counts
diff --git
a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
index 9403841..2c08ef9 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/configuration/sdc/OverviewAction.java
@@ -275,30 +275,21 @@ public class OverviewAction extends RhnAction {
ConfigFileCount differing,
String url) {
- int filesSuffix = getSuffix(total.getFiles() + total.getSymlinks());
+ int filesSuffix = getSuffix(total.getFiles());
int dirsSuffix = getSuffix(total.getDirectories());
+ int symlinksSuffix = getSuffix(total.getSymlinks());
String messageKey = DIFF_ACTION_MESSAGE_PREFIX +
- filesSuffix + "_dirs_" + dirsSuffix;
+ filesSuffix + "_dirs_" + dirsSuffix + "_symlinks_" +
symlinksSuffix;
List params = new ArrayList();
// setup the params
- if (filesSuffix == PLURAL) {
- params.add(String.valueOf(successful.getFiles() +
successful.getSymlinks()));
- params.add(String.valueOf(total.getFiles() + total.getSymlinks()));
- }
- else if (filesSuffix == SINGULAR) {
- params.add(String.valueOf(successful.getFiles() +
successful.getSymlinks()));
- }
-
- if (dirsSuffix == PLURAL) {
- params.add(String.valueOf(successful.getDirectories()));
- params.add(String.valueOf(total.getDirectories()));
- }
- else if (dirsSuffix == SINGULAR) {
- params.add(String.valueOf(successful.getDirectories()));
- }
-
+ params.add(String.valueOf(successful.getFiles()));
+ params.add(String.valueOf(total.getFiles()));
+ params.add(String.valueOf(successful.getDirectories()));
+ params.add(String.valueOf(total.getDirectories()));
+ params.add(String.valueOf(successful.getSymlinks()));
+ params.add(String.valueOf(total.getSymlinks()));
params.add(url);
LocalizationService service = LocalizationService.getInstance();
@@ -306,9 +297,10 @@ public class OverviewAction extends RhnAction {
request.setAttribute(DIFF_ACTION_MESSAGE,
service.getMessage(messageKey));
}
- request.setAttribute(DIFF_ACTION_MESSAGE,
- service.getMessage(messageKey,
- params.toArray()));
+ else {
+ request.setAttribute(DIFF_ACTION_MESSAGE,
+ service.getMessage(messageKey, params.toArray()));
+ }
if (successful.getFiles() + successful.getSymlinks() > 0) {
String diffActionKey;
@@ -327,7 +319,7 @@ public class OverviewAction extends RhnAction {
else {
Object [] keyParams = new Object[] {
String.valueOf(differing.getFiles() + differing.getSymlinks()),
- String.valueOf(successful.getFiles() +
successful.getSymlinks())
+ String.valueOf(successful.getFiles() + successful.getSymlinks())
};
request.setAttribute(DIFF_DETAILS_MESSAGE,
service.getMessage(diffActionKey, keyParams));
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
index 99028dd..fc5d8d0 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/java/StringResource_en_US.xml
@@ -7108,57 +7108,127 @@ Follow this url to see the full list of inactive systems:
<trans-unit id="sdc.config.diff.noaction">
<source>No system comparisons completed. [<a
href="{0}">Schedule System
Comparison</a>]</source>
</trans-unit>
- <trans-unit id="sdc.config.diff.files_0_dirs_0">
- <source>No files or directories were selected for comparison. [<a
href="{0}"> View Details</a>]</source>
- </trans-unit>
- <trans-unit id="sdc.config.diff.files_1_dirs_0">
-<source>{0} of 1 file on the system was successfully compared with
@@PRODUCT_NAME@@-Managed files and directories. [<a
href="{1}"> View Details</a>]</source>
- </trans-unit>
-
-
- <trans-unit id="sdc.config.diff.files_2_dirs_0">
- <source>{0} of {1} files on the system were successfully compared with
@@PRODUCT_NAME@@-Managed files and directories. [<a
href="{2}"> View Details</a>]</source>
- </trans-unit>
-
+ <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_0">
+ <source>No files, directories or symlinks were selected for comparison.
[<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
- <trans-unit id="sdc.config.diff.files_0_dirs_1">
-<source>{0} of 1 directory on the system was successfully compared with
@@PRODUCT_NAME@@-Managed files and directories. [<a
href="{1}"> View Details</a>]</source>
- </trans-unit>
-
-
- <trans-unit id="sdc.config.diff.files_0_dirs_2">
- <source>{0} of {1} directories on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files and directories. [<a
href="{2}"> View Details</a>]</source>
- </trans-unit>
+ <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_1">
+ <source>{4} of 1 symlink on the system was successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
- <trans-unit id="sdc.config.diff.files_1_dirs_1">
-<source>{0} of 1 file and {1} of 1 directory on the system was successfully
compared with @@PRODUCT_NAME@@-Managed files and directories. [<a
href="{2}"> View Details</a>]</source>
- </trans-unit>
-
-
- <trans-unit id="sdc.config.diff.files_1_dirs_2">
- <source>{0} of 1 file and {1} of {2} directories on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files and directories. [<a
href="{3}"> View Details</a>]</source>
- </trans-unit>
-
- <trans-unit id="sdc.config.diff.files_2_dirs_1">
- <source>{0} of {1} files and {2} of 1 directory on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files and directories. [<a
href="{3}"> View Details</a>]</source>
- </trans-unit>
-
- <trans-unit id="sdc.config.diff.files_2_dirs_2">
- <source>{0} of {1} files and {2} of 1 directory on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files and directories. [<a
href="{3}"> View Details</a>]</source>
- </trans-unit>
-
- <trans-unit id="sdc.config.differing.files_0">
- <source>No existing files in the existing system differed from the
@@PRODUCT_NAME@@-Managed files.</source>
+ <trans-unit id="sdc.config.diff.files_0_dirs_0_symlinks_2">
+ <source>{4} of {5} symlinks on the system were successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_0">
+ <source>{2} of 1 directory on the system was successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_1">
+ <source>{2} of 1 directory and {4} of 1 symlink on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_1_symlinks_2">
+ <source>{2} of 1 directory and {4} of {5} symlinks on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_0">
+ <source>{2} of {3} directories on the system were successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_1">
+ <source>{2} of {3} directories and {4} of 1 symlink on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_0_dirs_2_symlinks_2">
+ <source>{2} of {3} directories and {4} of {5} symlinks on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_0">
+ <source>{0} of 1 file on the system was successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_1">
+ <source>{0} of 1 file and {4} of 1 symlink on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_0_symlinks_2">
+ <source>{0} of 1 file and {4} of {5} symlinks on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_0">
+ <source>{0} of 1 file and {2} of 1 directory on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_1">
+ <source>{0} of 1 file and {2} of 1 directory and {4} of 1 symlink on the system
were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_1_symlinks_2">
+ <source>{0} of 1 file and {2} of 1 directory and {4} of {5} symlinks on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_0">
+ <source>{0} of 1 file and {2} of {3} directories on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_1">
+ <source>{0} of 1 file and {2} of {3} directories and {4} of 1 symlink on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_1_dirs_2_symlinks_2">
+ <source>{0} of 1 file and {2} of {3} directories and {4} of {5} symlinks on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_0">
+ <source>{0} of {1} files on the system were successfully compared with
@@PRODUCT_NAME@@-Managed files. [<a href="{6}">View
Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_1">
+ <source>{0} of {1} files and {4} of 1 symlink on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_0_symlinks_2">
+ <source>{0} of {1} files and {4} of {5} symlinks on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_0">
+ <source>{0} of {1} files and {2} of 1 directory on the system were successfully
compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_1">
+ <source>{0} of {1} files and {2} of 1 directory and {4} of 1 symlink on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_1_symlinks_2">
+ <source>{0} of {1} files and {2} of 1 directory and {4} of {5} symlinks on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_0">
+ <source>{0} of {1} files and {2} of {3} directories on the system were
successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_1">
+ <source>{0} of {1} files and {2} of {3} directories and {4} of 1 symlink on the
system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.diff.files_2_dirs_2_symlinks_2">
+ <source>{0} of {1} files and {2} of {3} directories and {4} of {5} symlinks on
the system were successfully compared with @@PRODUCT_NAME@@-Managed files. [<a
href="{6}">View Details</a>]</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.differing.files_0">
+ <source>No existing files in the existing system differed from the
@@PRODUCT_NAME@@-Managed files.</source>
</trans-unit>
-
- <trans-unit id="sdc.config.differing.files_1">
- <source>1 of 1 file on the system differed from the
@@PRODUCT_NAME@@-Managed files</source>
- </trans-unit>
- <trans-unit id="sdc.config.differing.files_2">
- <source>{0} of {1} files on the system differed from the
@@PRODUCT_NAME@@-Managed files.</source>
- </trans-unit>
- </group>
+
+ <trans-unit id="sdc.config.differing.files_1">
+ <source>1 of 1 file on the system differed from the @@PRODUCT_NAME@@-Managed
files</source>
+ </trans-unit>
+
+ <trans-unit id="sdc.config.differing.files_2">
+ <source>{0} of {1} files on the system differed from the @@PRODUCT_NAME@@-Managed
files.</source>
+ </trans-unit>
+ </group>
<group>
<context-group name="sdc_actions_time_messages">