schema/spacewalk/postgres/procs/rhn_install_org_satellites.sql
| 9 -
schema/spacewalk/postgres/procs/rhn_prepare_install.sql
| 12 -
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.oracle
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.postgresql
| 65 ++++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.oracle
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.postgresql
| 58 ++++++++
6 files changed, 132 insertions(+), 14 deletions(-)
New commits:
commit 28b6f726afc85b39b3b7e3a286c53a9e7dc126b8
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Nov 25 16:04:32 2011 +0100
Fix the in out parameter handling.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: null value in column
"instance_id" violates not-null constraint
CONTEXT: SQL statement "insert into rhn_command_queue_execs ( instance_id,
netsaint_id, target_type) values ( $1 , $2 , 'cluster')"
PL/pgSQL function "rhn_install_satellite" line 3 at SQL statement
SQL statement "SELECT rhn_install_satellite( $1 , $2 )"
PL/pgSQL function "rhn_install_org_satellites" line 22 at PERFORM
diff --git a/schema/spacewalk/postgres/procs/rhn_install_org_satellites.sql
b/schema/spacewalk/postgres/procs/rhn_install_org_satellites.sql
index 795f02c..bac9cca 100644
--- a/schema/spacewalk/postgres/procs/rhn_install_org_satellites.sql
+++ b/schema/spacewalk/postgres/procs/rhn_install_org_satellites.sql
@@ -1,7 +1,6 @@
-- oracle equivalent source sha1 b9bd7f56e2221a312bc645e6ca038773d44b9808
--- retrieved from
./1239902810/d1e38d32416384088c1f0c047c60d31ece6de98f/schema/spacewalk/oracle/procs/rhn_install_org_satellites.sql
--
--- Copyright (c) 2008--2010 Red Hat, Inc.
+-- Copyright (c) 2008--2011 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
@@ -14,10 +13,6 @@
-- granted to use or replicate Red Hat trademarks that are incorporated
-- in this software or its documentation.
--
---
---
---
---
--monitoring stored procedure
@@ -52,7 +47,7 @@ declare
command_instance_id rhn_command_queue_instances.recid%type;
begin
- perform rhn_prepare_install(username, command_instance_id, 1);
+ command_instance_id := rhn_prepare_install(username, 1);
for satellite in satellite_cursor loop
perform rhn_install_satellite(command_instance_id, satellite.recid);
diff --git a/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
b/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
index 3e60703..fe831c2 100644
--- a/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
+++ b/schema/spacewalk/postgres/procs/rhn_prepare_install.sql
@@ -1,7 +1,6 @@
-- oracle equivalent source sha1 8dfbb8448ca026263ca954a7955097cc07e0c9a5
--- retrieved from
./1280312663/c1e5d91082adf7f8599a7b7429b11f995c7cf7e7/schema/spacewalk/oracle/procs/rhn_prepare_install.sql
--
--- Copyright (c) 2008--2010 Red Hat, Inc.
+-- Copyright (c) 2008--2011 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
@@ -14,10 +13,6 @@
-- granted to use or replicate Red Hat trademarks that are incorporated
-- in this software or its documentation.
--
---
---
---
---
--monitoring stored procedure
@@ -25,9 +20,9 @@ create or replace function
rhn_prepare_install
(
username in rhn_command_queue_instances.last_update_user%type,
- command_instance_id in out rhn_command_queue_instances.recid%type,
install_command in rhn_command_queue_instances.command_id%type
)
+returns rhn_command_queue_instances.recid%type
as $$
declare
/* ignore this command if it has not been run after five minutes */
@@ -36,6 +31,7 @@ declare
/* should take no more than five minutes to run the install */
max_execution_time_seconds numeric := 10 * 60;
+ command_instance_id rhn_command_queue_instances.recid%type;
begin
select nextval('rhn_command_q_inst_recid_seq')
into command_instance_id;
@@ -63,5 +59,7 @@ begin
username,
current_timestamp
);
+
+ return command_instance_id;
end; $$
language plpgsql;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.oracle
new file mode 100644
index 0000000..b7b00b1
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.oracle
@@ -0,0 +1 @@
+-- This file is intentionally left empty.
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.postgresql
new file mode 100644
index 0000000..75bfb96
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/130-rhn_prepare_install.sql.postgresql
@@ -0,0 +1,65 @@
+-- oracle equivalent source sha1 b14267384bc104605623a41b755e68e0103b5aa8
+--
+-- Copyright (c) 2008--2011 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.
+--
+
+--monitoring stored procedure
+
+create or replace function
+rhn_prepare_install
+(
+ username in rhn_command_queue_instances.last_update_user%type,
+ install_command in rhn_command_queue_instances.command_id%type
+)
+returns rhn_command_queue_instances.recid%type
+as $$
+declare
+ /* ignore this command if it has not been run after five minutes */
+ stale_after_minutes numeric := 10;
+
+ /* should take no more than five minutes to run the install */
+ max_execution_time_seconds numeric := 10 * 60;
+
+ command_instance_id rhn_command_queue_instances.recid%type;
+begin
+ select nextval('rhn_command_q_inst_recid_seq')
+ into command_instance_id;
+
+
+ insert into rhn_command_queue_instances (
+ recid,
+ command_id,
+ notes,
+ expiration_date,
+ notify_email,
+ timeout,
+ date_submitted,
+ last_update_user,
+ last_update_date
+ )
+ values (
+ command_instance_id,
+ install_command,
+ null, /* no notes */
+ current_timestamp + stale_after_minutes * '1 minute'::interval,
+ null, /* no notification email */
+ max_execution_time_seconds,
+ current_timestamp,
+ username,
+ current_timestamp
+ );
+
+ return command_instance_id;
+end; $$
+language plpgsql;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.oracle
new file mode 100644
index 0000000..b7b00b1
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.oracle
@@ -0,0 +1 @@
+-- This file is intentionally left empty.
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.postgresql
new file mode 100644
index 0000000..9044025
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/131-rhn_install_org_satellites.sql.postgresql
@@ -0,0 +1,58 @@
+-- oracle equivalent source sha1 b14267384bc104605623a41b755e68e0103b5aa8
+--
+-- Copyright (c) 2008--2011 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.
+--
+
+--monitoring stored procedure
+
+
+create or replace function
+rhn_install_org_satellites
+(
+ for_customer_id in web_customer.id%type,
+ sat_cluster_id in rhn_sat_cluster.recid%type,
+ username in rhn_command_queue_instances.last_update_user%type
+) returns void
+as
+$$
+declare
+
+-- the cursor is defined such that the following behavior occurs based on the
sat_cluster_id param:
+-- null results in all of a customer's scout being configured.
+-- an id for a scout belonging to the cust results in just that scout being configured
+-- an id for a scout not belonging to the cust results in no action.
+
+ satellite_cursor cursor for
+ select recid from rhn_sat_cluster
+ where customer_id = for_customer_id
+ and recid not in (
+ select netsaint_id from rhn_ll_netsaint
+ )
+ except
+ select recid from rhn_sat_cluster
+ where customer_id = for_customer_id
+ and recid not in (sat_cluster_id);
+
+ command_instance_id rhn_command_queue_instances.recid%type;
+
+begin
+ command_instance_id := rhn_prepare_install(username, 1);
+
+ for satellite in satellite_cursor loop
+ perform rhn_install_satellite(command_instance_id, satellite.recid);
+ end loop;
+end
+$$
+language plpgsql;
+