Changes to 'refs/tags/SatConfig-general-1.216.24-1'
by Jan Pazdziora
Tag 'SatConfig-general-1.216.24-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2011-08-11 14:29 +0000
Tagging package [SatConfig-general] version [1.216.24-1] in directory [monitoring/SatConfig/general/].
Changes since NOCpulsePlugins-2.209.3-1:
Jan Pazdziora (1):
Automatic commit of package [SatConfig-general] release [1.216.24-1].
---
monitoring/SatConfig/general/SatConfig-general.spec | 6 +++++-
rel-eng/packages/SatConfig-general | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
---
12 years, 10 months
monitoring/SatConfig rel-eng/packages
by Jan Pazdziora
monitoring/SatConfig/general/SatConfig-general.spec | 6 +++++-
rel-eng/packages/SatConfig-general | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 0121131834d8e59b39d0ed8a90a59157e70572f4
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Aug 11 16:29:20 2011 +0200
Automatic commit of package [SatConfig-general] release [1.216.24-1].
diff --git a/monitoring/SatConfig/general/SatConfig-general.spec b/monitoring/SatConfig/general/SatConfig-general.spec
index e515e70..6a3fce2 100644
--- a/monitoring/SatConfig/general/SatConfig-general.spec
+++ b/monitoring/SatConfig/general/SatConfig-general.spec
@@ -2,7 +2,7 @@
%define hb_res_dir %{_sysconfdir}/ha.d/resource.d
%define installed_dir %sysv_dir/installed
Name: SatConfig-general
-Version: 1.216.23
+Version: 1.216.24
Release: 1%{?dist}
Summary: Satellite Configuration System - general setup, used by many packages
URL: https://fedorahosted.org/spacewalk
@@ -65,6 +65,10 @@ install -D -p -m 755 NOCpulse-ini $RPM_BUILD_ROOT%{_sbindir}/NOCpulse-ini
rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Aug 11 2011 Jan Pazdziora 1.216.24-1
+- Since autocommit is off in RHN::DB, add explicit commit to ensure our config
+ changes are written to the database (david.nutter(a)bioss.ac.uk)
+
* Tue Jul 19 2011 Jan Pazdziora 1.216.23-1
- Updating the copyright years.
diff --git a/rel-eng/packages/SatConfig-general b/rel-eng/packages/SatConfig-general
index 336ead0..459f32b 100644
--- a/rel-eng/packages/SatConfig-general
+++ b/rel-eng/packages/SatConfig-general
@@ -1 +1 @@
-1.216.23-1 monitoring/SatConfig/general/
+1.216.24-1 monitoring/SatConfig/general/
12 years, 10 months
Changes to 'refs/tags/NOCpulsePlugins-2.209.3-1'
by Jan Pazdziora
Tag 'NOCpulsePlugins-2.209.3-1' created by Jan Pazdziora <jpazdziora(a)redhat.com> at 2011-08-11 14:28 +0000
Tagging package [NOCpulsePlugins] version [2.209.3-1] in directory [monitoring/NOCpulsePlugins/].
Changes since spacewalk-schema-1.6.5-1:
David Nutter (3):
Add additional member name mappings in ProbeRecord to ensure that the probe will run when rhn-runprobe is called.
Since autocommit is off in RHN::DB, add explicit commit to ensure our config changes are written to the database
Properly dereference the array references for old and new files so logfiles contain the number of files in the queue and not strings like "ARRAY(0x12323)"
Jan Pazdziora (1):
Automatic commit of package [NOCpulsePlugins] release [2.209.3-1].
Milan Zazrivec (2):
729468 - firstboot dialogs polishing
729161 - default to RHSM in firstboot registration
---
client/rhel/rhn-client-tools/data/rh_register.glade | 13 ++++++-------
monitoring/NOCpulsePlugins/NOCpulsePlugins.spec | 6 +++++-
monitoring/NOCpulsePlugins/ProbeCatalog.pm | 6 +++---
monitoring/SatConfig/general/NOCpulse-ini | 2 ++
monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl | 10 +++++-----
rel-eng/packages/NOCpulsePlugins | 2 +-
6 files changed, 22 insertions(+), 17 deletions(-)
---
12 years, 10 months
monitoring/NOCpulsePlugins rel-eng/packages
by Jan Pazdziora
monitoring/NOCpulsePlugins/NOCpulsePlugins.spec | 6 +++++-
rel-eng/packages/NOCpulsePlugins | 2 +-
2 files changed, 6 insertions(+), 2 deletions(-)
New commits:
commit 61842c0f41337319f6565c37b2e8ec29616fbbf3
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Thu Aug 11 16:28:55 2011 +0200
Automatic commit of package [NOCpulsePlugins] release [2.209.3-1].
diff --git a/monitoring/NOCpulsePlugins/NOCpulsePlugins.spec b/monitoring/NOCpulsePlugins/NOCpulsePlugins.spec
index a7b1d30..06e72a8 100644
--- a/monitoring/NOCpulsePlugins/NOCpulsePlugins.spec
+++ b/monitoring/NOCpulsePlugins/NOCpulsePlugins.spec
@@ -1,5 +1,5 @@
Name: NOCpulsePlugins
-Version: 2.209.2
+Version: 2.209.3
Release: 1%{?dist}
Summary: NOCpulse authored Plug-ins
URL: https://fedorahosted.org/spacewalk
@@ -88,6 +88,10 @@ fi
rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Aug 11 2011 Jan Pazdziora 2.209.3-1
+- Add additional member name mappings in ProbeRecord to ensure that the probe
+ will run when rhn-runprobe is called. (davidn(a)elrond.bioss.sari.ac.uk)
+
* Fri Feb 18 2011 Jan Pazdziora 2.209.2-1
- Localize the filehandle globs; also use three-parameter opens.
diff --git a/rel-eng/packages/NOCpulsePlugins b/rel-eng/packages/NOCpulsePlugins
index 0ef15a0..52c8225 100644
--- a/rel-eng/packages/NOCpulsePlugins
+++ b/rel-eng/packages/NOCpulsePlugins
@@ -1 +1 @@
-2.209.2-1 monitoring/NOCpulsePlugins/
+2.209.3-1 monitoring/NOCpulsePlugins/
12 years, 10 months
3 commits - monitoring/NOCpulsePlugins monitoring/SatConfig monitoring/tsdb
by Jan Pazdziora
monitoring/NOCpulsePlugins/ProbeCatalog.pm | 6 +++---
monitoring/SatConfig/general/NOCpulse-ini | 2 ++
monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl | 10 +++++-----
3 files changed, 10 insertions(+), 8 deletions(-)
New commits:
commit fa221cb4dbc12dcffb63755912608bc9da106fb9
Author: David Nutter <david.nutter(a)bioss.ac.uk>
Date: Thu Aug 4 17:09:59 2011 +0100
Properly dereference the array references for old and new files so logfiles contain the number of files in the queue and not strings like "ARRAY(0x12323)"
diff --git a/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl b/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl
index cd3be83..513716f 100755
--- a/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl
+++ b/monitoring/tsdb/LocalQueue/TSDBLocalQueue.pl
@@ -85,9 +85,9 @@ while (1) {
}
$last_scan_time = $now;
- $Log->log(1, "Rescanned directory: ",
- scalar($queue_manager->current_file_keys), " current, ",
- scalar($queue_manager->old_file_keys), " old\n");
+ $Log->log(1, "Rescanned directory: ",
+ scalar(@{$queue_manager->current_file_keys}), " current, ",
+ scalar(@{$queue_manager->old_file_keys}), " old\n");
} otherwise {
my $err = shift;
$ErrorOut->print("Problem scanning directory: $err\n");
@@ -181,8 +181,8 @@ while (1) {
}
# If there are no files, nod off for a while.
- if (scalar($queue_manager->current_file_keys) == 0
- && scalar($queue_manager->old_file_keys) == 0) {
+ if (scalar(@{$queue_manager->current_file_keys}) == 0
+ && scalar(@{$queue_manager->old_file_keys}) == 0) {
$Log->log(1, "No current or old files, sleep ", NO_FILES_SLEEP, "\n");
$Log->flush();
commit 5c6af5bc3fcdd52b985019f6c155db0867646988
Author: David Nutter <david.nutter(a)bioss.ac.uk>
Date: Thu Aug 4 17:09:10 2011 +0100
Since autocommit is off in RHN::DB, add explicit commit to ensure our config changes are written to the database
diff --git a/monitoring/SatConfig/general/NOCpulse-ini b/monitoring/SatConfig/general/NOCpulse-ini
index 3eb304d..12c8dda 100644
--- a/monitoring/SatConfig/general/NOCpulse-ini
+++ b/monitoring/SatConfig/general/NOCpulse-ini
@@ -103,6 +103,7 @@ if ($set_macro) {
my $sth = $ini->dbh->prepare($sql);
$sth->execute($new_value, $set_macro);
print $sth->rows, " record updated.\n";
+ $ini->dbh->commit();
$save = 1;
} elsif ($set_param) {
if (!@groups or scalar(@groups) != 1) {
@@ -118,6 +119,7 @@ if ($set_macro) {
my $sth = $ini->dbh->prepare($sql);
$sth->execute($new_value, $groups[0], $set_param);
print $sth->rows, " record updated.\n";
+ $ini->dbh->commit();
$save = 1;
}
commit 8e9294be7e895bc7dc7f7c2de29469092059f026
Author: David Nutter <davidn(a)elrond.bioss.sari.ac.uk>
Date: Thu Aug 4 17:06:41 2011 +0100
Add additional member name mappings in ProbeRecord to ensure that the probe will run when rhn-runprobe is called.
Changed ProbeCatalog to use correct hash key names when listing probes
diff --git a/monitoring/NOCpulsePlugins/ProbeCatalog.pm b/monitoring/NOCpulsePlugins/ProbeCatalog.pm
index 8b0c422..9dd00c6 100644
--- a/monitoring/NOCpulsePlugins/ProbeCatalog.pm
+++ b/monitoring/NOCpulsePlugins/ProbeCatalog.pm
@@ -35,10 +35,10 @@ sub describe {
my $result;
if ($probe_id) {
$result = $probeHashRef->{RECID}.' '.$probeHashRef->{PROBE_TYPE};;
- if ($probeHashRef->{hostName}) {
- $result .= ' on '.$probeHashRef->{hostName}.' ('.$probeHashRef->{hostAddress}.')';
+ if ($probeHashRef->{HOSTNAME}) {
+ $result .= ' on '.$probeHashRef->{HOSTNAME}.' ('.$probeHashRef->{HOSTADDRESS}.')';
} else {
- $result .= ' on '.$probeHashRef->{hostAddress};
+ $result .= ' on '.$probeHashRef->{HOSTADDRESS};
}
$result .= ': '.$probeHashRef->{DESCRIPTION};
12 years, 10 months
client/rhel
by Milan Zazrivec
client/rhel/rhn-client-tools/data/rh_register.glade | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit fbd32651665af28eaf07530f856afaed74f7d4ab
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 11 15:57:31 2011 +0200
729161 - default to RHSM in firstboot registration
diff --git a/client/rhel/rhn-client-tools/data/rh_register.glade b/client/rhel/rhn-client-tools/data/rh_register.glade
index 634d7d3..5cd571b 100644
--- a/client/rhel/rhn-client-tools/data/rh_register.glade
+++ b/client/rhel/rhn-client-tools/data/rh_register.glade
@@ -278,7 +278,7 @@ You may access the software update tool by running <b>Software Update</
<property name="visible">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
- <property name="active">True</property>
+ <property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
12 years, 10 months
client/rhel
by Milan Zazrivec
client/rhel/rhn-client-tools/data/rh_register.glade | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
New commits:
commit 4e95765b69c155fe33fcc0221cdef91d2cad0a3c
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 11 15:25:38 2011 +0200
729468 - firstboot dialogs polishing
diff --git a/client/rhel/rhn-client-tools/data/rh_register.glade b/client/rhel/rhn-client-tools/data/rh_register.glade
index 6a06f6d..634d7d3 100644
--- a/client/rhel/rhn-client-tools/data/rh_register.glade
+++ b/client/rhel/rhn-client-tools/data/rh_register.glade
@@ -4718,7 +4718,7 @@ Are you sure you would like to continue?</property>
</widget>
<widget class="GtkDialog" id="alreadyRegisteredDialog">
- <property name="title" translatable="yes">System software updates already set up</property>
+ <property name="title" translatable="yes">System already registered</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -5035,7 +5035,7 @@ Are you sure you would like to continue?</property>
</widget>
<widget class="GtkDialog" id="alreadyRegisteredSubscriptionManagerDialog">
- <property name="title" translatable="yes">System software updates already set up</property>
+ <property name="title" translatable="yes">System already registered</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -5132,7 +5132,7 @@ Are you sure you would like to continue?</property>
<child>
<widget class="GtkLabel" id="label72">
<property name="visible">True</property>
- <property name="label" translatable="yes" context="yes">It appears this system has already been registered with RHN using RHN Certificate-Based Entitlement technology. This tool requires registration using RHN Classic technology.</property>
+ <property name="label" translatable="yes" context="yes">This system has already been registered with RHN using RHN certificate-based technology.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -5157,8 +5157,7 @@ Are you sure you would like to continue?</property>
<child>
<widget class="GtkLabel" id="label73">
<property name="visible">True</property>
- <property name="label" translatable="yes" context="yes">Except for a few cases, Red Hat recommends customers only register with RHN once.
-</property>
+ <property name="label" translatable="yes" context="yes">The tool you are using is attempting to re-register using RHN Classic technology. Red Hat recommends (except in a few cases) that customers only register with RHN once.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -5183,7 +5182,7 @@ Are you sure you would like to continue?</property>
<child>
<widget class="GtkLabel" id="label74">
<property name="visible">True</property>
- <property name="label" translatable="yes" context="yes">For more information, including alternate tools, consult this Knowledge Base Article: <a href="https://access.redhat.com/kb/docs/DOC-45563">https://access.redhat.com/kb/docs/DOC-45563</a>
+ <property name="label" translatable="yes" context="yes">To learn more about RHN registration and technologies please consult this Knowledge Base Article: <a href="https://access.redhat.com/kb/docs/DOC-45563">https://access.redhat.com/kb/docs/DOC-45563</a>
</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
12 years, 10 months
Changes to 'refs/tags/spacewalk-schema-1.6.5-1'
by Šimon Lukašík
Tag 'spacewalk-schema-1.6.5-1' created by Simon Lukasik <slukasik(a)redhat.com> at 2011-08-11 13:30 +0000
Tagging package [spacewalk-schema] version [1.6.5-1] in directory [schema/spacewalk/].
Changes since spacecmd-1.6.3-1:
Simon Lukasik (3):
Apply necessary flex changes needed for submitting OrgSoftwareSubscriptions.do
Do not confuse people by filename, this is not an upgrade of package
Automatic commit of package [spacewalk-schema] release [1.6.5-1].
---
rel-eng/packages/spacewalk-schema | 2
schema/spacewalk/postgres/packages/rhn_entitlements.pkb | 69 ++
schema/spacewalk/spacewalk-schema.spec | 8
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle | 238 ---------
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql | 240 ----------
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.oracle | 238 +++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.postgresql | 240 ++++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/003-assign_channel_entitlement.sql.oracle | 1
schema/spacewalk/upgrade/spacewalk-schema-1.5-to-spacewalk-schema-1.6/003-assign_channel_entitlement.sql.postgresql | 123 +++++
9 files changed, 666 insertions(+), 493 deletions(-)
---
12 years, 10 months
rel-eng/packages schema/spacewalk
by Šimon Lukašík
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit b4f58bd289d4743c7dbb4e933894c4925ff1c327
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Aug 11 15:30:39 2011 +0200
Automatic commit of package [spacewalk-schema] release [1.6.5-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 0b95ca4..e2659cf 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-1.6.4-1 schema/spacewalk/
+1.6.5-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index e93b306..dbf6b13 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.6.4
+Version: 1.6.5
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -66,6 +66,12 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-sql*
%changelog
+* Thu Aug 11 2011 Simon Lukasik <slukasik(a)redhat.com> 1.6.5-1
+- Do not confuse people by filename, this is not an upgrade of package
+ (slukasik(a)redhat.com)
+- Apply necessary flex changes needed for submitting
+ OrgSoftwareSubscriptions.do (slukasik(a)redhat.com)
+
* Thu Aug 11 2011 Tomas Lestach <tlestach(a)redhat.com> 1.6.4-1
- 722189 - rewrite rhnServerNeededView to reflect all available errata
(tlestach(a)redhat.com)
12 years, 10 months
schema/spacewalk
by Šimon Lukašík
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle | 238 ---------
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql | 240 ----------
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.oracle | 238 +++++++++
schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.postgresql | 240 ++++++++++
4 files changed, 478 insertions(+), 478 deletions(-)
New commits:
commit 0462cdf43aae93d8b7d3ad3ab73f09b0664bb2c0
Author: Simon Lukasik <slukasik(a)redhat.com>
Date: Thu Aug 11 15:29:32 2011 +0200
Do not confuse people by filename, this is not an upgrade of package
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle
deleted file mode 100644
index 4e1cc4d..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.oracle
+++ /dev/null
@@ -1,238 +0,0 @@
-create or replace
-procedure delete_server (
- server_id_in in number
-) is
- cursor servergroups is
- select server_id, server_group_id
- from rhnServerGroupMembers sgm
- where sgm.server_id = server_id_in;
- cursor configchannels is
- select cc.id
- from rhnConfigChannel cc,
- rhnConfigChannelType cct,
- rhnServerConfigChannel scc
- where 1=1
- and scc.server_id = server_id_in
- and scc.config_channel_id = cc.id
- -- these config channel types are reserved
- -- for use by a single server, so we don't
- -- need to check for other servers subscribed
- and cct.label in
- ('local_override','server_import')
- and cct.id = cc.confchan_type_id;
- type filelistsid_t is table of rhnServerPreserveFileList.file_list_id%type;
- filelistsid_c filelistsid_t;
-
- type probesid_t is table of rhn_check_probe.probe_id%type;
- probesid_c probesid_t;
-
- is_virt number := 0;
-begin
- rhn_channel.delete_server_channels(server_id_in);
- -- rhn_channel.clear_subscriptions(server_id_in);
-
- -- filelists
- select spfl.file_list_id id bulk collect into filelistsid_c
- from rhnServerPreserveFileList spfl
- where spfl.server_id = server_id_in
- and not exists (
- select 1
- from rhnServerPreserveFileList
- where file_list_id = spfl.file_list_id
- and server_id != server_id_in
- union
- select 1
- from rhnKickstartPreserveFileList
- where file_list_id = spfl.file_list_id
- );
- if filelistsid_c.first is not null then
- forall i in filelistsid_c.first..filelistsid_c.last
- delete from rhnFileList where id = filelistsid_c(i);
- end if;
-
- for configchannel in configchannels loop
- rhn_config.delete_channel(configchannel.id);
- end loop;
-
- select count(1) into is_virt
- from rhnServerEntitlementView
- where server_id = server_id_in
- and label in ('virtualization_host', 'virtualization_host_platform')
- and rownum <= 1;
-
- for sgm in servergroups loop
- rhn_server.delete_from_servergroup(
- sgm.server_id, sgm.server_group_id);
- end loop;
-
- if is_virt = 1 then
- rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
- end if;
-
- -- we're handling this instead of letting an "on delete
- -- set null" do it so that we don't run the risk
- -- of setting off the triggers and killing us with a
- -- mutating table
-
- -- this is merge of two single updates:
- -- update ... set old_server_id = null where old_server_id = server_id_in;
- -- update ... set new_server_id = null where new_server_id = server_id_in;
- -- so we scan rhnKickstartSession table only once
- update rhnKickstartSession
- set old_server_id = case when old_server_id = server_id_in then null else old_server_id end,
- new_server_id = case when new_server_id = server_id_in then null else new_server_id end
- where old_server_id = server_id_in
- or new_server_id = server_id_in;
-
- rhn_channel.clear_subscriptions(server_id_in,1);
-
- -- A little complicated here, but the goal is to
- -- delete records from rhnVirtualInstace only if we don't
- -- care about them anymore. We don't care about records
- -- in rhnVirtualInstance if we are deleting the host
- -- system and the virtual system is already null, or
- -- vice-versa. We *do* care about them if either the
- -- host or virtual system is still registered because we
- -- still want them to show up in the UI.
- -- If there's a newer row in rhnVirtualInstance with the same
- -- uuid, this guest must have been re-registered, so we can clean
- -- this data up.
-
- delete from rhnVirtualInstance vi
- where (host_system_id = server_id_in and virtual_system_id is null)
- or (virtual_system_id = server_id_in and host_system_id is null)
- or (vi.virtual_system_id = server_id_in and vi.modified < (select max(vi2.modified)
- from rhnVirtualInstance vi2 where vi2.uuid = vi.uuid));
-
- -- this is merge of two single updates:
- -- update ... set host_system_id = null where host_system_id = server_id_in;
- -- update ... set virtual_system_id = null where virtual_system_id = server_id_in;
- -- so we scan rhnVirtualInstance table only once
- update rhnVirtualInstance
- set host_system_id = case when host_system_id = server_id_in then null else host_system_id end,
- virtual_system_id = case when virtual_system_id = server_id_in then null else virtual_system_id end
- where host_system_id = server_id_in
- or virtual_system_id = server_id_in;
-
- -- this is merge of two single updates:
- -- update ... set old_host_system_id = null when old_host_system_id = server_id_in;
- -- update ... set new_host_system_id = null when new_host_system_id = server_id_in;
- -- so we scan rhnVirtualInstanceEventLog table only once
- update rhnVirtualInstanceEventLog
- set old_host_system_id = case when old_host_system_id = server_id_in then null else old_host_system_id end,
- new_host_system_id = case when new_host_system_id = server_id_in then null else new_host_system_id end
- where old_host_system_id = server_id_in
- or new_host_system_id = server_id_in;
-
- -- We're deleting everything with a foreign key to rhnServer
- -- here, now. I'm hoping this will help aleviate our deadlock
- -- problem.
-
- delete from rhnActionConfigChannel where server_id = server_id_in;
- delete from rhnActionConfigRevision where server_id = server_id_in;
- delete from rhnActionPackageRemovalFailure where server_id = server_id_in;
- delete from rhnClientCapability where server_id = server_id_in;
- delete from rhnCpu where server_id = server_id_in;
- -- there's still a cascade here, because the constraint keeps the
- -- table locked for too long to rebuild it. Ugh...
- delete from rhnDevice where server_id = server_id_in;
- delete from rhnProxyInfo where server_id = server_id_in;
- delete from rhnRam where server_id = server_id_in;
- delete from rhnRegToken where server_id = server_id_in;
- delete from rhnSatelliteInfo where server_id = server_id_in;
- -- this cascades to rhnActionConfigChannel and rhnActionConfigFileName
- delete from rhnServerAction where server_id = server_id_in;
- delete from rhnServerActionPackageResult where server_id = server_id_in;
- delete from rhnServerActionScriptResult where server_id = server_id_in;
- delete from rhnServerActionVerifyResult where server_id = server_id_in;
- delete from rhnServerActionVerifyMissing where server_id = server_id_in;
- -- counts are handled above. this should be a delete_ function.
- delete from rhnServerChannel where server_id = server_id_in;
- delete from rhnServerConfigChannel where server_id = server_id_in;
- delete from rhnServerCustomDataValue where server_id = server_id_in;
- delete from rhnServerDMI where server_id = server_id_in;
- delete from rhnServerEvent where server_id = server_id_in;
- delete from rhnServerHistory where server_id = server_id_in;
- delete from rhnServerInfo where server_id = server_id_in;
- delete from rhnServerInstallInfo where server_id = server_id_in;
- delete from rhnServerLocation where server_id = server_id_in;
- delete from rhnServerLock where server_id = server_id_in;
- delete from rhnServerNeededCache where server_id = server_id_in;
- delete from rhnServerNetwork where server_id = server_id_in;
- delete from rhnServerNotes where server_id = server_id_in;
- -- I'm not removing the foreign key from rhnServerPackage; that'll
- -- take forever. Do the delete anyway.
- delete from rhnServerPackage where server_id = server_id_in;
- delete from rhnServerTokenRegs where server_id = server_id_in;
- delete from rhnSnapshotTag where server_id = server_id_in;
- -- this cascades to:
- -- rhnSnapshotChannel, rhnSnapshotConfigChannel, rhnSnapshotPackage,
- -- rhnSnapshotConfigRevision, rhnSnapshotServerGroup,
- -- rhnSnapshotTag.
- -- We may want to consider delete_snapshot() at some point, but
- -- I don't think we need to yet.
- delete from rhnSnapshot where server_id = server_id_in;
- delete from rhnUserServerPrefs where server_id = server_id_in;
- -- hrm, this one's interesting... we _probably_ should delete
- -- everything for the parent server_id when we delete the proxy,
- -- but we don't currently.
- delete from rhnServerPath where server_id_in in (server_id, proxy_server_id);
- delete from rhnUserServerPerms where server_id = server_id_in;
-
- delete from rhnServerNetInterface where server_id = server_id_in;
- delete from rhn_server_monitoring_info where recid = server_id_in;
-
- delete from rhnAppInstallSession where server_id = server_id_in;
- delete from rhnServerUuid where server_id = server_id_in;
- -- We delete all the probes running directly against this system
- -- and any probes that were using this Server as a Proxy Scout.
- SELECT CP.probe_id bulk collect into probesid_c
- FROM rhn_check_probe CP
- WHERE CP.host_id = server_id_in
- OR CP.sat_cluster_id in
- (SELECT SN.sat_cluster_id
- FROM rhn_sat_node SN
- WHERE SN.server_id = server_id_in);
-
- if probesid_c.first is not null then
- FORALL i IN probesid_c.first..probesid_c.last
- DELETE FROM rhn_probe_state PS WHERE PS.probe_id = probesid_c(i);
- FORALL i IN probesid_c.first..probesid_c.last
- DELETE FROM rhn_probe P WHERE P.recid = probesid_c(i);
- FORALL i IN probesid_c.first..probesid_c.last
- DELETE /*+index(time_series time_series_probe_id_idx)*/
- FROM time_series
- WHERE substr(o_id, instr(o_id, '-') + 1,
- (instr(o_id, '-', instr(o_id, '-') + 1) - instr(o_id, '-')) - 1) = probesid_c(i);
- end if;
-
- delete from rhn_check_probe where host_id = server_id_in;
- delete from rhn_host_probe where host_id = server_id_in;
-
- delete from rhn_sat_cluster where recid in
- ( select sat_cluster_id from rhn_sat_node where server_id = server_id_in );
-
- delete from rhn_sat_node where server_id = server_id_in;
-
- delete from rhnPushClient where server_id = server_id_in;
-
- -- now get rhnServer itself.
- delete
- from rhnServer
- where id = server_id_in;
-
- delete
- from rhnSet
- where 1=1
- and user_id in (
- select wc.id
- from rhnServer rs,
- web_contact wc
- where rs.id = server_id_in
- and rs.org_id = wc.org_id
- )
- and label = 'system_list'
- and element = server_id_in;
-end delete_server;
-/
-show errors;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql
deleted file mode 100644
index 55c6067..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.pkb.sql.postgresql
+++ /dev/null
@@ -1,240 +0,0 @@
-create or replace
-function delete_server (
- server_id_in in numeric
-) returns void
-as
-$$
-declare
- servergroups cursor for
- select server_id, server_group_id
- from rhnServerGroupMembers sgm
- where sgm.server_id = server_id_in;
-
- configchannels cursor for
- select cc.id
- from rhnConfigChannel cc,
- rhnConfigChannelType cct,
- rhnServerConfigChannel scc
- where 1=1
- and scc.server_id = server_id_in
- and scc.config_channel_id = cc.id
- -- these config channel types are reserved
- -- for use by a single server, so we don't
- -- need to check for other servers subscribed
- and cct.label in
- ('local_override','server_import')
- and cct.id = cc.confchan_type_id;
-
- is_virt boolean;
-begin
- perform rhn_channel.delete_server_channels(server_id_in);
- -- rhn_channel.clear_subscriptions(server_id_in);
-
- -- filelists
- delete from rhnFileList where id in (
- select spfl.file_list_id
- from rhnServerPreserveFileList spfl
- where spfl.server_id = server_id_in
- and not exists (
- select 1
- from rhnServerPreserveFileList
- where file_list_id = spfl.file_list_id
- and server_id != server_id_in
- union all
- select 1
- from rhnKickstartPreserveFileList
- where file_list_id = spfl.file_list_id
- )
- );
-
- for configchannel in configchannels loop
- perform rhn_config.delete_channel(configchannel.id);
- end loop;
-
- is_virt := exists (
- select 1
- from rhnServerEntitlementView
- where server_id = server_id_in
- and label in ('virtualization_host', 'virtualization_host_platform')
- );
-
- for sgm in servergroups loop
- perform rhn_server.delete_from_servergroup(
- sgm.server_id, sgm.server_group_id);
- end loop;
-
- if is_virt then
- perform rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
- end if;
-
- -- we're handling this instead of letting an "on delete
- -- set null" do it so that we don't run the risk
- -- of setting off the triggers and killing us with a
- -- mutating table
-
- -- this is merge of two single updates:
- -- update ... set old_server_id = null where old_server_id = server_id_in;
- -- update ... set new_server_id = null where new_server_id = server_id_in;
- -- so we scan rhnKickstartSession table only once
- update rhnKickstartSession
- set old_server_id = case when old_server_id = server_id_in then null else old_server_id end,
- new_server_id = case when new_server_id = server_id_in then null else new_server_id end
- where old_server_id = server_id_in
- or new_server_id = server_id_in;
-
- perform rhn_channel.clear_subscriptions(server_id_in,1);
-
- -- A little complicated here, but the goal is to
- -- delete records from rhnVirtualInstace only if we don't
- -- care about them anymore. We don't care about records
- -- in rhnVirtualInstance if we are deleting the host
- -- system and the virtual system is already null, or
- -- vice-versa. We *do* care about them if either the
- -- host or virtual system is still registered because we
- -- still want them to show up in the UI.
- -- If there's a newer row in rhnVirtualInstance with the same
- -- uuid, this guest must have been re-registered, so we can clean
- -- this data up.
-
- delete from rhnVirtualInstance vi
- where (host_system_id = server_id_in and virtual_system_id is null)
- or (virtual_system_id = server_id_in and host_system_id is null)
- or (vi.virtual_system_id = server_id_in and vi.modified < (select max(vi2.modified)
- from rhnVirtualInstance vi2 where vi2.uuid = vi.uuid));
-
- -- this is merge of two single updates:
- -- update ... set host_system_id = null where host_system_id = server_id_in;
- -- update ... set virtual_system_id = null where virtual_system_id = server_id_in;
- -- so we scan rhnVirtualInstance table only once
- update rhnVirtualInstance
- set host_system_id = case when host_system_id = server_id_in then null else host_system_id end,
- virtual_system_id = case when virtual_system_id = server_id_in then null else virtual_system_id end
- where host_system_id = server_id_in
- or virtual_system_id = server_id_in;
-
- -- this is merge of two single updates:
- -- update ... set old_host_system_id = null when old_host_system_id = server_id_in;
- -- update ... set new_host_system_id = null when new_host_system_id = server_id_in;
- -- so we scan rhnVirtualInstanceEventLog table only once
- update rhnVirtualInstanceEventLog
- set old_host_system_id = case when old_host_system_id = server_id_in then null else old_host_system_id end,
- new_host_system_id = case when new_host_system_id = server_id_in then null else new_host_system_id end
- where old_host_system_id = server_id_in
- or new_host_system_id = server_id_in;
-
- -- We're deleting everything with a foreign key to rhnServer
- -- here, now. I'm hoping this will help aleviate our deadlock
- -- problem.
-
- delete from rhnActionConfigChannel where server_id = server_id_in;
- delete from rhnActionConfigRevision where server_id = server_id_in;
- delete from rhnActionPackageRemovalFailure where server_id = server_id_in;
- delete from rhnClientCapability where server_id = server_id_in;
- delete from rhnCpu where server_id = server_id_in;
- -- there's still a cascade here, because the constraint keeps the
- -- table locked for too long to rebuild it. Ugh...
- delete from rhnDevice where server_id = server_id_in;
- delete from rhnProxyInfo where server_id = server_id_in;
- delete from rhnRam where server_id = server_id_in;
- delete from rhnRegToken where server_id = server_id_in;
- delete from rhnSatelliteInfo where server_id = server_id_in;
- -- this cascades to rhnActionConfigChannel and rhnActionConfigFileName
- delete from rhnServerAction where server_id = server_id_in;
- delete from rhnServerActionPackageResult where server_id = server_id_in;
- delete from rhnServerActionScriptResult where server_id = server_id_in;
- delete from rhnServerActionVerifyResult where server_id = server_id_in;
- delete from rhnServerActionVerifyMissing where server_id = server_id_in;
- -- counts are handled above. this should be a delete_ function.
- delete from rhnServerChannel where server_id = server_id_in;
- delete from rhnServerConfigChannel where server_id = server_id_in;
- delete from rhnServerCustomDataValue where server_id = server_id_in;
- delete from rhnServerDMI where server_id = server_id_in;
- delete from rhnServerEvent where server_id = server_id_in;
- delete from rhnServerHistory where server_id = server_id_in;
- delete from rhnServerInfo where server_id = server_id_in;
- delete from rhnServerInstallInfo where server_id = server_id_in;
- delete from rhnServerLocation where server_id = server_id_in;
- delete from rhnServerLock where server_id = server_id_in;
- delete from rhnServerNeededCache where server_id = server_id_in;
- delete from rhnServerNetwork where server_id = server_id_in;
- delete from rhnServerNotes where server_id = server_id_in;
- -- I'm not removing the foreign key from rhnServerPackage; that'll
- -- take forever. Do the delete anyway.
- delete from rhnServerPackage where server_id = server_id_in;
- delete from rhnServerTokenRegs where server_id = server_id_in;
- delete from rhnSnapshotTag where server_id = server_id_in;
- -- this cascades to:
- -- rhnSnapshotChannel, rhnSnapshotConfigChannel, rhnSnapshotPackage,
- -- rhnSnapshotConfigRevision, rhnSnapshotServerGroup,
- -- rhnSnapshotTag.
- -- We may want to consider delete_snapshot() at some point, but
- -- I don't think we need to yet.
- delete from rhnSnapshot where server_id = server_id_in;
- delete from rhnUserServerPrefs where server_id = server_id_in;
- -- hrm, this one's interesting... we _probably_ should delete
- -- everything for the parent server_id when we delete the proxy,
- -- but we don't currently.
- delete from rhnServerPath where server_id_in in (server_id, proxy_server_id);
- delete from rhnUserServerPerms where server_id = server_id_in;
-
- delete from rhnServerNetInterface where server_id = server_id_in;
- delete from rhn_server_monitoring_info where recid = server_id_in;
-
- delete from rhnAppInstallSession where server_id = server_id_in;
- delete from rhnServerUuid where server_id = server_id_in;
-
- -- We delete all the probes running directly against this system
- -- and any probes that were using this Server as a Proxy Scout.
- DELETE FROM rhn_probe_state PS WHERE PS.probe_id IN (
- SELECT CP.probe_id
- FROM rhn_check_probe CP
- WHERE CP.host_id = server_id_in
- OR CP.sat_cluster_id in
- (SELECT SN.sat_cluster_id
- FROM rhn_sat_node SN
- WHERE SN.server_id = server_id_in)
- );
-
- DELETE FROM rhn_probe P WHERE P.recid IN (
- SELECT CP.probe_id
- FROM rhn_check_probe CP
- WHERE CP.host_id = server_id_in
- OR CP.sat_cluster_id in
- (SELECT SN.sat_cluster_id
- FROM rhn_sat_node SN
- WHERE SN.server_id = server_id_in)
- );
-
- -- delete from time_series TODO
-
- delete from rhn_check_probe where host_id = server_id_in;
- delete from rhn_host_probe where host_id = server_id_in;
-
- delete from rhn_sat_cluster where recid in
- ( select sat_cluster_id from rhn_sat_node where server_id = server_id_in );
-
- delete from rhn_sat_node where server_id = server_id_in;
-
- delete from rhnPushClient where server_id = server_id_in;
-
- -- now get rhnServer itself.
- delete
- from rhnServer
- where id = server_id_in;
-
- delete
- from rhnSet
- where 1=1
- and user_id in (
- select wc.id
- from rhnServer rs,
- web_contact wc
- where rs.id = server_id_in
- and rs.org_id = wc.org_id
- )
- and label = 'system_list'
- and element = server_id_in;
-end;
-$$
-language plpgsql;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.oracle b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.oracle
new file mode 100644
index 0000000..4e1cc4d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.oracle
@@ -0,0 +1,238 @@
+create or replace
+procedure delete_server (
+ server_id_in in number
+) is
+ cursor servergroups is
+ select server_id, server_group_id
+ from rhnServerGroupMembers sgm
+ where sgm.server_id = server_id_in;
+ cursor configchannels is
+ select cc.id
+ from rhnConfigChannel cc,
+ rhnConfigChannelType cct,
+ rhnServerConfigChannel scc
+ where 1=1
+ and scc.server_id = server_id_in
+ and scc.config_channel_id = cc.id
+ -- these config channel types are reserved
+ -- for use by a single server, so we don't
+ -- need to check for other servers subscribed
+ and cct.label in
+ ('local_override','server_import')
+ and cct.id = cc.confchan_type_id;
+ type filelistsid_t is table of rhnServerPreserveFileList.file_list_id%type;
+ filelistsid_c filelistsid_t;
+
+ type probesid_t is table of rhn_check_probe.probe_id%type;
+ probesid_c probesid_t;
+
+ is_virt number := 0;
+begin
+ rhn_channel.delete_server_channels(server_id_in);
+ -- rhn_channel.clear_subscriptions(server_id_in);
+
+ -- filelists
+ select spfl.file_list_id id bulk collect into filelistsid_c
+ from rhnServerPreserveFileList spfl
+ where spfl.server_id = server_id_in
+ and not exists (
+ select 1
+ from rhnServerPreserveFileList
+ where file_list_id = spfl.file_list_id
+ and server_id != server_id_in
+ union
+ select 1
+ from rhnKickstartPreserveFileList
+ where file_list_id = spfl.file_list_id
+ );
+ if filelistsid_c.first is not null then
+ forall i in filelistsid_c.first..filelistsid_c.last
+ delete from rhnFileList where id = filelistsid_c(i);
+ end if;
+
+ for configchannel in configchannels loop
+ rhn_config.delete_channel(configchannel.id);
+ end loop;
+
+ select count(1) into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host', 'virtualization_host_platform')
+ and rownum <= 1;
+
+ for sgm in servergroups loop
+ rhn_server.delete_from_servergroup(
+ sgm.server_id, sgm.server_group_id);
+ end loop;
+
+ if is_virt = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ -- we're handling this instead of letting an "on delete
+ -- set null" do it so that we don't run the risk
+ -- of setting off the triggers and killing us with a
+ -- mutating table
+
+ -- this is merge of two single updates:
+ -- update ... set old_server_id = null where old_server_id = server_id_in;
+ -- update ... set new_server_id = null where new_server_id = server_id_in;
+ -- so we scan rhnKickstartSession table only once
+ update rhnKickstartSession
+ set old_server_id = case when old_server_id = server_id_in then null else old_server_id end,
+ new_server_id = case when new_server_id = server_id_in then null else new_server_id end
+ where old_server_id = server_id_in
+ or new_server_id = server_id_in;
+
+ rhn_channel.clear_subscriptions(server_id_in,1);
+
+ -- A little complicated here, but the goal is to
+ -- delete records from rhnVirtualInstace only if we don't
+ -- care about them anymore. We don't care about records
+ -- in rhnVirtualInstance if we are deleting the host
+ -- system and the virtual system is already null, or
+ -- vice-versa. We *do* care about them if either the
+ -- host or virtual system is still registered because we
+ -- still want them to show up in the UI.
+ -- If there's a newer row in rhnVirtualInstance with the same
+ -- uuid, this guest must have been re-registered, so we can clean
+ -- this data up.
+
+ delete from rhnVirtualInstance vi
+ where (host_system_id = server_id_in and virtual_system_id is null)
+ or (virtual_system_id = server_id_in and host_system_id is null)
+ or (vi.virtual_system_id = server_id_in and vi.modified < (select max(vi2.modified)
+ from rhnVirtualInstance vi2 where vi2.uuid = vi.uuid));
+
+ -- this is merge of two single updates:
+ -- update ... set host_system_id = null where host_system_id = server_id_in;
+ -- update ... set virtual_system_id = null where virtual_system_id = server_id_in;
+ -- so we scan rhnVirtualInstance table only once
+ update rhnVirtualInstance
+ set host_system_id = case when host_system_id = server_id_in then null else host_system_id end,
+ virtual_system_id = case when virtual_system_id = server_id_in then null else virtual_system_id end
+ where host_system_id = server_id_in
+ or virtual_system_id = server_id_in;
+
+ -- this is merge of two single updates:
+ -- update ... set old_host_system_id = null when old_host_system_id = server_id_in;
+ -- update ... set new_host_system_id = null when new_host_system_id = server_id_in;
+ -- so we scan rhnVirtualInstanceEventLog table only once
+ update rhnVirtualInstanceEventLog
+ set old_host_system_id = case when old_host_system_id = server_id_in then null else old_host_system_id end,
+ new_host_system_id = case when new_host_system_id = server_id_in then null else new_host_system_id end
+ where old_host_system_id = server_id_in
+ or new_host_system_id = server_id_in;
+
+ -- We're deleting everything with a foreign key to rhnServer
+ -- here, now. I'm hoping this will help aleviate our deadlock
+ -- problem.
+
+ delete from rhnActionConfigChannel where server_id = server_id_in;
+ delete from rhnActionConfigRevision where server_id = server_id_in;
+ delete from rhnActionPackageRemovalFailure where server_id = server_id_in;
+ delete from rhnClientCapability where server_id = server_id_in;
+ delete from rhnCpu where server_id = server_id_in;
+ -- there's still a cascade here, because the constraint keeps the
+ -- table locked for too long to rebuild it. Ugh...
+ delete from rhnDevice where server_id = server_id_in;
+ delete from rhnProxyInfo where server_id = server_id_in;
+ delete from rhnRam where server_id = server_id_in;
+ delete from rhnRegToken where server_id = server_id_in;
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ -- this cascades to rhnActionConfigChannel and rhnActionConfigFileName
+ delete from rhnServerAction where server_id = server_id_in;
+ delete from rhnServerActionPackageResult where server_id = server_id_in;
+ delete from rhnServerActionScriptResult where server_id = server_id_in;
+ delete from rhnServerActionVerifyResult where server_id = server_id_in;
+ delete from rhnServerActionVerifyMissing where server_id = server_id_in;
+ -- counts are handled above. this should be a delete_ function.
+ delete from rhnServerChannel where server_id = server_id_in;
+ delete from rhnServerConfigChannel where server_id = server_id_in;
+ delete from rhnServerCustomDataValue where server_id = server_id_in;
+ delete from rhnServerDMI where server_id = server_id_in;
+ delete from rhnServerEvent where server_id = server_id_in;
+ delete from rhnServerHistory where server_id = server_id_in;
+ delete from rhnServerInfo where server_id = server_id_in;
+ delete from rhnServerInstallInfo where server_id = server_id_in;
+ delete from rhnServerLocation where server_id = server_id_in;
+ delete from rhnServerLock where server_id = server_id_in;
+ delete from rhnServerNeededCache where server_id = server_id_in;
+ delete from rhnServerNetwork where server_id = server_id_in;
+ delete from rhnServerNotes where server_id = server_id_in;
+ -- I'm not removing the foreign key from rhnServerPackage; that'll
+ -- take forever. Do the delete anyway.
+ delete from rhnServerPackage where server_id = server_id_in;
+ delete from rhnServerTokenRegs where server_id = server_id_in;
+ delete from rhnSnapshotTag where server_id = server_id_in;
+ -- this cascades to:
+ -- rhnSnapshotChannel, rhnSnapshotConfigChannel, rhnSnapshotPackage,
+ -- rhnSnapshotConfigRevision, rhnSnapshotServerGroup,
+ -- rhnSnapshotTag.
+ -- We may want to consider delete_snapshot() at some point, but
+ -- I don't think we need to yet.
+ delete from rhnSnapshot where server_id = server_id_in;
+ delete from rhnUserServerPrefs where server_id = server_id_in;
+ -- hrm, this one's interesting... we _probably_ should delete
+ -- everything for the parent server_id when we delete the proxy,
+ -- but we don't currently.
+ delete from rhnServerPath where server_id_in in (server_id, proxy_server_id);
+ delete from rhnUserServerPerms where server_id = server_id_in;
+
+ delete from rhnServerNetInterface where server_id = server_id_in;
+ delete from rhn_server_monitoring_info where recid = server_id_in;
+
+ delete from rhnAppInstallSession where server_id = server_id_in;
+ delete from rhnServerUuid where server_id = server_id_in;
+ -- We delete all the probes running directly against this system
+ -- and any probes that were using this Server as a Proxy Scout.
+ SELECT CP.probe_id bulk collect into probesid_c
+ FROM rhn_check_probe CP
+ WHERE CP.host_id = server_id_in
+ OR CP.sat_cluster_id in
+ (SELECT SN.sat_cluster_id
+ FROM rhn_sat_node SN
+ WHERE SN.server_id = server_id_in);
+
+ if probesid_c.first is not null then
+ FORALL i IN probesid_c.first..probesid_c.last
+ DELETE FROM rhn_probe_state PS WHERE PS.probe_id = probesid_c(i);
+ FORALL i IN probesid_c.first..probesid_c.last
+ DELETE FROM rhn_probe P WHERE P.recid = probesid_c(i);
+ FORALL i IN probesid_c.first..probesid_c.last
+ DELETE /*+index(time_series time_series_probe_id_idx)*/
+ FROM time_series
+ WHERE substr(o_id, instr(o_id, '-') + 1,
+ (instr(o_id, '-', instr(o_id, '-') + 1) - instr(o_id, '-')) - 1) = probesid_c(i);
+ end if;
+
+ delete from rhn_check_probe where host_id = server_id_in;
+ delete from rhn_host_probe where host_id = server_id_in;
+
+ delete from rhn_sat_cluster where recid in
+ ( select sat_cluster_id from rhn_sat_node where server_id = server_id_in );
+
+ delete from rhn_sat_node where server_id = server_id_in;
+
+ delete from rhnPushClient where server_id = server_id_in;
+
+ -- now get rhnServer itself.
+ delete
+ from rhnServer
+ where id = server_id_in;
+
+ delete
+ from rhnSet
+ where 1=1
+ and user_id in (
+ select wc.id
+ from rhnServer rs,
+ web_contact wc
+ where rs.id = server_id_in
+ and rs.org_id = wc.org_id
+ )
+ and label = 'system_list'
+ and element = server_id_in;
+end delete_server;
+/
+show errors;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.postgresql b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.postgresql
new file mode 100644
index 0000000..55c6067
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-1.4-to-spacewalk-schema-1.5/017-rhn_server.sql.postgresql
@@ -0,0 +1,240 @@
+create or replace
+function delete_server (
+ server_id_in in numeric
+) returns void
+as
+$$
+declare
+ servergroups cursor for
+ select server_id, server_group_id
+ from rhnServerGroupMembers sgm
+ where sgm.server_id = server_id_in;
+
+ configchannels cursor for
+ select cc.id
+ from rhnConfigChannel cc,
+ rhnConfigChannelType cct,
+ rhnServerConfigChannel scc
+ where 1=1
+ and scc.server_id = server_id_in
+ and scc.config_channel_id = cc.id
+ -- these config channel types are reserved
+ -- for use by a single server, so we don't
+ -- need to check for other servers subscribed
+ and cct.label in
+ ('local_override','server_import')
+ and cct.id = cc.confchan_type_id;
+
+ is_virt boolean;
+begin
+ perform rhn_channel.delete_server_channels(server_id_in);
+ -- rhn_channel.clear_subscriptions(server_id_in);
+
+ -- filelists
+ delete from rhnFileList where id in (
+ select spfl.file_list_id
+ from rhnServerPreserveFileList spfl
+ where spfl.server_id = server_id_in
+ and not exists (
+ select 1
+ from rhnServerPreserveFileList
+ where file_list_id = spfl.file_list_id
+ and server_id != server_id_in
+ union all
+ select 1
+ from rhnKickstartPreserveFileList
+ where file_list_id = spfl.file_list_id
+ )
+ );
+
+ for configchannel in configchannels loop
+ perform rhn_config.delete_channel(configchannel.id);
+ end loop;
+
+ is_virt := exists (
+ select 1
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host', 'virtualization_host_platform')
+ );
+
+ for sgm in servergroups loop
+ perform rhn_server.delete_from_servergroup(
+ sgm.server_id, sgm.server_group_id);
+ end loop;
+
+ if is_virt then
+ perform rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ -- we're handling this instead of letting an "on delete
+ -- set null" do it so that we don't run the risk
+ -- of setting off the triggers and killing us with a
+ -- mutating table
+
+ -- this is merge of two single updates:
+ -- update ... set old_server_id = null where old_server_id = server_id_in;
+ -- update ... set new_server_id = null where new_server_id = server_id_in;
+ -- so we scan rhnKickstartSession table only once
+ update rhnKickstartSession
+ set old_server_id = case when old_server_id = server_id_in then null else old_server_id end,
+ new_server_id = case when new_server_id = server_id_in then null else new_server_id end
+ where old_server_id = server_id_in
+ or new_server_id = server_id_in;
+
+ perform rhn_channel.clear_subscriptions(server_id_in,1);
+
+ -- A little complicated here, but the goal is to
+ -- delete records from rhnVirtualInstace only if we don't
+ -- care about them anymore. We don't care about records
+ -- in rhnVirtualInstance if we are deleting the host
+ -- system and the virtual system is already null, or
+ -- vice-versa. We *do* care about them if either the
+ -- host or virtual system is still registered because we
+ -- still want them to show up in the UI.
+ -- If there's a newer row in rhnVirtualInstance with the same
+ -- uuid, this guest must have been re-registered, so we can clean
+ -- this data up.
+
+ delete from rhnVirtualInstance vi
+ where (host_system_id = server_id_in and virtual_system_id is null)
+ or (virtual_system_id = server_id_in and host_system_id is null)
+ or (vi.virtual_system_id = server_id_in and vi.modified < (select max(vi2.modified)
+ from rhnVirtualInstance vi2 where vi2.uuid = vi.uuid));
+
+ -- this is merge of two single updates:
+ -- update ... set host_system_id = null where host_system_id = server_id_in;
+ -- update ... set virtual_system_id = null where virtual_system_id = server_id_in;
+ -- so we scan rhnVirtualInstance table only once
+ update rhnVirtualInstance
+ set host_system_id = case when host_system_id = server_id_in then null else host_system_id end,
+ virtual_system_id = case when virtual_system_id = server_id_in then null else virtual_system_id end
+ where host_system_id = server_id_in
+ or virtual_system_id = server_id_in;
+
+ -- this is merge of two single updates:
+ -- update ... set old_host_system_id = null when old_host_system_id = server_id_in;
+ -- update ... set new_host_system_id = null when new_host_system_id = server_id_in;
+ -- so we scan rhnVirtualInstanceEventLog table only once
+ update rhnVirtualInstanceEventLog
+ set old_host_system_id = case when old_host_system_id = server_id_in then null else old_host_system_id end,
+ new_host_system_id = case when new_host_system_id = server_id_in then null else new_host_system_id end
+ where old_host_system_id = server_id_in
+ or new_host_system_id = server_id_in;
+
+ -- We're deleting everything with a foreign key to rhnServer
+ -- here, now. I'm hoping this will help aleviate our deadlock
+ -- problem.
+
+ delete from rhnActionConfigChannel where server_id = server_id_in;
+ delete from rhnActionConfigRevision where server_id = server_id_in;
+ delete from rhnActionPackageRemovalFailure where server_id = server_id_in;
+ delete from rhnClientCapability where server_id = server_id_in;
+ delete from rhnCpu where server_id = server_id_in;
+ -- there's still a cascade here, because the constraint keeps the
+ -- table locked for too long to rebuild it. Ugh...
+ delete from rhnDevice where server_id = server_id_in;
+ delete from rhnProxyInfo where server_id = server_id_in;
+ delete from rhnRam where server_id = server_id_in;
+ delete from rhnRegToken where server_id = server_id_in;
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ -- this cascades to rhnActionConfigChannel and rhnActionConfigFileName
+ delete from rhnServerAction where server_id = server_id_in;
+ delete from rhnServerActionPackageResult where server_id = server_id_in;
+ delete from rhnServerActionScriptResult where server_id = server_id_in;
+ delete from rhnServerActionVerifyResult where server_id = server_id_in;
+ delete from rhnServerActionVerifyMissing where server_id = server_id_in;
+ -- counts are handled above. this should be a delete_ function.
+ delete from rhnServerChannel where server_id = server_id_in;
+ delete from rhnServerConfigChannel where server_id = server_id_in;
+ delete from rhnServerCustomDataValue where server_id = server_id_in;
+ delete from rhnServerDMI where server_id = server_id_in;
+ delete from rhnServerEvent where server_id = server_id_in;
+ delete from rhnServerHistory where server_id = server_id_in;
+ delete from rhnServerInfo where server_id = server_id_in;
+ delete from rhnServerInstallInfo where server_id = server_id_in;
+ delete from rhnServerLocation where server_id = server_id_in;
+ delete from rhnServerLock where server_id = server_id_in;
+ delete from rhnServerNeededCache where server_id = server_id_in;
+ delete from rhnServerNetwork where server_id = server_id_in;
+ delete from rhnServerNotes where server_id = server_id_in;
+ -- I'm not removing the foreign key from rhnServerPackage; that'll
+ -- take forever. Do the delete anyway.
+ delete from rhnServerPackage where server_id = server_id_in;
+ delete from rhnServerTokenRegs where server_id = server_id_in;
+ delete from rhnSnapshotTag where server_id = server_id_in;
+ -- this cascades to:
+ -- rhnSnapshotChannel, rhnSnapshotConfigChannel, rhnSnapshotPackage,
+ -- rhnSnapshotConfigRevision, rhnSnapshotServerGroup,
+ -- rhnSnapshotTag.
+ -- We may want to consider delete_snapshot() at some point, but
+ -- I don't think we need to yet.
+ delete from rhnSnapshot where server_id = server_id_in;
+ delete from rhnUserServerPrefs where server_id = server_id_in;
+ -- hrm, this one's interesting... we _probably_ should delete
+ -- everything for the parent server_id when we delete the proxy,
+ -- but we don't currently.
+ delete from rhnServerPath where server_id_in in (server_id, proxy_server_id);
+ delete from rhnUserServerPerms where server_id = server_id_in;
+
+ delete from rhnServerNetInterface where server_id = server_id_in;
+ delete from rhn_server_monitoring_info where recid = server_id_in;
+
+ delete from rhnAppInstallSession where server_id = server_id_in;
+ delete from rhnServerUuid where server_id = server_id_in;
+
+ -- We delete all the probes running directly against this system
+ -- and any probes that were using this Server as a Proxy Scout.
+ DELETE FROM rhn_probe_state PS WHERE PS.probe_id IN (
+ SELECT CP.probe_id
+ FROM rhn_check_probe CP
+ WHERE CP.host_id = server_id_in
+ OR CP.sat_cluster_id in
+ (SELECT SN.sat_cluster_id
+ FROM rhn_sat_node SN
+ WHERE SN.server_id = server_id_in)
+ );
+
+ DELETE FROM rhn_probe P WHERE P.recid IN (
+ SELECT CP.probe_id
+ FROM rhn_check_probe CP
+ WHERE CP.host_id = server_id_in
+ OR CP.sat_cluster_id in
+ (SELECT SN.sat_cluster_id
+ FROM rhn_sat_node SN
+ WHERE SN.server_id = server_id_in)
+ );
+
+ -- delete from time_series TODO
+
+ delete from rhn_check_probe where host_id = server_id_in;
+ delete from rhn_host_probe where host_id = server_id_in;
+
+ delete from rhn_sat_cluster where recid in
+ ( select sat_cluster_id from rhn_sat_node where server_id = server_id_in );
+
+ delete from rhn_sat_node where server_id = server_id_in;
+
+ delete from rhnPushClient where server_id = server_id_in;
+
+ -- now get rhnServer itself.
+ delete
+ from rhnServer
+ where id = server_id_in;
+
+ delete
+ from rhnSet
+ where 1=1
+ and user_id in (
+ select wc.id
+ from rhnServer rs,
+ web_contact wc
+ where rs.id = server_id_in
+ and rs.org_id = wc.org_id
+ )
+ and label = 'system_list'
+ and element = server_id_in;
+end;
+$$
+language plpgsql;
+
12 years, 10 months