2 commits - java/spacewalk-java.spec rel-eng/packages schema/spacewalk
by Tomas Lestach
java/spacewalk-java.spec | 5 ++++-
rel-eng/packages/spacewalk-java | 2 +-
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
4 files changed, 10 insertions(+), 4 deletions(-)
New commits:
commit 9b70ade03b515c112aa651f9339a75715b4d53f4
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Nov 1 12:25:24 2010 +0100
Automatic commit of package [spacewalk-schema] release [1.2.59-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 07f1c6e..9348236 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.2.58-1 schema/spacewalk/
+1.2.59-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 820e176..3edd5e2 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 1.2.58
+Version: 1.2.59
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -59,6 +59,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-schema-upgrade*
%changelog
+* Mon Nov 01 2010 Tomas Lestach <tlestach(a)redhat.com> 1.2.59-1
+- 645702 - remove rhnPaidErrataTempCache temporary table (tlestach(a)redhat.com)
+
* Mon Nov 01 2010 Jan Pazdziora 1.2.58-1
- Missed drop of rhnSatelliteChannelFamily in schema upgrades, dropping now.
commit 526d13aec05530e83a68f48ac5b399c582389619
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Mon Nov 1 12:25:14 2010 +0100
Automatic commit of package [spacewalk-java] release [1.2.79-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index d04157e..8bace63 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -19,7 +19,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.2.78
+Version: 1.2.79
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -358,6 +358,9 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Mon Nov 01 2010 Tomas Lestach <tlestach(a)redhat.com> 1.2.79-1
+- 645702 - remove rhnPaidErrataTempCache temporary table (tlestach(a)redhat.com)
+
* Fri Oct 29 2010 Miroslav Suchý <msuchy(a)redhat.com> 1.2.78-1
- removing unused imports
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index d87979e..b420d8f 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.2.78-1 java/
+1.2.79-1 java/
13 years, 5 months
java/code schema/spacewalk
by Tomas Lestach
java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml | 7
java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml | 46 ---
java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java | 2
java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java | 152 ++++------
java/code/src/com/redhat/rhn/taskomatic/task/TaskConstants.java | 17 -
java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataMailerTest.java | 24 -
schema/spacewalk/common/tables/rhnPaidErrataTempCache.sql | 28 -
schema/spacewalk/oracle/procs/delete_errata.sql | 1
schema/spacewalk/postgres/procs/delete_errata.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/540-rhnPaidErrataTempCache.sql | 2
10 files changed, 95 insertions(+), 185 deletions(-)
New commits:
commit 8015ae73ed6bb341407ecf9edd015a874ae2fa6e
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Wed Oct 27 20:06:02 2010 +0200
645702 - remove rhnPaidErrataTempCache temporary table
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
index 6cf523f..19c39bd 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Errata_queries.xml
@@ -963,13 +963,6 @@ ORDER BY E.update_date DESC
</query>
</callable-mode>
-<write-mode name="deletePaidErrataTempCacheBulk">
- <query params="set, uid">
- delete from rhnPaidErrataTempCache where errata_id in
- (select element from rhnSet S where S.label = :set and S.user_id = :uid)
- </query>
-</write-mode>
-
<write-mode name="deleteErrataFileBulk">
<query params="set, uid">
delete from rhnErrataFile where errata_id in
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
index d9a8c36..32a9be9 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/xml/Task_queries.xml
@@ -374,11 +374,10 @@ ORDER BY next_action DESC
</query>
</write-mode>
-<write-mode name="erratamailer_fill_work_queue">
+<mode name="erratamailer_get_relevant_servers">
<query params="errata_id,org_id, channel_id">
- INSERT INTO rhnPaidErrataTempCache
- (user_id, server_id, errata_id)
- SELECT urn.user_id, snv.server_id, snv.errata_id
+ SELECT snv.server_id AS server_id, S.name, S.release, SA.name as arch,
+ urn.user_id
FROM rhnServerNeededCache snv
JOIN rhnUserReceiveNotifications urn
ON snv.server_id = urn.server_id
@@ -386,38 +385,21 @@ ORDER BY next_action DESC
ON sc.server_id = snv.server_id
JOIN rhnServer S
ON S.id = SC.server_id
+ JOIN rhnServerArch sa
+ ON s.server_arch_id = sa.id
WHERE sc.channel_id = :channel_id
AND snv.errata_id = :errata_id
AND S.org_id = :org_id
</query>
-</write-mode>
-
-<mode name="erratamailer_find_users">
- <query params="">
- SELECT distinct WC.id, WC.org_id, WC.login, WUPI.email
- FROM web_user_personal_info WUPI,
- web_contact WC,
- rhnPaidErrataTempCache PETC
- WHERE WC.id = PETC.user_id
- AND WUPI.web_user_id = WC.id
- </query>
</mode>
-<mode name="erratamailer_find_servers">
+<mode name="erratamailer_get_userinfo">
<query params="user_id">
- SELECT DISTINCT S.id, S.name, S.release, SA.name as arch, C.name base_channel
- FROM rhnChannel C,
- rhnServerChannel SC,
- rhnServer S,
- rhnServerArch SA,
- rhnPaidErrataTempCache PETC
- WHERE S.server_arch_id = SA.id
- AND S.id = PETC.server_id
- AND PETC.user_id = :user_id
- AND S.id = SC.server_id
- AND SC.channel_id = C.id
- AND C.parent_channel IS NULL
- ORDER BY 3,4,2
+ SELECT wc.id, wc.org_id, wc.login, wupi.email
+ FROM web_user_personal_info wupi,
+ web_contact wc
+ WHERE wupi.web_user_id = wc.id
+ AND wc.id = :user_id
</query>
</mode>
@@ -534,12 +516,6 @@ ORDER BY next_action DESC
</query>
</mode>
-<write-mode name="erratamailer_clean_work_queue">
- <query params="">
- DELETE FROM rhnPaidErrataTempCache
- </query>
-</write-mode>
-
<mode name="find_task_stats">
<query params="display_name">
SELECT COUNT(LABEL) as stat_exists
diff --git a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
index 90ba7f7..1efcdb7 100644
--- a/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
+++ b/java/code/src/com/redhat/rhn/manager/errata/ErrataManager.java
@@ -585,8 +585,6 @@ public class ErrataManager extends BaseManager {
List<WriteMode> modes = new LinkedList<WriteMode>();
modes.add(ModeFactory.getWriteMode("Errata_queries",
"deleteChannelErrataPackagesBulk"));
- modes.add(ModeFactory.getWriteMode("Errata_queries",
- "deletePaidErrataTempCacheBulk"));
modes.add(ModeFactory.getWriteMode("Errata_queries", "deleteErrataFileBulk"));
modes.add(ModeFactory.getWriteMode("Errata_queries", "deleteErrataPackageBulk"));
modes.add(ModeFactory.getWriteMode("Errata_queries", "deleteErrataTmpBulk"));
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java b/java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java
index 040297b..b2212cd 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/ErrataMailer.java
@@ -34,7 +34,7 @@ import org.quartz.JobExecutionException;
import java.io.PrintWriter;
import java.io.StringWriter;
-import java.util.Collections;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -59,66 +59,39 @@ public class ErrataMailer extends RhnJavaJob {
public void execute(JobExecutionContext context)
throws JobExecutionException {
- try {
- List results = getErrataToProcess();
- if (results == null || results.size() == 0) {
- if (log.isDebugEnabled()) {
- log.debug("No errata found...exiting");
- }
+ List results = getErrataToProcess();
+ if (results == null || results.size() == 0) {
+ if (log.isDebugEnabled()) {
+ log.debug("No errata found...exiting");
+ }
+ }
+ else {
+ if (log.isDebugEnabled()) {
+ log.debug("=== Queued up " + results.size() + " errata");
}
- else {
+ Map erratas = new HashMap();
+ for (Iterator iter = results.iterator(); iter.hasNext();) {
+ Map row = (Map) iter.next();
+ Long errataId = (Long) row.get("errata_id");
+ Long orgId = (Long) row.get("org_id");
+ Long channelId = (Long) row.get("channel_id");
+ markErrataDone(errataId, orgId, channelId);
if (log.isDebugEnabled()) {
- log.debug("=== Queued up " + results.size() + " errata");
+ log.debug("Processing errata " + errataId +
+ " for org " + orgId);
}
- Map erratas = new HashMap();
- WriteMode cleanUp = ModeFactory.getWriteMode(TaskConstants.MODE_NAME,
- TaskConstants.TASK_QUERY_ERRATAMAILER_CLEAN_QUEUE);
- for (Iterator iter = results.iterator(); iter.hasNext();) {
- Map row = (Map) iter.next();
- Long errataId = (Long) row.get("errata_id");
- Long orgId = (Long) row.get("org_id");
- Long channelId = (Long) row.get("channel_id");
- markErrataDone(errataId, orgId, channelId);
+ try {
+ sendEmails(errataId, orgId, channelId);
if (log.isDebugEnabled()) {
- log.debug("Processing errata " + errataId +
+ log.debug("Finished errata " + errataId +
" for org " + orgId);
}
- try {
- sendEmails(errataId, orgId, channelId);
- if (log.isDebugEnabled()) {
- log.debug("Finished errata " + errataId +
- " for org " + orgId);
- }
- }
- catch (JavaMailException e) {
- log.error("Error sending mail", e);
- }
- try {
- cleanUp.executeUpdate(Collections.EMPTY_MAP);
- HibernateFactory.commitTransaction();
- HibernateFactory.closeSession();
- }
- catch (Exception e) {
- log.error("Error cleaning up ErrataMailer queue", e);
- }
+ }
+ catch (JavaMailException e) {
+ log.error("Error sending mail", e);
}
}
}
- catch (Exception e) {
- log.error(e.getMessage(), e);
- throw new JobExecutionException(e);
- }
- finally {
- WriteMode cleanUp = ModeFactory.getWriteMode(TaskConstants.MODE_NAME,
- TaskConstants.TASK_QUERY_ERRATAMAILER_CLEAN_QUEUE);
- try {
- cleanUp.executeUpdate(Collections.EMPTY_MAP);
- }
- catch (Exception e) {
- log.error("Error cleaning up ErrataMailer queue", e);
- }
- }
-
}
protected List getErrataToProcess() {
@@ -130,8 +103,8 @@ public class ErrataMailer extends RhnJavaJob {
return results;
}
- private void markErrataDone(Long errataId, Long orgId, Long channelId)
- throws Exception {
+ private void markErrataDone(Long errataId, Long orgId, Long channelId) {
+ // throws Exception {
HibernateFactory.getSession();
WriteMode marker = ModeFactory.getWriteMode(TaskConstants.MODE_NAME,
TaskConstants.TASK_QUERY_ERRATAMAILER_MARK_ERRATA_DONE);
@@ -145,26 +118,28 @@ public class ErrataMailer extends RhnJavaJob {
}
}
- private void sendEmails(Long errataId, Long orgId, Long channelId) throws Exception {
- populateWorkQueue(errataId, orgId, channelId);
+ private void sendEmails(Long errataId, Long orgId, Long channelId) {
Errata errata = (Errata) HibernateFactory.getSession().load(PublishedErrata.class,
new Long(errataId.longValue()));
- List users = findTargetUsers();
- if (users == null || users.size() == 0) {
- log.info("No target users found for erratum " + errata.getId() +
+ List orgServers = getOrgRelevantServers(errataId, orgId, channelId);
+
+ if (orgServers == null || orgServers.size() == 0) {
+ log.info("No target servers found for erratum " + errata.getId() +
" in channel " + channelId + " for org " + orgId +
"... skipping.");
return;
}
- log.info("Found " + String.valueOf(users.size()) + " target users for erratum " +
+
+ List<Long> users = getAffectedUsers(orgServers);
+
+ log.info("Found " + String.valueOf(orgServers.size()) + " systems for erratum " +
errata.getId() + " in channel " + channelId + " for org" + orgId + ".");
- for (Iterator iter = users.iterator(); iter.hasNext();) {
- Map row = (Map) iter.next();
- String email = (String) row.get("email");
- Long userPK = (Long) row.get("id");
- List servers = findTargetServers(userPK);
- String login = (String) row.get("login");
+ for (Long userId : users) {
+ Map userInfo = getUserInfo(userId);
+ String email = (String) userInfo.get("email");
+ String login = (String) userInfo.get("login");
+ List servers = getUserServers(userId, orgServers);
String emailBody = formatEmail(login, email, errata, servers);
Mail mail = new SmtpMail();
mail.setRecipient(email);
@@ -183,32 +158,45 @@ public class ErrataMailer extends RhnJavaJob {
}
}
- private List findTargetServers(Long userPK) throws Exception {
+ private List getUserServers(Long userId, List serversIn) {
+ List userSystems = new ArrayList();
+ for (Iterator i = serversIn.iterator(); i.hasNext();) {
+ Map server = (Map) i.next();
+ if (server.get("user_id").equals(userId)) {
+ userSystems.add(server);
+ }
+ }
+ return userSystems;
+ }
+
+ private Map getUserInfo(Long userId) {
SelectMode mode = ModeFactory.getMode(TaskConstants.MODE_NAME,
- TaskConstants.TASK_QUERY_ERRATAMAILER_FIND_TARGET_SERVERS);
+ TaskConstants.TASK_QUERY_ERRATAMAILER_GET_USERINFO);
Map params = new HashMap();
- params.put("user_id", userPK);
- return mode.execute(params);
+ params.put("user_id", userId);
+ return (Map) mode.execute(params).get(0);
}
- protected List findTargetUsers() throws Exception {
- SelectMode mode = ModeFactory.getMode(TaskConstants.MODE_NAME,
- TaskConstants.TASK_QUERY_ERRATAMAILER_FIND_TARGET_USERS);
- return mode.execute(Collections.EMPTY_MAP);
+ private List<Long> getAffectedUsers(List serversIn) {
+ List<Long> users = new ArrayList<Long>();
+ for (Iterator i = serversIn.iterator(); i.hasNext();) {
+ Map row = (Map) i.next();
+ Long userId = (Long) row.get("user_id");
+ if (!users.contains(userId)) {
+ users.add(userId);
+ }
+ }
+ return users;
}
- private void populateWorkQueue(Long errataId, Long orgId, Long channelId)
- throws Exception {
- WriteMode queueWriter = ModeFactory.getWriteMode(TaskConstants.MODE_NAME,
- TaskConstants.TASK_QUERY_ERRATAMAILER_FILL_WORK_QUEUE);
+ protected List getOrgRelevantServers(Long errataId, Long orgId, Long channelId) {
+ SelectMode mode = ModeFactory.getMode(TaskConstants.MODE_NAME,
+ TaskConstants.TASK_QUERY_ERRATAMAILER_GET_RELEVANT_SERVERS);
Map params = new HashMap();
params.put("errata_id", errataId);
params.put("org_id", orgId);
params.put("channel_id", channelId);
- int workItemsFound = queueWriter.executeUpdate(params);
- if (log.isDebugEnabled()) {
- log.debug("Queuing " + workItemsFound + " rows of work");
- }
+ return mode.execute(params);
}
private String formatEmail(String login,
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/TaskConstants.java b/java/code/src/com/redhat/rhn/taskomatic/task/TaskConstants.java
index a98983b..a85c29e 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/TaskConstants.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/TaskConstants.java
@@ -105,21 +105,15 @@ public class TaskConstants {
public static final String TASK_QUERY_ERRATAMAILER_FIND_ERRATA =
"erratamailer_find_errata";
- public static final String TASK_QUERY_ERRATAMAILER_FILL_WORK_QUEUE =
- "erratamailer_fill_work_queue";
-
- public static final String TASK_QUERY_ERRATAMAILER_FIND_TARGET_USERS =
- "erratamailer_find_users";
-
- public static final String TASK_QUERY_ERRATAMAILER_FIND_TARGET_SERVERS =
- "erratamailer_find_servers";
-
- public static final String TASK_QUERY_ERRATAMAILER_CLEAN_QUEUE =
- "erratamailer_clean_work_queue";
+ public static final String TASK_QUERY_ERRATAMAILER_GET_RELEVANT_SERVERS =
+ "erratamailer_get_relevant_servers";
public static final String TASK_QUERY_ERRATAMAILER_MARK_ERRATA_DONE =
"erratamailer_mark_errata_done";
+ public static final String TASK_QUERY_ERRATAMAILER_GET_USERINFO =
+ "erratamailer_get_userinfo";
+
public static final String TASK_QUERY_REPOMD_GENERATOR_CHANNEL_PACKAGES =
"repomdgenerator_channel_packages";
@@ -142,5 +136,4 @@ public class TaskConstants {
"repomdgenerator_package_changelog";
public static final String MODE_NAME = "Task_queries";
-
}
diff --git a/java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataMailerTest.java b/java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataMailerTest.java
index 3145e99..359a065 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataMailerTest.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/task/test/ErrataMailerTest.java
@@ -35,12 +35,15 @@ public class ErrataMailerTest extends BaseTestCaseWithUser {
// We still test the majority of the stuff in ErrataMailer(), just not
// the queries that get all the users and errata.
ErrataMailer em = new ErrataMailer() {
- protected List findTargetUsers() throws Exception {
+ protected List getOrgRelevantServers(Long errataId, Long orgId,
+ Long channelId) {
List retval = new LinkedList();
Map row = new HashMap();
- row.put("id", user.getId());
- row.put("email", user.getEmail());
- row.put("login", user.getLogin());
+ row.put("server_id", 5000);
+ row.put("name", "test_client_hostname");
+ row.put("release", "test_release");
+ row.put("arch", "test_arch");
+ row.put("user_id", user.getId()); // existing user id needed
retval.add(row);
return retval;
}
@@ -57,17 +60,4 @@ public class ErrataMailerTest extends BaseTestCaseWithUser {
};
em.execute(null);
}
-
- public void testErrataQueries() throws Exception {
-
- TestErrataMailer em = new TestErrataMailer();
- assertNotNull(em.testFindUsers());
- }
-
- public class TestErrataMailer extends ErrataMailer {
-
- public List testFindUsers() throws Exception {
- return findTargetUsers();
- }
- }
}
diff --git a/schema/spacewalk/common/tables/rhnPaidErrataTempCache.sql b/schema/spacewalk/common/tables/rhnPaidErrataTempCache.sql
deleted file mode 100644
index dba8f00..0000000
--- a/schema/spacewalk/common/tables/rhnPaidErrataTempCache.sql
+++ /dev/null
@@ -1,28 +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.
---
-
-
-CREATE GLOBAL TEMPORARY TABLE rhnPaidErrataTempCache
-(
- errata_id NUMBER,
- user_id NUMBER,
- server_id NUMBER
-)
-ON COMMIT DELETE ROWS
-;
-
-CREATE INDEX rhnpec_u_idx
- ON rhnPaidErrataTempCache (user_id);
-
diff --git a/schema/spacewalk/oracle/procs/delete_errata.sql b/schema/spacewalk/oracle/procs/delete_errata.sql
index 77b9fd0..4ba390c 100644
--- a/schema/spacewalk/oracle/procs/delete_errata.sql
+++ b/schema/spacewalk/oracle/procs/delete_errata.sql
@@ -22,7 +22,6 @@ delete_errata (
) is
begin
delete from rhnServerNeededCache where errata_id = errata_id_in;
- delete from rhnPaidErrataTempCache where errata_id = errata_id_in;
delete from rhnErrataFile where errata_id = errata_id_in;
delete from rhnErrataPackage where errata_id = errata_id_in;
delete from rhnErrata where id = errata_id_in;
diff --git a/schema/spacewalk/postgres/procs/delete_errata.sql b/schema/spacewalk/postgres/procs/delete_errata.sql
index 610e59d..324c584 100644
--- a/schema/spacewalk/postgres/procs/delete_errata.sql
+++ b/schema/spacewalk/postgres/procs/delete_errata.sql
@@ -24,7 +24,6 @@ delete_errata (
$$
begin
delete from rhnServerNeededCache where errata_id = errata_id_in;
- delete from rhnPaidErrataTempCache where errata_id = errata_id_in;
delete from rhnErrataFile where errata_id = errata_id_in;
delete from rhnErrataPackage where errata_id = errata_id_in;
delete from rhnErrata where id = errata_id_in;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/540-rhnPaidErrataTempCache.sql b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/540-rhnPaidErrataTempCache.sql
new file mode 100644
index 0000000..7b048e5
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/540-rhnPaidErrataTempCache.sql
@@ -0,0 +1,2 @@
+DROP index rhnpec_u_idx;
+DROP TABLE rhnPaidErrataTempCache;
13 years, 5 months
Changes to 'refs/tags/spacewalk-schema-1.2.58-1'
by Jan Pazdziora
Tag 'spacewalk-schema-1.2.58-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-11-01 11:15 +0000
Tagging package [spacewalk-schema] version [1.2.58-1] in directory [schema/spacewalk/].
Changes since spacewalk-backend-1.2.48-1:
Jan Pazdziora (1):
Automatic commit of package [spacewalk-schema] release [1.2.58-1].
---
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
13 years, 5 months
rel-eng/packages schema/spacewalk
by Jan Pazdziora
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit bf06b10747dd5c461d8c41c9f0c8aceaf72c0ca8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Nov 1 12:15:21 2010 +0100
Automatic commit of package [spacewalk-schema] release [1.2.58-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 6e02356..07f1c6e 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.2.57-1 schema/spacewalk/
+1.2.58-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 3c8c3bd..820e176 100644
--- a/schema/spacewalk/spacewalk-schema.spec
+++ b/schema/spacewalk/spacewalk-schema.spec
@@ -2,7 +2,7 @@ Name: spacewalk-schema
Group: Applications/Internet
Summary: Oracle SQL schema for Spacewalk server
-Version: 1.2.57
+Version: 1.2.58
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -59,6 +59,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-schema-upgrade*
%changelog
+* Mon Nov 01 2010 Jan Pazdziora 1.2.58-1
+- Missed drop of rhnSatelliteChannelFamily in schema upgrades, dropping now.
+
* Fri Oct 29 2010 Jan Pazdziora 1.2.57-1
- The Oracle version and use of find_compatible_sg was changed in
b6832310938382e6f4e0f3c2d26807f4594ae96d, the comment no longer true.
13 years, 5 months
Changes to 'refs/tags/spacewalk-backend-1.2.48-1'
by Miroslav Suchý
Tag 'spacewalk-backend-1.2.48-1' created by Miroslav Suchý <msuchy(a)redhat.com> at 2010-11-01 08:57 +0000
Tagging package [spacewalk-backend] version [1.2.48-1] in directory [backend/].
Changes since spacewalk-backend-1.2.47-1:
Jan Pazdziora (1):
Missed drop of rhnSatelliteChannelFamily in schema upgrades, dropping now.
Michael Mraka (9):
moved duplicated code to a function
moved X-RHN-Action stuff into one place
merged 2 calls with just different arguments
reordered commands to put checksum stuff together
merged duplicated code into _get_package_checksum()
merged getSourcePackageChecksumBySession() to getPackageChecksumBySession()
merged getSourcePackageChecksum() into getPackageChecksum()
fixed typo and syntax error
even getPackageChecksum() and getPackageChecksumBySession() can be merged into a single function
Miroslav Suchý (3):
612581 - change egrep to grep -E
612581 - take ownership of /usr/lib/python2.7/site-packages/spacewalk/wsgi
Automatic commit of package [spacewalk-backend] release [1.2.48-1].
---
backend/server/handlers/app/packages.py | 192 +++-------
backend/server/handlers/xmlrpc/up2date.py | 141 ++-----
backend/spacewalk-backend.spec | 24 +
monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm | 2
rel-eng/packages/spacewalk-backend | 2
satellite/install/install.pl | 2
schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/274-rhnSatelliteChannelFamily-drop.sql | 3
web/modules/dobby/scripts/check-oracle-space-usage.sh | 2
8 files changed, 134 insertions(+), 234 deletions(-)
---
13 years, 5 months
3 commits - backend/spacewalk-backend.spec monitoring/PerlModules rel-eng/packages satellite/install web/modules
by Miroslav Suchý
backend/spacewalk-backend.spec | 24 +++++++++--
monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm | 2
rel-eng/packages/spacewalk-backend | 2
satellite/install/install.pl | 2
web/modules/dobby/scripts/check-oracle-space-usage.sh | 2
5 files changed, 25 insertions(+), 7 deletions(-)
New commits:
commit 342eac0be08fb95b1d34673b035bbb2e33283d7c
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Nov 1 09:57:44 2010 +0100
Automatic commit of package [spacewalk-backend] release [1.2.48-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index bbca97e..fc82408 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -11,7 +11,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2 and Python
-Version: 1.2.47
+Version: 1.2.48
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -669,6 +669,24 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Mon Nov 01 2010 Miroslav Suchý <msuchy(a)redhat.com> 1.2.48-1
+- 612581 - take ownership of /usr/lib/python2.7/site-packages/spacewalk/wsgi
+ (msuchy(a)redhat.com)
+- 612581 - change egrep to grep -E (msuchy(a)redhat.com)
+- even getPackageChecksum() and getPackageChecksumBySession() can be merged
+ into a single function (michael.mraka(a)redhat.com)
+- fixed typo and syntax error (michael.mraka(a)redhat.com)
+- merged getSourcePackageChecksum() into getPackageChecksum()
+ (michael.mraka(a)redhat.com)
+- merged getSourcePackageChecksumBySession() to getPackageChecksumBySession()
+ (michael.mraka(a)redhat.com)
+- merged duplicated code into _get_package_checksum()
+ (michael.mraka(a)redhat.com)
+- reordered commands to put checksum stuff together (michael.mraka(a)redhat.com)
+- merged 2 calls with just different arguments (michael.mraka(a)redhat.com)
+- moved X-RHN-Action stuff into one place (michael.mraka(a)redhat.com)
+- moved duplicated code to a function (michael.mraka(a)redhat.com)
+
* Fri Oct 29 2010 Jan Pazdziora 1.2.47-1
- For Function in PostgreSQL, we have to not just execute, but also fetch the
value to return.
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index ecee188..8784cdb 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.2.47-1 backend/
+1.2.48-1 backend/
commit 6c084c74475113a3a8c30f6289a9aa96990967d9
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Nov 1 09:49:02 2010 +0100
612581 - take ownership of /usr/lib/python2.7/site-packages/spacewalk/wsgi
addressing:
Main package contains empty directory
/usr/lib/python2.7/site-packages/spacewalk/wsgi and then populated
/usr/share/rhn/wsgi/. I assume this is a mistake?
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 5d7ec52..bbca97e 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -353,7 +353,7 @@ rm -f %{rhnconf}/rhnSecret.py*
%{_mandir}/man8/spacewalk-cfg-get.8.gz
# wsgi stuff
%if !( 0%{?rhel} && 0%{?rhel} < 6)
-%dir %{pythonrhnroot}/wsgi
+%dir %{rhnroot}/wsgi
%{rhnroot}/wsgi/__init__.py*
%{rhnroot}/wsgi/wsgiHandler.py*
%{rhnroot}/wsgi/wsgiRequest.py*
commit 5f34d0c0352a775331e169f1fd116a0ede1c64b6
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Nov 1 09:35:15 2010 +0100
612581 - change egrep to grep -E
addressing:
deprecated-grep: please use standard grep with proper switches
It was originally reported to backend/spacewalk-backend.spec, but
I took the liberty and change this in all other places of our code.
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 2111679..5d7ec52 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -305,7 +305,7 @@ fi
# Is secret key in our config file?
regex="^[[:space:]]*(server\.|)secret_key[[:space:]]*=.*$"
-if egrep -i $regex %{rhnconf}/rhn.conf > /dev/null 2>&1 ; then
+if grep -E -i $regex %{rhnconf}/rhn.conf > /dev/null 2>&1 ; then
# secret key already there
rm -f %{rhnconf}/rhnSecret.py*
exit 0
diff --git a/monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm b/monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm
index 9887b4c..09f7940 100644
--- a/monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm
+++ b/monitoring/PerlModules/NP/Probe/DataSource/LogAgentOutput.pm
@@ -58,7 +58,7 @@ sub init {
}
if ((!$self->error_msg) && ($regex)) {
#regex param is set, so find total number of occurences in the log
- my $grep = 'egrep -c';
+ my $grep = 'grep -E -c';
$Log->log_method(2, "Grepping log for ", $regex, " \n" );
$unix_command->execute("$grep \'$regex\' $log_file");
if ($unix_command->errors) {
diff --git a/satellite/install/install.pl b/satellite/install/install.pl
index c948229..314f931 100755
--- a/satellite/install/install.pl
+++ b/satellite/install/install.pl
@@ -288,7 +288,7 @@ sub python_path {
}
sub remove_php_packages {
- my @packages = `rpm -qa | egrep '(php|piranha|squirrelmail|specspo)'`;
+ my @packages = `rpm -qa | grep -E '(php|piranha|squirrelmail|specspo)'`;
if (@packages) {
for (@packages) {
diff --git a/web/modules/dobby/scripts/check-oracle-space-usage.sh b/web/modules/dobby/scripts/check-oracle-space-usage.sh
index 38cf37d..6ea4b48 100755
--- a/web/modules/dobby/scripts/check-oracle-space-usage.sh
+++ b/web/modules/dobby/scripts/check-oracle-space-usage.sh
@@ -16,7 +16,7 @@ export PATH
reportusage() {
# don't report UNDO usage
- /sbin/runuser oracle -c "db-control report" | egrep -v 'UNDO|TEMP'
+ /sbin/runuser oracle -c "db-control report" | grep -E -v 'UNDO|TEMP'
}
mailitout() {
13 years, 5 months
9 commits - backend/server
by Michael Mraka
backend/server/handlers/app/packages.py | 192 ++++++++++--------------------
backend/server/handlers/xmlrpc/up2date.py | 141 ++++++----------------
2 files changed, 106 insertions(+), 227 deletions(-)
New commits:
commit 1df2095dd3e17bd7ad32719b1b3029336daaf3c6
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Sep 1 23:39:34 2010 +0200
even getPackageChecksum() and getPackageChecksumBySession() can be merged into a single function
made getPackageChecksum(), getPackageChecksumBySession(), getSourcePackageChecksum()
and getSourcePackageChecksumBySession() simple wrappers around getAnyChecksum()
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 925e0a3..da66d81 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -406,7 +406,7 @@ class Packages(RPC_Base):
return 0
- def getPackageChecksum(self, username, password, info, is_source = 0):
+ def getAnyChecksum(self, info, username = None, password = None, session = None, is_source = 0):
""" returns checksum info of available packages
also does an existance check on the filesystem.
"""
@@ -421,16 +421,30 @@ class Packages(RPC_Base):
null_org=1
else:
null_org=None
- org_id, force = rhnPackageUpload.authenticate(username, password,
+
+ if not session:
+ org_id, force = rhnPackageUpload.authenticate(username, password,
channels=channels,
null_org=null_org,
force=force)
+ else:
+ try:
+ org_id, force = rhnPackageUpload.authenticate_session(
+ session, channels=channels, null_org=null_org, force=force)
+ except rhnSession.InvalidSessionError:
+ raise rhnFault(33)
+ except rhnSession.ExpiredSessionError:
+ raise rhnFault(34)
+
if is_source:
ret = self._getSourcePackageChecksum(org_id, pkg_infos)
else:
ret = self._getPackageChecksum(org_id, pkg_infos)
return ret
+ def getPackageChecksum(self, username, password, info):
+ return self.getAnyChecksum(info, username = username, password = password)
+
def getPackageMD5sum(self, username, password, info):
""" bug#177762 gives md5sum info of available packages.
also does an existance check on the filesystem.
@@ -440,31 +454,8 @@ class Packages(RPC_Base):
return self._Checksum2MD5sum_list(
self.getPackageChecksum(username, password, info))
- def getPackageChecksumBySession(self, session_string, info, is_source = 0):
- log_debug(3)
-
- pkg_infos = info.get('packages')
- channels = info.get('channels', [])
- force = info.get('force', 0)
- orgid = info.get('org_id')
-
- try:
- if orgid == 'null':
- null_org=1
- else:
- null_org=None
- org_id, force = rhnPackageUpload.authenticate_session(
- session_string, channels=channels, null_org=null_org, force=force)
- except rhnSession.InvalidSessionError:
- raise rhnFault(33)
- except rhnSession.ExpiredSessionError:
- raise rhnFault(34)
-
- if is_source:
- ret = self._getSourcePackageChecksum(org_id, pkg_infos)
- else:
- ret = self._getPackageChecksum(org_id, pkg_infos)
- return ret
+ def getPackageChecksumBySession(self, session_string, info):
+ return self.getAnyChecksum(info, session = session_string)
def getPackageMD5sumBySession(self, session_string, info):
log_debug(3)
@@ -578,7 +569,7 @@ class Packages(RPC_Base):
return row_list
def getSourcePackageChecksum(self, username, password, info):
- return getPackageChecksum(self, username, password, info, is_source = 1)
+ return self.getAnyChecksum(info, username = username, password = password, is_source = 1)
def getSourcePackageMD5sum(self, username, password, info):
log_debug(3)
@@ -587,7 +578,7 @@ class Packages(RPC_Base):
self.getSourcePackageChecksum(username, password, info))
def getSourcePackageChecksumBySession(self, session_string, info):
- return getPackageChecksumBySession(self, session_string, info, is_source = 1)
+ return self.getAnyChecksum(info, session = session_string, is_source = 1)
def getSourcePackageMD5sumBySession(self, session_string, info):
log_debug(3)
commit 1ed21aa77bdfcb6cb102481cf8c8bda78b718504
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Sep 1 23:20:08 2010 +0200
fixed typo and syntax error
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index ad6af9d..925e0a3 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -462,7 +462,7 @@ class Packages(RPC_Base):
if is_source:
ret = self._getSourcePackageChecksum(org_id, pkg_infos)
- else
+ else:
ret = self._getPackageChecksum(org_id, pkg_infos)
return ret
@@ -587,7 +587,7 @@ class Packages(RPC_Base):
self.getSourcePackageChecksum(username, password, info))
def getSourcePackageChecksumBySession(self, session_string, info):
- return getPackageChecksumBySession(self, session_string, info, source = 1)
+ return getPackageChecksumBySession(self, session_string, info, is_source = 1)
def getSourcePackageMD5sumBySession(self, session_string, info):
log_debug(3)
commit c678b742db06f6b5d204cfefd46882d4f1d3beb1
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Sep 1 23:17:57 2010 +0200
merged getSourcePackageChecksum() into getPackageChecksum()
they only differed in returning value
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 72934f3..ad6af9d 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -406,7 +406,7 @@ class Packages(RPC_Base):
return 0
- def getPackageChecksum(self, username, password, info):
+ def getPackageChecksum(self, username, password, info, is_source = 0):
""" returns checksum info of available packages
also does an existance check on the filesystem.
"""
@@ -425,7 +425,11 @@ class Packages(RPC_Base):
channels=channels,
null_org=null_org,
force=force)
- return self._getPackageChecksum(org_id, pkg_infos)
+ if is_source:
+ ret = self._getSourcePackageChecksum(org_id, pkg_infos)
+ else:
+ ret = self._getPackageChecksum(org_id, pkg_infos)
+ return ret
def getPackageMD5sum(self, username, password, info):
""" bug#177762 gives md5sum info of available packages.
@@ -574,25 +578,7 @@ class Packages(RPC_Base):
return row_list
def getSourcePackageChecksum(self, username, password, info):
- """ Uploads an RPM package """
- log_debug(3)
-
- pkg_infos = info.get('packages')
- channels = info.get('channels', [])
- force = info.get('force', 0)
- orgid = info.get('org_id')
-
- if orgid == 'null':
- org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels,
- null_org=1,
- force=force)
- else:
- org_id, force = rhnPackageUpload.authenticate(username, password,
- channels=channels,
- force=force)
-
- return self._getSourcePackageChecksum(org_id, pkg_infos)
+ return getPackageChecksum(self, username, password, info, is_source = 1)
def getSourcePackageMD5sum(self, username, password, info):
log_debug(3)
commit f2733e7ea9df14194fc36d7bb0583ac3c0f2b9b9
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Sep 1 23:14:20 2010 +0200
merged getSourcePackageChecksumBySession() to getPackageChecksumBySession()
they differed only in returning value
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 67d30bf..72934f3 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -436,7 +436,7 @@ class Packages(RPC_Base):
return self._Checksum2MD5sum_list(
self.getPackageChecksum(username, password, info))
- def getPackageChecksumBySession(self, session_string, info):
+ def getPackageChecksumBySession(self, session_string, info, is_source = 0):
log_debug(3)
pkg_infos = info.get('packages')
@@ -456,7 +456,11 @@ class Packages(RPC_Base):
except rhnSession.ExpiredSessionError:
raise rhnFault(34)
- return self._getPackageChecksum(org_id, pkg_infos)
+ if is_source:
+ ret = self._getSourcePackageChecksum(org_id, pkg_infos)
+ else
+ ret = self._getPackageChecksum(org_id, pkg_infos)
+ return ret
def getPackageMD5sumBySession(self, session_string, info):
log_debug(3)
@@ -597,27 +601,8 @@ class Packages(RPC_Base):
self.getSourcePackageChecksum(username, password, info))
def getSourcePackageChecksumBySession(self, session_string, info):
- log_debug(3)
-
- pkg_infos = info.get('packages')
- channels = info.get('channels', [])
- force = info.get('force', 0)
- orgid = info.get('org_id')
-
- try:
- if orgid == 'null':
- null_org=1
- else:
- null_org=None
- org_id, force = rhnPackageUpload.authenticate_session(
- session_string, channels=channels, null_org=null_org, force=force)
- except rhnSession.InvalidSessionError:
- raise rhnFault(33)
- except rhnSession.ExpiredSessionError:
- raise rhnFault(34)
+ return getPackageChecksumBySession(self, session_string, info, source = 1)
- return self._getSourcePackageChecksum(org_id, pkg_infos)
-
def getSourcePackageMD5sumBySession(self, session_string, info):
log_debug(3)
self._MD5sum2Checksum_info(info)
commit c1fbab1dd1e9cf3af019b1ecd8088677d0a33b70
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Aug 12 17:02:05 2010 +0200
merged duplicated code into _get_package_checksum()
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index 9d957a3..67d30bf 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -523,30 +523,30 @@ class Packages(RPC_Base):
})
h = rhnSQL.prepare(self._get_pkg_info_query % _checksum_sql_filter)
+ row_list[pkg] = self._get_package_checksum(h, query_args)
- h.execute(**query_args)
-
- row = h.fetchone_dict()
- if not row:
- row_list[pkg] = ''
- continue
-
- if row.has_key('path'):
- filePath = os.path.join(CFG.MOUNT_POINT, row['path'])
- if os.access(filePath, os.R_OK):
- if row.has_key('checksum'):
- row_list[pkg] = (row['checksum_type'], row['checksum'])
- else:
- row_list[pkg] = 'on-disk'
+ return row_list
+
+ def _get_package_checksum(self, h, query_args):
+ h.execute(**query_args)
+ row = h.fetchone_dict()
+ if not row:
+ ret = ''
+ elif row.has_key('path'):
+ filePath = os.path.join(CFG.MOUNT_POINT, row['path'])
+ if os.access(filePath, os.R_OK):
+ if row.has_key('checksum'):
+ ret = (row['checksum_type'], row['checksum'])
else:
- # Package not found on the filesystem
- log_error("Package not found", filePath)
- row_list[pkg] = ''
+ ret = 'on-disk'
else:
- log_error("Package path null for package", filePath)
- row_list[pkg] = ''
-
- return row_list
+ # Package not found on the filesystem
+ log_error("Package not found", filePath)
+ ret = ''
+ else:
+ log_error("Package path null for package", filePath)
+ ret = ''
+ return ret
def _MD5sum2Checksum_info(self, info):
log_debug(5)
@@ -651,29 +651,8 @@ class Packages(RPC_Base):
h = rhnSQL.prepare(statement)
row_list = {}
for pkg in pkg_infos.keys():
-
- h.execute(name=pkg, orgid = org_id )
-
- row = h.fetchone_dict()
- if not row:
- row_list[pkg] = ''
- continue
-
- if row.has_key('path'):
- filePath = os.path.join(CFG.MOUNT_POINT, row['path'])
- if os.access(filePath, os.R_OK):
- if row.has_key('checksum'):
- row_list[pkg] = (row['checksum_type'], row['checksum'])
- else:
- row_list[pkg] = 'on-disk'
- else:
- # Package not found on the filesystem
- log_error("Package not found", filePath)
- row_list[pkg] = ''
- else:
- log_error("Package path null for package", filePath)
- row_list[pkg] = ''
-
+ row_list[pkg] = self._get_package_checksum(h,
+ {'name':pkg, 'orgid': org_id})
return row_list
def auth(login, password):
commit 9ba82a505af07681d98cad9194ecad7ed1f4d76e
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Aug 12 16:49:08 2010 +0200
reordered commands to put checksum stuff together
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index a1a7789..9d957a3 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -500,14 +500,6 @@ class Packages(RPC_Base):
for pkg in pkg_infos.keys():
pkg_info = pkg_infos[pkg]
- _checksum_sql_filter = ""
- if pkg_info.has_key('checksum') and CFG.ENABLE_NVREA:
- checksum_exists = 1
- _checksum_sql_filter = """and c.checksum = :checksum
- and c.checksum_type = :checksum_type"""
-
- h = rhnSQL.prepare(self._get_pkg_info_query % _checksum_sql_filter)
-
pkg_epoch = None
if pkg_info['epoch'] != '':
pkg_epoch = pkg_info['epoch']
@@ -521,12 +513,17 @@ class Packages(RPC_Base):
'orgid ': org_id,
}
- if checksum_exists:
+ _checksum_sql_filter = ""
+ if pkg_info.has_key('checksum') and CFG.ENABLE_NVREA:
+ _checksum_sql_filter = """and c.checksum = :checksum
+ and c.checksum_type = :checksum_type"""
query_args.update({
'checksum_type': pkg_info['checksum_type'],
'checksum': pkg_info['checksum'],
})
+ h = rhnSQL.prepare(self._get_pkg_info_query % _checksum_sql_filter)
+
h.execute(**query_args)
row = h.fetchone_dict()
commit 5f0d45c3ceedaa4caec6fdbcf0f1f2093e8f4680
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Aug 12 16:44:58 2010 +0200
merged 2 calls with just different arguments
diff --git a/backend/server/handlers/app/packages.py b/backend/server/handlers/app/packages.py
index cdcfa9e..a1a7789 100644
--- a/backend/server/handlers/app/packages.py
+++ b/backend/server/handlers/app/packages.py
@@ -512,23 +512,23 @@ class Packages(RPC_Base):
if pkg_info['epoch'] != '':
pkg_epoch = pkg_info['epoch']
+ query_args = {
+ 'pkg_name': pkg_info['name'],
+ 'pkg_epoch': pkg_epoch,
+ 'pkg_version': pkg_info['version'],
+ 'pkg_rel': pkg_info['release'],
+ 'pkg_arch': pkg_info['arch'],
+ 'orgid ': org_id,
+ }
+
if checksum_exists:
- h.execute(pkg_name=pkg_info['name'],
- pkg_epoch=pkg_epoch,
- pkg_version=pkg_info['version'],
- pkg_rel=pkg_info['release'],
- pkg_arch=pkg_info['arch'],
- orgid = org_id,
- checksum_type = pkg_info['checksum_type'],
- checksum = pkg_info['checksum'])
- else:
- h.execute(pkg_name=pkg_info['name'],
- pkg_epoch=pkg_epoch,
- pkg_version=pkg_info['version'],
- pkg_rel=pkg_info['release'],
- pkg_arch=pkg_info['arch'],
- orgid = org_id )
+ query_args.update({
+ 'checksum_type': pkg_info['checksum_type'],
+ 'checksum': pkg_info['checksum'],
+ })
+ h.execute(**query_args)
+
row = h.fetchone_dict()
if not row:
row_list[pkg] = ''
commit 64355c4e10fe5656164ff54835fef465368f44ca
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Mon Oct 25 22:05:28 2010 +0200
moved X-RHN-Action stuff into one place
diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index 7311b9a..b34fc15 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -64,6 +64,12 @@ class Up2date(rhnHandler):
self.functions.append('solveDependencies_arch')
self.functions.append('solveDependencies_with_limits')
+ def auth_system(self, action, system_id):
+ # Stuff the action in the headers:
+ transport = rhnFlags.get('outputTransportOptions')
+ transport['X-RHN-Action'] = action
+ return rhnHandler.auth_system(self, system_id)
+
def login(self, system_id, extra_data={}):
""" Clients v2+
Log in routine.
@@ -74,7 +80,7 @@ class Up2date(rhnHandler):
# Authenticate the system certificate. We need the user record
# to generate the tokens
self.load_user = 1
- server = self.auth_system(system_id)
+ server = self.auth_system('login', system_id)
# log the entry
log_debug(1, self.server_id)
# Update the capabilities list
@@ -125,7 +131,6 @@ class Up2date(rhnHandler):
# Duplicate these values in the headers so that the proxy can
# intercept and cache them without parseing the xmlrpc.
transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'login'
for k, v in loginDict.items():
# Special case for channels
if string.lower(k) == string.lower('X-RHN-Auth-Channels'):
@@ -144,11 +149,8 @@ class Up2date(rhnHandler):
def listChannels(self, system_id):
""" Clients v2+ """
log_debug(5, system_id)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'listChannels'
# Authenticate the system certificate
- self.auth_system(system_id)
+ self.auth_system('listChannels', system_id)
# log the entry
log_debug(1, self.server_id)
channelList = rhnChannel.channels_for_server(self.server_id)
@@ -158,11 +160,8 @@ class Up2date(rhnHandler):
def subscribeChannels(self, system_id, channelNames, username, passwd):
""" Clients v2+ """
log_debug(5, system_id, channelNames, username, passwd)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'subscribeChannel'
# Authenticate the system certificate
- self.auth_system(system_id)
+ self.auth_system('subscribeChannel', system_id)
# log the entry
log_debug(1, self.server_id, channelNames)
for channelName in channelNames:
@@ -174,11 +173,8 @@ class Up2date(rhnHandler):
def unsubscribeChannels(self, system_id, channelNames, username, passwd):
""" Clients v2+ """
log_debug(3)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'unsubscribeChannel'
# Authenticate the system certificate
- self.auth_system(system_id)
+ self.auth_system('unsubscribeChannel', system_id)
# log the entry
log_debug(1, self.server_id, channelNames)
for channelName in channelNames:
@@ -195,12 +191,9 @@ class Up2date(rhnHandler):
"""
log_debug(5, system_id)
# Authenticate the system certificate
- self.auth_system(system_id)
+ self.auth_system('listall', system_id)
# log the entry
log_debug(1, self.server_id)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'listall'
# and now call into rhnChannel to find the data
return rhnChannel.list_packages_for_server(self.server_id)
@@ -213,12 +206,9 @@ class Up2date(rhnHandler):
"""
log_debug(5, system_id)
# Authenticate the system certificate
- self.auth_system(system_id)
+ self.auth_system('listall_size', system_id)
# log the entry
log_debug(1, self.server_id)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'listall_size'
# call into rhnChannel to find the data
return rhnChannel.list_packages_for_server(self.server_id,
need_size = 1)
@@ -248,7 +238,7 @@ class Up2date(rhnHandler):
for p in pkgList:
req_list.append(check_package_spec(p))
# Authenticate the system certificate
- server = self.auth_system(system_id)
+ server = self.auth_system('header', system_id)
# log the entry
log_debug(1, self.server_id, "items: %d" % len(req_list))
@@ -269,10 +259,6 @@ class Up2date(rhnHandler):
rpmHeaders.append(rpclib.xmlrpclib.Binary(h.unload()))
del h
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'header'
-
# Reset the flag for the proxy download accelerator
# This gets set by default in rhnPackage
rhnFlags.set("Download-Accelerator-Path", None)
@@ -294,17 +280,13 @@ class Up2date(rhnHandler):
# Authenticate the system certificate and set the QoS data
# according to the user type
self.set_qos = 1
- server = self.auth_system(system_id)
+ server = self.auth_system('package', system_id)
# log the entry (avoiding to fill the log in case of abuse)
log_debug(1, self.server_id, str(package)[:100])
filePath = rhnPackage.get_package_path_compat_arches(self.server_id,
package, server.archname)
-
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = "package"
return rpclib.File(open(filePath, "r"), name=filePath)
@@ -320,17 +302,13 @@ class Up2date(rhnHandler):
# Authenticate the system certificate and set the QoS data
# according to the user type
self.set_qos = 1
- server = self.auth_system(system_id)
+ server = self.auth_system('source_package', system_id)
# log the entry (avoiding to fill the log in case of abuse)
log_debug(1, self.server_id, str(package)[:100])
filePath = rhnPackage.get_source_package_path_by_nvre(self.server_id,
package)
-
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = "source_package"
return rpclib.File(open(filePath, "r"), name=filePath)
@@ -344,17 +322,13 @@ class Up2date(rhnHandler):
# Authenticate the system certificate and set the QoS data
# according to the user type
self.set_qos = 1
- server = self.auth_system(system_id)
+ server = self.auth_system('source_package_by_name', system_id)
# log the entry (avoiding to fill the log in case of abuse)
log_debug(1, self.server_id, str(filename)[:100])
filePath = rhnPackage.get_source_package_path_by_name(self.server_id,
filename)
-
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = "source_package_by_name"
return rpclib.File(open(filePath, "r"), name=filePath)
@@ -411,12 +385,9 @@ class Up2date(rhnHandler):
"""
log_debug(5, system_id, summary, body)
# Authenticate the system certificate
- server = self.auth_system(system_id)
+ server = self.auth_system('history', system_id)
# log the entry
log_debug(1, self.server_id)
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = 'history'
# XXX: Probably this should be a non fatal error...
server.add_history(summary, body)
server.save_history()
@@ -445,11 +416,8 @@ class Up2date(rhnHandler):
if not deps:
return []
# Authenticate the system certificate
- server = self.auth_system(system_id)
+ server = self.auth_system(action, system_id)
log_debug(1, self.server_id, action, "items: %d" % len(deps))
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = action
return deps
def __solveDep(self, system_id, deps, action, clientVersion):
commit 62d91f9566a9f3ba88365dde88a5b5a030c41c22
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Thu Aug 12 15:56:38 2010 +0200
moved duplicated code to a function
diff --git a/backend/server/handlers/xmlrpc/up2date.py b/backend/server/handlers/xmlrpc/up2date.py
index 006a4eb..7311b9a 100644
--- a/backend/server/handlers/xmlrpc/up2date.py
+++ b/backend/server/handlers/xmlrpc/up2date.py
@@ -425,12 +425,12 @@ class Up2date(rhnHandler):
# --- PRIVATE METHODS ---
- def __solveDep(self, system_id, deps, action, clientVersion):
+ def __solveDep_prepare(self, system_id, deps, action, clientVersion):
""" Response for clients:
version 1: list
version 2: hash
"""
- log_debug(5, system_id, deps, action, clientVersion)
+ log_debug(7, system_id, deps, action, clientVersion)
faultString = _("Invalid value %s (%s)")
if type(deps) not in (ListType, TupleType):
log_error("Invalid argument type", type(deps))
@@ -447,13 +447,22 @@ class Up2date(rhnHandler):
# Authenticate the system certificate
server = self.auth_system(system_id)
log_debug(1, self.server_id, action, "items: %d" % len(deps))
- # Solve dependencies
- result = rhnDependency.solve_dependencies(self.server_id,
- deps, clientVersion)
-
# Stuff the action in the headers:
transport = rhnFlags.get('outputTransportOptions')
transport['X-RHN-Action'] = action
+ return deps
+
+ def __solveDep(self, system_id, deps, action, clientVersion):
+ """ Response for clients:
+ version 1: list
+ version 2: hash
+ """
+ log_debug(5, system_id, deps, action, clientVersion)
+ result = self.__solveDep_prepare(system_id, deps, action, clientVersion)
+ if result:
+ # Solve dependencies
+ result = rhnDependency.solve_dependencies(self.server_id,
+ result, clientVersion)
return result
def __solveDep_arch(self, system_id, deps, action, clientVersion):
@@ -462,29 +471,11 @@ class Up2date(rhnHandler):
version 2: hash
"""
log_debug(5, system_id, deps, action, clientVersion)
- faultString = _("Invalid value %s (%s)")
- if type(deps) not in (ListType, TupleType):
- log_error("Invalid argument type", type(deps))
- raise rhnFault(30, faultString % (deps, type(deps)))
- for dep in deps:
- if type(dep) is not StringType:
- log_error("Invalid dependency member", type(dep))
- raise rhnFault(30, faultString % (dep, type(dep)))
- # Ignore empty strings
- deps = filter(len, deps)
- # anything left to do?
- if not deps:
- return []
- # Authenticate the system certificate
- server = self.auth_system(system_id)
- log_debug(1, self.server_id, action, "items: %d" % len(deps))
- # Solve dependencies
- result = rhnDependency.solve_dependencies_arch(self.server_id,
- deps, clientVersion)
-
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = action
+ result = self.__solveDep_prepare(system_id, deps, action, clientVersion)
+ if result:
+ # Solve dependencies
+ result = rhnDependency.solve_dependencies_arch(self.server_id,
+ result, clientVersion)
return result
@@ -494,29 +485,11 @@ class Up2date(rhnHandler):
version 2: hash
"""
log_debug(5, system_id, deps, action, clientVersion)
- faultString = _("Invalid value %s (%s)")
- if type(deps) not in (ListType, TupleType):
- log_error("Invalid argument type", type(deps))
- raise rhnFault(30, faultString % (deps, type(deps)))
- for dep in deps:
- if type(dep) is not StringType:
- log_error("Invalid dependency member", type(dep))
- raise rhnFault(30, faultString % (dep, type(dep)))
- # Ignore empty strings
- deps = filter(len, deps)
- # anything left to do?
- if not deps:
- return []
- # Authenticate the system certificate
- server = self.auth_system(system_id)
- log_debug(1, self.server_id, action, "items: %d" % len(deps))
- # Solve dependencies
- result = rhnDependency.solve_dependencies_with_limits(self.server_id,
+ result = self.__solveDep_prepare(system_id, deps, action, clientVersion)
+ if result:
+ # Solve dependencies
+ result = rhnDependency.solve_dependencies_with_limits(self.server_id,
deps, clientVersion, all, limit_operator, limit)
-
- # Stuff the action in the headers:
- transport = rhnFlags.get('outputTransportOptions')
- transport['X-RHN-Action'] = action
return result
def check_package_spec(package):
13 years, 5 months
schema/spacewalk
by Jan Pazdziora
schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/274-rhnSatelliteChannelFamily-drop.sql | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit be1ffb13d772b5883bfd6a53412c81a28f3c0504
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Nov 1 09:37:28 2010 +0100
Missed drop of rhnSatelliteChannelFamily in schema upgrades, dropping now.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/274-rhnSatelliteChannelFamily-drop.sql b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/274-rhnSatelliteChannelFamily-drop.sql
new file mode 100644
index 0000000..8577b5c
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.1-to-spacewalk-schema-1.2/274-rhnSatelliteChannelFamily-drop.sql
@@ -0,0 +1,3 @@
+
+drop table rhnSatelliteChannelFamily;
+
13 years, 5 months