Changes to 'refs/tags/spacewalk-backend-1.1.23-1'
by Jan Pazdziora
Tag 'spacewalk-backend-1.1.23-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-06-28 11:32 +0000
Tagging package [spacewalk-backend] version [1.1.23-1] in directory [backend/].
Changes since spacewalk-setup-1.1.4-1:
Jan Pazdziora (1):
Automatic commit of package [spacewalk-backend] release [1.1.23-1].
---
backend/spacewalk-backend.spec | 9 ++++++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
---
13 years, 9 months
backend/spacewalk-backend.spec rel-eng/packages
by Jan Pazdziora
backend/spacewalk-backend.spec | 9 ++++++++-
rel-eng/packages/spacewalk-backend | 2 +-
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 2ae4e6989f1785df6ffb8b66e568ecc4c4bfea5c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jun 28 13:32:51 2010 +0200
Automatic commit of package [spacewalk-backend] release [1.1.23-1].
diff --git a/backend/spacewalk-backend.spec b/backend/spacewalk-backend.spec
index 53e8de0..ebb38ab 100644
--- a/backend/spacewalk-backend.spec
+++ b/backend/spacewalk-backend.spec
@@ -8,7 +8,7 @@ Name: spacewalk-backend
Summary: Common programs needed to be installed on the Spacewalk servers/proxies
Group: Applications/Internet
License: GPLv2
-Version: 1.1.22
+Version: 1.1.23
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -632,6 +632,13 @@ rm -f %{rhnconf}/rhnSecret.py*
# $Id$
%changelog
+* Mon Jun 28 2010 Jan Pazdziora 1.1.23-1
+- Remove a debugging print.
+- do need to check date, we can get anything (msuchy(a)redhat.com)
+- evr should be parsed from the end (msuchy(a)redhat.com)
+- Parse the default_db; the DNS part (the one after @) is DBI-style connect
+ string.
+
* Fri Jun 18 2010 Miroslav Suchý <msuchy(a)redhat.com> 1.1.22-1
- fix rpmlint warning (msuchy(a)redhat.com)
- fix rpmlint warning (msuchy(a)redhat.com)
diff --git a/rel-eng/packages/spacewalk-backend b/rel-eng/packages/spacewalk-backend
index 6ab6115..0910373 100644
--- a/rel-eng/packages/spacewalk-backend
+++ b/rel-eng/packages/spacewalk-backend
@@ -1 +1 @@
-1.1.22-1 backend/
+1.1.23-1 backend/
13 years, 9 months
Changes to 'refs/tags/spacewalk-setup-1.1.4-1'
by Jan Pazdziora
Tag 'spacewalk-setup-1.1.4-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-06-28 11:32 +0000
Tagging package [spacewalk-setup] version [1.1.4-1] in directory [spacewalk/setup/].
Changes since spacewalk-schema-1.1.4-1:
Jan Pazdziora (1):
Automatic commit of package [spacewalk-setup] release [1.1.4-1].
---
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
---
13 years, 9 months
rel-eng/packages spacewalk/setup
by Jan Pazdziora
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 12 +++++++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
New commits:
commit 0f7dc4c283cd4ec4486cd9cca46e4da111012c9c
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jun 28 13:32:17 2010 +0200
Automatic commit of package [spacewalk-setup] release [1.1.4-1].
diff --git a/rel-eng/packages/spacewalk-setup b/rel-eng/packages/spacewalk-setup
index 0811312..67808cb 100644
--- a/rel-eng/packages/spacewalk-setup
+++ b/rel-eng/packages/spacewalk-setup
@@ -1 +1 @@
-1.1.3-1 spacewalk/setup/
+1.1.4-1 spacewalk/setup/
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 98d57ab..756d89f 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 1.1.3
+Version: 1.1.4
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
@@ -99,6 +99,16 @@ rm -rf %{buildroot}
%attr(755, apache, root) %{_var}/spacewalk
%changelog
+* Mon Jun 28 2010 Jan Pazdziora 1.1.4-1
+- The default_db has username and password in Oracle case, let's make it the
+ same for PostgreSQL.
+- Some values (db-sid) can be undef, do not pass them to rhn-config-
+ satellite.pl.
+- Some values (db-sid) can be undef, leading to warnings, there does not need
+ to be a host a port, and the default_db is different for PostgreSQL.
+- Let's do a slightly better formatting of our terminal output.
+- Fix postgresql_clear_db to clear the content of the PostgreSQL database.
+
* Mon Jun 21 2010 Jan Pazdziora 1.1.3-1
- Minor fixes for PostgreSQL code paths.
- Unused code cleanup.
13 years, 9 months
Changes to 'refs/tags/spacewalk-schema-1.1.4-1'
by Jan Pazdziora
Tag 'spacewalk-schema-1.1.4-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2010-06-28 11:31 +0000
Tagging package [spacewalk-schema] version [1.1.4-1] in directory [schema/spacewalk/].
Changes since spacewalk-admin-1.1.3-1:
Jan Pazdziora (4):
Array concatenation seems to want array_append.
Remove a debugging print.
The for does not like NULL which we get for empty ents_to_process.
Automatic commit of package [spacewalk-schema] release [1.1.4-1].
Miroslav Suchý (2):
evr should be parsed from the end
do need to check date, we can get anything
---
backend/server/rhnDependency.py | 18 +++----
backend/server/rhnSQL/__init__.py | 1
backend/server/rhnSQL/driver_cx_Oracle.py | 2
rel-eng/packages/spacewalk-schema | 2
schema/spacewalk/postgres/packages/rhn_entitlements.pkb | 38 ++++++++--------
schema/spacewalk/spacewalk-schema.spec | 9 +++
6 files changed, 38 insertions(+), 32 deletions(-)
---
13 years, 9 months
rel-eng/packages schema/spacewalk
by Jan Pazdziora
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 232daa6b935ee1c92d4b356254f0109235897c23
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Jun 28 13:31:03 2010 +0200
Automatic commit of package [spacewalk-schema] release [1.1.4-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index eae7300..87d9c39 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.1.3-1 schema/spacewalk/
+1.1.4-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index 3fa13b4..7756d08 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.1.3
+Version: 1.1.4
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -58,6 +58,13 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-schema-upgrade*
%changelog
+* Mon Jun 28 2010 Jan Pazdziora 1.1.4-1
+- The for does not like NULL which we get for empty ents_to_process.
+- Array concatenation seems to want array_append.
+- Fix cursors in PostgreSQL version of prune_group.
+- Use AS with column alias.
+- TOP declaration seems to be needed, for Makefile to be useful at all.
+
* Mon Jun 21 2010 Jan Pazdziora 1.1.3-1
- updating rhnPackageRepodata table to not use a reserved word.
(jsherril(a)redhat.com)
13 years, 9 months
3 commits - backend/server schema/spacewalk
by Jan Pazdziora
backend/server/rhnSQL/__init__.py | 1
schema/spacewalk/postgres/packages/rhn_entitlements.pkb | 38 ++++++++--------
2 files changed, 19 insertions(+), 20 deletions(-)
New commits:
commit f0846f730d8a7a1e581f86b0a8d080a7d093cc4f
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Jun 25 14:50:33 2010 +0200
The for does not like NULL which we get for empty ents_to_process.
Addressing
ProgrammingError: ERROR: upper bound of FOR loop cannot be null
CONTEXT: PL/pgSQL function "modify_org_service" line 111 at FOR with integer loop variable
diff --git a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
index 3822b5e..370a481 100644
--- a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
@@ -850,7 +850,7 @@ as $$
end loop;
end loop;
else
- for i in 1..array_upper(ents_to_process, 1) loop
+ for i in 1..coalesce(array_upper(ents_to_process, 1), 0) loop
for ent in ents(ents_to_process[i]) loop
delete from rhnOrgEntitlements
where org_id = org_id_in
commit 2fb5c42fa7658a51bcbe1e063f9d439ef86a0f53
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Jun 25 13:59:27 2010 +0200
Remove a debugging print.
diff --git a/backend/server/rhnSQL/__init__.py b/backend/server/rhnSQL/__init__.py
index e7c7df2..dea1bd3 100644
--- a/backend/server/rhnSQL/__init__.py
+++ b/backend/server/rhnSQL/__init__.py
@@ -96,7 +96,6 @@ def initDB(dsn=None, backend=ORACLE, host="localhost", port=None, username=None,
host = None
port = None
dsn = CFG.DEFAULT_DB
- print "dsn [%s]" % dsn
(username, temp) = dsn.split("/")
(password, dsn) = temp.split("@")
for i in dsn.split(';'):
commit 23300bb8e740f2aa7806946cc07cddda712b2692
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Jun 25 13:57:49 2010 +0200
Array concatenation seems to want array_append.
Addressing
ProgrammingError: ERROR: operator is not unique: character varying[] || unknown
LINE 1: SELECT $1 || 'rhn_virtualization_platform'
^
HINT: Could not choose a best candidate operator. You might need to add explicit type casts.
QUERY: SELECT $1 || 'rhn_virtualization_platform'
CONTEXT: PL/pgSQL function "modify_org_service" line 65 at assignment
diff --git a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
index 225561b..3822b5e 100644
--- a/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_entitlements.pkb
@@ -775,41 +775,41 @@ as $$
-- worse than the old code...
if service_label_in = 'enterprise' or
service_label_in = 'management' then
- ents_to_process := ents_to_process || 'sw_mgr_enterprise';
+ ents_to_process := array_append(ents_to_process, 'sw_mgr_enterprise');
- roles_to_process := roles_to_process || 'org_admin';
+ roles_to_process := array_append(roles_to_process, 'org_admin');
- roles_to_process := roles_to_process || 'system_group_admin';
+ roles_to_process := array_append(roles_to_process, 'system_group_admin');
- roles_to_process := roles_to_process || 'activation_key_admin';
+ roles_to_process := array_append(roles_to_process, 'activation_key_admin');
- roles_to_process := roles_to_process || 'org_applicant';
+ roles_to_process := array_append(roles_to_process, 'org_applicant');
elsif service_label_in = 'provisioning' then
- ents_to_process := ents_to_process || 'rhn_provisioning';
+ ents_to_process := array_append(ents_to_process, 'rhn_provisioning');
- roles_to_process := roles_to_process || 'system_group_admin';
+ roles_to_process := array_append(roles_to_process, 'system_group_admin');
- roles_to_process := roles_to_process || 'activation_key_admin';
+ roles_to_process := array_append(roles_to_process, 'activation_key_admin');
- roles_to_process := roles_to_process || 'config_admin';
+ roles_to_process := array_append(roles_to_process, 'config_admin');
-- another nasty special case...
if enable_in = 'Y' then
- ents_to_process := ents_to_process || 'sw_mgr_enterprise';
+ ents_to_process := array_append(ents_to_process, 'sw_mgr_enterprise');
end if;
elsif service_label_in = 'monitoring' then
- ents_to_process := ents_to_process || 'rhn_monitor';
+ ents_to_process := array_append(ents_to_process, 'rhn_monitor');
- roles_to_process := roles_to_process || 'monitoring_admin';
+ roles_to_process := array_append(roles_to_process, 'monitoring_admin');
elsif service_label_in = 'virtualization' then
- ents_to_process := ents_to_process || 'rhn_virtualization';
+ ents_to_process := array_append(ents_to_process, 'rhn_virtualization');
- roles_to_process := roles_to_process || 'config_admin';
+ roles_to_process := array_append(roles_to_process, 'config_admin');
elsif service_label_in = 'virtualization_platform' then
- ents_to_process := ents_to_process || 'rhn_virtualization_platform';
- roles_to_process := roles_to_process || 'config_admin';
+ ents_to_process := array_append(ents_to_process, 'rhn_virtualization_platform');
+ roles_to_process := array_append(roles_to_process, 'config_admin');
elsif service_label_in = 'nonlinux' then
- ents_to_process := ents_to_process || 'rhn_nonlinux';
- roles_to_process := roles_to_process || 'config_admin';
+ ents_to_process := array_append(ents_to_process, 'rhn_nonlinux');
+ roles_to_process := array_append(roles_to_process, 'config_admin');
end if;
if enable_in = 'Y' then
13 years, 9 months
Branch 'taskomatic' - 4 commits - java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/xmlrpc/taskomatic/TaskomaticOrgHandler.java | 35 ++
java/code/src/com/redhat/rhn/manager/satellite/SystemCommandExecutor.java | 1
java/code/src/com/redhat/rhn/taskomatic/TaskoJob.java | 140 ++++++++++
java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.java | 77 -----
java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java | 2
java/code/src/com/redhat/rhn/taskomatic/core/RhnJobFactory.java | 9
java/code/src/com/redhat/rhn/taskomatic/core/SchedulerKernel.java | 12
7 files changed, 186 insertions(+), 90 deletions(-)
New commits:
commit 8e6cdf72d1150408118b8d32d3ad0c81d4446d40
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Sun Jun 27 00:37:14 2010 +0200
add '\n' after every line when converting input stream to string
diff --git a/java/code/src/com/redhat/rhn/manager/satellite/SystemCommandExecutor.java b/java/code/src/com/redhat/rhn/manager/satellite/SystemCommandExecutor.java
index 83310c3..bdfea75 100644
--- a/java/code/src/com/redhat/rhn/manager/satellite/SystemCommandExecutor.java
+++ b/java/code/src/com/redhat/rhn/manager/satellite/SystemCommandExecutor.java
@@ -116,6 +116,7 @@ public class SystemCommandExecutor implements Executor {
String line;
while ((line = input.readLine()) != null) {
sb.append(line);
+ sb.append('\n');
}
}
catch (IOException e) {
commit 1de8a1c3f32661d267b7b2ef3646886c1f54293c
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Sun Jun 27 00:27:19 2010 +0200
introduce TaskoJob as the main schedule executor class
TaskoSchedule cannot be the main executor class, because it's a hibernate DTO and hibenrate would block all the other threads touching TaskoSchedule
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoJob.java b/java/code/src/com/redhat/rhn/taskomatic/TaskoJob.java
new file mode 100644
index 0000000..3b9ae41
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoJob.java
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 2008 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.taskomatic;
+
+import com.redhat.rhn.common.hibernate.HibernateFactory;
+
+import org.apache.log4j.Logger;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class TaskoJob implements Job {
+
+ private static Logger log = Logger.getLogger(TaskoJob.class);
+ private static Map<String, Integer> tasks = new HashMap<String, Integer>();
+ private static Map<String, Object> locks = new HashMap<String, Object>();
+
+ private Long scheduleId;
+
+ static {
+ for (TaskoTask task : TaskoFactory.listTasks()) {
+ tasks.put(task.getName(), 0);
+ locks.put(task.getName(), new Object());
+ }
+ }
+
+ public TaskoJob(Long scheduleIdIn) {
+ setScheduleId(scheduleIdIn);
+ }
+
+ private boolean isTaskRunning(TaskoTask task) {
+ return tasks.get(task.getName()) > 0;
+ }
+
+ synchronized private static void markTaskRunning(TaskoTask task) {
+ int count = tasks.get(task.getName());
+ count++;
+ tasks.put(task.getName(), count);
+ }
+
+ synchronized private static void unmarkTaskRunning(TaskoTask task) {
+ int count = tasks.get(task.getName());
+ count--;
+ tasks.put(task.getName(), count);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void execute(JobExecutionContext context)
+ throws JobExecutionException {
+ TaskoRun previousRun = null;
+
+ TaskoSchedule schedule = TaskoFactory.lookupScheduleById(scheduleId);
+ if (schedule == null) {
+ log.error("No such schedule with id " + scheduleId);
+ }
+
+ log.info(schedule.getJobLabel() + ":" + " bunch " + schedule.getBunch().getName() +
+ " started");
+
+ // wait until the same schedule finishes
+ //synchronized (schedule) {
+ for (TaskoTemplate template : schedule.getBunch().getTemplates()) {
+ if ((previousRun == null) ||
+ (previousRun.getStatus() == template.getStartIf())) {
+ TaskoTask task = template.getTask();
+
+ Object lock = locks.get(task.getName());
+ synchronized (lock) {
+ if (!TaskoFactory.isTaskParalelizable(task)) {
+ while (isTaskRunning(task)) {
+ log.debug(schedule.getJobLabel() + ":" + " task " + task.getName() +
+ " currenty running ... WAITING");
+ // TaskoFactory.sleep(10000);
+ try {
+ lock.wait();
+ log.debug(schedule.getJobLabel() + ":" + " task " + task.getName() +
+ " ... AWAKE");
+ }
+ catch (InterruptedException e) {
+ // ok
+ }
+ }
+ }
+ markTaskRunning(task);
+ log.debug(schedule.getJobLabel() + ":" + " task " + task.getName() +
+ " STARTED");
+ TaskoRun taskRun = new TaskoRun(schedule.getOrgId(), template, scheduleId);
+ TaskoFactory.save(taskRun);
+ taskRun.execute(context);
+ TaskoFactory.commitTransaction();
+ log.debug(task.getName() +
+ " (" + schedule.getJobLabel() + ") ... " + taskRun.getStatus());
+ previousRun = taskRun;
+ unmarkTaskRunning(task);
+ lock.notify();
+ }
+ }
+ else {
+ log.info("Interrupting " + schedule.getBunch().getName() +
+ " (" + schedule.getJobLabel() + ")");
+ break;
+ }
+ }
+ HibernateFactory.closeSession();
+ //}
+ log.info(schedule.getJobLabel() + ":" + " bunch " + schedule.getBunch().getName() +
+ " finished");
+ }
+
+ /**
+ * @param scheduleId The scheduleId to set.
+ */
+ public void setScheduleId(Long scheduleIdIn) {
+ this.scheduleId = scheduleIdIn;
+ }
+
+ /**
+ * @return Returns the scheduleId.
+ */
+ public Long getScheduleId() {
+ return scheduleId;
+ }
+}
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.java b/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.java
index f48463c..d64eef5 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoSchedule.java
@@ -14,13 +14,7 @@
*/
package com.redhat.rhn.taskomatic;
-import com.redhat.rhn.common.hibernate.HibernateFactory;
-
-import org.apache.log4j.Logger;
import org.hibernate.Hibernate;
-import org.quartz.Job;
-import org.quartz.JobExecutionContext;
-import org.quartz.JobExecutionException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -30,14 +24,10 @@ import java.io.ObjectOutputStream;
import java.sql.Blob;
import java.sql.SQLException;
import java.util.Date;
-import java.util.HashMap;
import java.util.Map;
-public class TaskoSchedule implements Job {
-
- private static Logger log = Logger.getLogger(TaskoBunch.class);
- private static Map<String, Integer> tasks = new HashMap<String, Integer>();
+public class TaskoSchedule {
private Long id;
private String jobLabel;
@@ -50,12 +40,6 @@ public class TaskoSchedule implements Job {
private Date created;
private Date modified;
- static {
- for (TaskoTask task : TaskoFactory.listTasks()) {
- tasks.put(task.getName(), 0);
- }
- }
-
public TaskoSchedule() {
}
@@ -81,65 +65,6 @@ public class TaskoSchedule implements Job {
}
}
- private boolean isTaskRunning(TaskoTask task) {
- return tasks.get(task.getName()) > 0;
- }
-
- private void markTaskRunning(TaskoTask task) {
- synchronized (getClass()) {
- int count = tasks.get(task.getName());
- count++;
- tasks.put(task.getName(), count);
- }
- }
-
- private void unmarkTaskRunning(TaskoTask task) {
- synchronized (getClass()) {
- int count = tasks.get(task.getName());
- count--;
- tasks.put(task.getName(), count);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public void execute(JobExecutionContext context)
- throws JobExecutionException {
- TaskoRun previousRun = null;
-
- log.info("Starting " + bunch.getName() + " (" + jobLabel + ") at " + new Date());
-
- for (TaskoTemplate template : bunch.getTemplates()) {
- if ((previousRun == null) ||
- (previousRun.getStatus() == template.getStartIf())) {
-
- if (!TaskoFactory.isTaskParalelizable(template.getTask())) {
- while (isTaskRunning(template.getTask())) {
- log.info("Task " + template.getTask().getName() +
- " currently executing. Sleeping for 10 secs.");
- TaskoFactory.sleep(10000);
- }
- }
- markTaskRunning(template.getTask());
- TaskoRun taskRun = new TaskoRun(this.orgId, template, this.id);
- TaskoFactory.save(taskRun);
- taskRun.execute(context);
- TaskoFactory.commitTransaction();
- unmarkTaskRunning(template.getTask());
- log.debug(template.getTask().getName() + " ... " + taskRun.getStatus());
- previousRun = taskRun;
- }
- else {
- log.info("Interrupting " + bunch.getName() + " (" + jobLabel + ")");
- break;
- }
- }
- HibernateFactory.closeSession();
-
- log.info("Finishing " + bunch.getName() + " (" + jobLabel + ") at " + new Date());
- }
-
public void unschedule() {
setActiveTill(new Date());
}
diff --git a/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java b/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
index 2124216..73d5421 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/TaskoXmlRpcHandler.java
@@ -193,7 +193,7 @@ public class TaskoXmlRpcHandler {
}
// create job
JobDetail jobDetail = new JobDetail(schedule.getJobLabel(),
- schedule.getOrgId().toString(), TaskoSchedule.class);
+ schedule.getOrgId().toString(), TaskoJob.class);
// set job params
jobDetail.getJobDataMap().putAll(schedule.getDataMap());
jobDetail.getJobDataMap().put("schedule_id", schedule.getId());
diff --git a/java/code/src/com/redhat/rhn/taskomatic/core/RhnJobFactory.java b/java/code/src/com/redhat/rhn/taskomatic/core/RhnJobFactory.java
index a95d992..7eefc1d 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/core/RhnJobFactory.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/core/RhnJobFactory.java
@@ -14,7 +14,7 @@
*/
package com.redhat.rhn.taskomatic.core;
-import com.redhat.rhn.taskomatic.TaskoFactory;
+import com.redhat.rhn.taskomatic.TaskoJob;
import com.redhat.rhn.taskomatic.TaskoSchedule;
import org.quartz.Job;
@@ -37,11 +37,6 @@ public class RhnJobFactory implements JobFactory {
TaskoSchedule schedule = null;
Long scheduleId = trigger.getJobDetail().getJobDataMap().getLong("schedule_id");
- schedule = TaskoFactory.lookupScheduleById(scheduleId);
- if (schedule == null) {
- throw new SchedulerException("No such schedule with id " + scheduleId);
- }
-
- return schedule;
+ return new TaskoJob(scheduleId);
}
}
commit 8017a9e3e5c4a7496e4b869e060d4802cd00d4ef
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Sun Jun 27 00:26:47 2010 +0200
adding org handler
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/taskomatic/TaskomaticOrgHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/taskomatic/TaskomaticOrgHandler.java
new file mode 100644
index 0000000..e7848db
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/taskomatic/TaskomaticOrgHandler.java
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2010 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+package com.redhat.rhn.frontend.xmlrpc.taskomatic;
+
+import com.redhat.rhn.domain.role.RoleFactory;
+import com.redhat.rhn.domain.user.User;
+
+import java.util.List;
+
+
+/**
+ * TaskomaticOrgHandler
+ * @version $Rev$
+ */
+public class TaskomaticOrgHandler extends TaskomaticHandler {
+ protected void checkUserRole(User user) {
+ ensureUserRole(user, RoleFactory.ORG_ADMIN);
+ }
+
+ protected void addParameters(User user, List params) {
+ params.add(0, user.getOrg().getId());
+ }
+}
commit 595b3572977533955851bbd8da396e66eaa3e655
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Sun Jun 27 00:24:52 2010 +0200
rename chainedJobListener to chainedTriggerListener
because it is a trigger listener
diff --git a/java/code/src/com/redhat/rhn/taskomatic/core/SchedulerKernel.java b/java/code/src/com/redhat/rhn/taskomatic/core/SchedulerKernel.java
index 3cf7548..41935fe 100644
--- a/java/code/src/com/redhat/rhn/taskomatic/core/SchedulerKernel.java
+++ b/java/code/src/com/redhat/rhn/taskomatic/core/SchedulerKernel.java
@@ -46,7 +46,7 @@ public class SchedulerKernel {
private static SchedulerFactory factory = null;
private static Scheduler scheduler = null;
private static TaskoXmlRpcServer xmlrpcServer = null;
- private ChainedListener chainedJobListener = null;
+ private ChainedListener chainedTriggerListener = null;
private String dataSourceConfigPath = "org.quartz.jobStore.dataSource";
private String dataSourcePrefix = "org.quartz.dataSource";
private String defaultDataSource = "rhnDs";
@@ -84,12 +84,12 @@ public class SchedulerKernel {
SchedulerKernel.scheduler.setJobFactory(new RhnJobFactory());
// Setup TriggerListener chain
- this.chainedJobListener = new ChainedListener();
- this.chainedJobListener.addListener(new TaskEnvironmentListener());
- this.chainedJobListener.addListener(new LoggingListener());
+ this.chainedTriggerListener = new ChainedListener();
+ this.chainedTriggerListener.addListener(new TaskEnvironmentListener());
+ this.chainedTriggerListener.addListener(new LoggingListener());
try {
- SchedulerKernel.scheduler.addTriggerListener(this.chainedJobListener);
+ SchedulerKernel.scheduler.addTriggerListener(this.chainedTriggerListener);
}
catch (SchedulerException e) {
throw new ConfigException(e.getLocalizedMessage(), e);
@@ -196,7 +196,7 @@ public class SchedulerKernel {
trigger = new CronTrigger(jobImpl,
TaskomaticConstants.TASK_GROUP, crontab);
trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING);
- trigger.addTriggerListener(this.chainedJobListener.getName());
+ trigger.addTriggerListener(this.chainedTriggerListener.getName());
this.scheduler.scheduleJob(detail, trigger);
if (log.isDebugEnabled()) {
log.debug("Scheduled " + detail.getFullName());
13 years, 9 months
Branch 'fve' - 3 commits - backend/server
by Partha Aji
backend/server/rhnDependency.py | 18 +++++++++---------
backend/server/rhnSQL/driver_cx_Oracle.py | 2 +-
2 files changed, 10 insertions(+), 10 deletions(-)
New commits:
commit 71f06a1a3f547f438d5c93bd8d84dcc3f00f15ce
Merge: 4ab5729... 207518c...
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Jun 25 19:08:40 2010 -0400
Merge branch 'master' into fve
commit 207518cf37a3e9c909b279f7ec49c049e4c45b21
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 24 14:37:40 2010 +0200
do need to check date, we can get anything
diff --git a/backend/server/rhnSQL/driver_cx_Oracle.py b/backend/server/rhnSQL/driver_cx_Oracle.py
index dba0a32..4ea0096 100644
--- a/backend/server/rhnSQL/driver_cx_Oracle.py
+++ b/backend/server/rhnSQL/driver_cx_Oracle.py
@@ -482,7 +482,7 @@ class Database(sql_base.Database):
def check_connection(self):
try:
- h = self.prepare("select sysdate as ID from dual")
+ h = self.prepare("select 1 from dual")
h.execute()
except: # try to reconnect, that one MUST WORK always
log_error("DATABASE CONNECTION TO '%s' LOST" % self.dbtxt,
commit 23d5fa8a83df5898cf88a4f7bb941d754bda7974
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Thu Jun 24 14:06:19 2010 +0200
evr should be parsed from the end
addressing incorectly parsing of packages with - in name. eg:
>>> rhnDependency.make_evr(systemtap-runtime-0.5.12-1)
{'release': '0.5.12', 'epoch': None, 'version': 'runtime', 'name': 'systemtap'}
diff --git a/backend/server/rhnDependency.py b/backend/server/rhnDependency.py
index 111f088..a7be48c 100644
--- a/backend/server/rhnDependency.py
+++ b/backend/server/rhnDependency.py
@@ -339,18 +339,18 @@ def make_evr(nvre):
if string.find(holder[0], '-') != -1:
holder[0] = string.split(holder[0], '-')
ret = {
- 'name' : holder[0][0],
- 'version' : holder[0][1],
- 'release' : holder[0][2],
+ 'name' : '-'.join(holder[0][:-2]),
+ 'version' : holder[0][-2],
+ 'release' : holder[0][-1],
'epoch' : holder[1]
}
return ret
elif string.find(holder[1], '-') != -1:
holder[1] = string.split(holder[1], '-')
ret = {
- 'name' : holder[1][0],
- 'version' : holder[1][1],
- 'release' : holder[1][2],
+ 'name' : '-'.join(holder[1][:-2]),
+ 'version' : holder[1][-2],
+ 'release' : holder[1][-1],
'epoch' : holder[0]
}
return ret
@@ -360,9 +360,9 @@ def make_evr(nvre):
elif string.find(nvre, '-') != -1:
nvre = string.split(nvre, '-')
ret = {
- 'name' : nvre[0],
- 'version' : nvre[1],
- 'release' : nvre[2],
+ 'name' : '-'.join(nvre[:-2]),
+ 'version' : nvre[-2],
+ 'release' : nvre[-1],
'epoch' : None
}
return ret
13 years, 9 months
Branch 'fve' - java/code
by Partha Aji
java/code/src/com/redhat/rhn/domain/server/test/HostBuilder.java | 21 +
java/code/src/com/redhat/rhn/manager/system/test/VirtualizationEntitlementsManagerTest.java | 137 ++++------
2 files changed, 84 insertions(+), 74 deletions(-)
New commits:
commit 4ab5729d173d615f98599e0d32d347a25f7a641b
Author: Partha Aji <paji(a)redhat.com>
Date: Fri Jun 25 18:53:42 2010 -0400
Added more tests on Orphaned gets entitlements
diff --git a/java/code/src/com/redhat/rhn/domain/server/test/HostBuilder.java b/java/code/src/com/redhat/rhn/domain/server/test/HostBuilder.java
index 61fa278..c2b2b17 100644
--- a/java/code/src/com/redhat/rhn/domain/server/test/HostBuilder.java
+++ b/java/code/src/com/redhat/rhn/domain/server/test/HostBuilder.java
@@ -28,6 +28,8 @@ import org.hibernate.Session;
import java.util.Date;
import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
@@ -40,7 +42,7 @@ public class HostBuilder {
private User owner;
private Server host;
-
+
public HostBuilder(User theOwner) {
owner = theOwner;
}
@@ -159,9 +161,11 @@ public class HostBuilder {
return this;
}
- private void createGuests(int numberOfGuests, boolean register) throws Exception {
+ private List<VirtualInstance> createGuests(int numberOfGuests,
+ boolean register) throws Exception {
VirtualInstance virtualInstance = null;
Server guest = null;
+ List<VirtualInstance> guests = new LinkedList<VirtualInstance>();
for (int i = 0; i < numberOfGuests; ++i) {
virtualInstance = new VirtualInstance();
@@ -172,11 +176,18 @@ public class HostBuilder {
ServerFactoryTest.TYPE_SERVER_NORMAL , new Date());
virtualInstance.setGuestSystem(guest);
}
-
- host.addGuest(virtualInstance);
- TestUtils.saveAndFlush(host);
+ if (host != null) {
+ host.addGuest(virtualInstance);
+ TestUtils.saveAndFlush(host);
+ }
TestUtils.saveAndFlush(guest);
+ guests.add(virtualInstance);
}
+ return guests;
+ }
+
+ public List<VirtualInstance> withOrphanedGuests(int numberOfGuests) throws Exception {
+ return createGuests(numberOfGuests, true);
}
}
diff --git a/java/code/src/com/redhat/rhn/manager/system/test/VirtualizationEntitlementsManagerTest.java b/java/code/src/com/redhat/rhn/manager/system/test/VirtualizationEntitlementsManagerTest.java
index 9e5dca4..448a541 100644
--- a/java/code/src/com/redhat/rhn/manager/system/test/VirtualizationEntitlementsManagerTest.java
+++ b/java/code/src/com/redhat/rhn/manager/system/test/VirtualizationEntitlementsManagerTest.java
@@ -43,6 +43,7 @@ import com.redhat.rhn.testing.UserTestUtils;
import org.apache.commons.lang.RandomStringUtils;
+import java.util.Collection;
import java.util.List;
@@ -76,37 +77,8 @@ public class VirtualizationEntitlementsManagerTest extends RhnBaseTestCase {
UpdateOrgSoftwareEntitlementsCommand(rhelFamily.getLabel(),
org, ents, flexEnts);
assertNull(cmd2.store());
- Channel rhelChannel = ChannelFactoryTest.createBaseChannel(user, rhelFamily);
-
-
- HibernateFactory.getSession().clear();
- rhelChannel = ChannelFactory.lookupById(rhelChannel.getId());
- assertNotNull(rhelChannel.getId());
- assertNotNull(rhelChannel);
-
- rhelFamily = ChannelFamilyFactory.lookupById(rhelFamily.getId());
- assertNotNull(rhelFamily);
- assertNotNull(rhelFamily.getMaxFlex(org));
- assertEquals(Long.valueOf(flexEnts), rhelFamily.getMaxFlex(org));
-
- HostBuilder builder = new HostBuilder(org.getActiveOrgAdmins().get(0));
- builder.createNonVirtHost().withGuests(guestsToCreate);
- Server host = builder.build();
- ServerFactory.save(host);
-
- SystemManager.subscribeServerToChannel(user, host, rhelChannel);
-
- ServerFactory.save(host);
-
- for (VirtualInstance inst : host.getGuests()) {
- SystemManager.subscribeServerToChannel(user,
- inst.getGuestSystem(), rhelChannel);
- SystemManager.entitleServer(inst.getGuestSystem(),
- EntitlementManager.MANAGEMENT);
- ServerFactory.save(inst.getGuestSystem());
- }
-
- HibernateFactory.getSession().clear();
+ rhelFamily = setupGuests(org, user, guestsToCreate,
+ flexEnts, rhelFamily, true);
//Verify everything is as it should be
@@ -125,8 +97,19 @@ public class VirtualizationEntitlementsManagerTest extends RhnBaseTestCase {
assertEquals(1, l.size());
assertEquals(guestsToCreate, l.get(0).expand().size());
}
+
+
+ public void testNonVirtHostEligibleFlexGuests() throws Exception {
+ executeEligibleGuestTests(false);
+ }
+
+ public void testOrphanedEligibleFlexGuests() throws Exception {
+ executeEligibleGuestTests(true);
+ }
+
+
- public void testListEligibleFlexGuests() throws Exception {
+ private void executeEligibleGuestTests(boolean isOrphaned) throws Exception {
Org org = UserTestUtils.createNewOrgFull(RandomStringUtils.randomAlphabetic(10));
User user = UserTestUtils.createUser(RandomStringUtils.randomAlphabetic(10),
org.getId());
@@ -134,8 +117,12 @@ public class VirtualizationEntitlementsManagerTest extends RhnBaseTestCase {
UserFactory.save(user);
int guestsToCreate = 6;
long flexEnts = guestsToCreate;
- long ents = guestsToCreate + 1; //+ 1 for host
- long sysEnts = guestsToCreate + 1; //+ 1 for host
+ long ents = guestsToCreate;
+ long sysEnts = guestsToCreate; //+ 1 for host
+ if (!isOrphaned) {
+ ents++;
+ sysEnts++;
+ }
//Give it some system entitlements
UpdateOrgSystemEntitlementsCommand cmd1 = new UpdateOrgSystemEntitlementsCommand(
EntitlementManager.MANAGEMENT, org, sysEnts);
@@ -152,37 +139,7 @@ public class VirtualizationEntitlementsManagerTest extends RhnBaseTestCase {
UpdateOrgSoftwareEntitlementsCommand(rhelFamily.getLabel(),
org, ents, 0L);
assertNull(cmd2.store());
- Channel rhelChannel = ChannelFactoryTest.createBaseChannel(user, rhelFamily);
-
-
- HibernateFactory.getSession().clear();
- rhelChannel = ChannelFactory.lookupById(rhelChannel.getId());
- assertNotNull(rhelChannel.getId());
- assertNotNull(rhelChannel);
-
- rhelFamily = ChannelFamilyFactory.lookupById(rhelFamily.getId());
- assertNotNull(rhelFamily);
- assertNotNull(rhelFamily.getMaxFlex(org));
- assertEquals(Long.valueOf(0), rhelFamily.getMaxFlex(org));
-
- HostBuilder builder = new HostBuilder(org.getActiveOrgAdmins().get(0));
- builder.createNonVirtHost().withGuests(guestsToCreate);
- Server host = builder.build();
- ServerFactory.save(host);
-
- SystemManager.subscribeServerToChannel(user, host, rhelChannel);
-
- ServerFactory.save(host);
- for (VirtualInstance inst : host.getGuests()) {
- SystemManager.subscribeServerToChannel(user,
- inst.getGuestSystem(), rhelChannel);
- SystemManager.entitleServer(inst.getGuestSystem(),
- EntitlementManager.MANAGEMENT);
- ServerFactory.save(inst.getGuestSystem());
- }
-
- HibernateFactory.getSession().clear();
-
+ rhelFamily = setupGuests(org, user, guestsToCreate, 0, rhelFamily, !isOrphaned);
//Verify everything is as it should be
EntitlementServerGroup mgmnt =
@@ -209,12 +166,54 @@ public class VirtualizationEntitlementsManagerTest extends RhnBaseTestCase {
List<ChannelFamilySystemGroup> l = VirtualizationEntitlementsManager.
getInstance().listEligibleFlexGuests(user);
-
-
assertTrue(!l.isEmpty());
assertEquals(1, l.size());
- assertEquals(guestsToCreate, l.get(0).expand().size());
- }
+ assertEquals(guestsToCreate, l.get(0).expand().size());
+ }
+ private ChannelFamily setupGuests(Org org, User user,
+ int guestsToCreate, long flexEnts, ChannelFamily rhelFamily,
+ boolean addNonVirtHost) throws Exception {
+ Channel rhelChannel = ChannelFactoryTest.createBaseChannel(user, rhelFamily);
+ HibernateFactory.getSession().clear();
+ rhelChannel = ChannelFactory.lookupById(rhelChannel.getId());
+ assertNotNull(rhelChannel.getId());
+ assertNotNull(rhelChannel);
+
+ rhelFamily = ChannelFamilyFactory.lookupById(rhelFamily.getId());
+ assertNotNull(rhelFamily);
+ assertNotNull(rhelFamily.getMaxFlex(org));
+ assertEquals(Long.valueOf(flexEnts), rhelFamily.getMaxFlex(org));
+
+ HostBuilder builder = new HostBuilder(org.getActiveOrgAdmins().get(0));
+ Collection<VirtualInstance> guests = null;
+ if (addNonVirtHost) {
+ builder.createNonVirtHost();
+ builder.withGuests(guestsToCreate);
+ }
+ else {
+ guests = builder.withOrphanedGuests(guestsToCreate);
+ }
+
+ if (addNonVirtHost) {
+ Server host = builder.build();
+ ServerFactory.save(host);
+
+ SystemManager.subscribeServerToChannel(user, host, rhelChannel);
+
+ ServerFactory.save(host);
+ guests = host.getGuests();
+ }
+
+ for (VirtualInstance inst : guests) {
+ SystemManager.subscribeServerToChannel(user,
+ inst.getGuestSystem(), rhelChannel);
+ SystemManager.entitleServer(inst.getGuestSystem(),
+ EntitlementManager.MANAGEMENT);
+ ServerFactory.save(inst.getGuestSystem());
+ }
+ HibernateFactory.getSession().clear();
+ return rhelFamily;
+ }
}
13 years, 9 months