rel-eng/packages schema/spacewalk
by Milan Zazrivec
rel-eng/packages/spacewalk-schema | 2 +-
schema/spacewalk/spacewalk-schema.spec | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
New commits:
commit a523e850233d03453ca45048d5f22be0522b8953
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 16:07:52 2009 +0200
Automatic commit of package [spacewalk-schema] release [0.6.21-1].
diff --git a/rel-eng/packages/spacewalk-schema b/rel-eng/packages/spacewalk-schema
index 190f8ec..1ef73db 100644
--- a/rel-eng/packages/spacewalk-schema
+++ b/rel-eng/packages/spacewalk-schema
@@ -1 +1 @@
-0.6.20-1 schema/spacewalk/
+0.6.21-1 schema/spacewalk/
diff --git a/schema/spacewalk/spacewalk-schema.spec b/schema/spacewalk/spacewalk-schema.spec
index b0bacf6..962e6d6 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: 0.6.20
+Version: 0.6.21
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
@@ -58,6 +58,12 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/spacewalk-schema-upgrade*
%changelog
+* Thu Aug 06 2009 Milan Zazrivec <mzazrivec(a)redhat.com> 0.6.21-1
+- remove symlinks from schema upgrades
+- consistent data in new & upgraded schema
+- create or replace function needs to be followed by execute
+- remove extraneous execute after create index
+
* Wed Aug 05 2009 John Matthews <jmatthew(a)redhat.com> 0.6.20-1
- bugfix patch on selinux config file deploy (joshua.roys(a)gtri.gatech.edu)
- use new path to merged schema file (mzazrivec(a)redhat.com)
14 years, 7 months
2 commits - schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2 | 1
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/001-rhnServerArch_data-solaris-sun4v.sql | 13
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/002-rhnPackageArch_data-solaris-sun4v.sql | 13
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/004-rhnCpuArch_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql | 33
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql | 94
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql | 23
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql | 11
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/010-rhnKSInstallType_data-fedora_9.sql | 4
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/011-rhnKickstartCommandName_data-fedora_9.sql | 7
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/012-rhnTemplateString_data-strings.sql | 13
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/014-remove-db_change-tables.sql | 14
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-1-rhnActionType-name.sql | 4
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-2-rhnActionType-strings.sql | 17
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/021-rhnFAQClass-strings.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/022-rhnFAQ-purge.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/023-rhnFAQ_satdata.sql | 760 ++++
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/024-rhnKSTreeType-strings.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/025-rhnKickstartSessionState-strings.sql | 9
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/026-rhnOrgEntitlementType-strings.sql | 21
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/027-rhnServerGroupType-strings.sql | 17
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/028-rhnTemplateString_data-strings.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/029-rhnUserGroupType_data-strings.sql | 9
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/030-rhn_config_macro_data-strings.sql | 36
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/031-rhn_notification_formats_data-strings.sql | 6
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/032-rhn_command.sql | 4
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/033-rhn_command_queue_commands_data.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/034-rhn_config_parameter_data.sql.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/035-check_email_uniqueness-drop.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/040-rhnPackage-index-nevra.sql | 10
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/041-rhnPackageProvider-nevra.sql | 61
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/042-rhnPackageKeyType-nevra.sql | 61
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/043-rhnPackageKey-nevra.sql | 68
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/044-rhnPackageKeyAssociation-nevra.sql | 45
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/045-lookup_package_key_type-nevra.sql | 38
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/046-lookup_package_provider-nevra.sql | 38
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/047-rhnPackageKeyType_data-nevra.sql | 34
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/048-rhnPackageProvider_data-nevra.sql | 39
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/049-rhnPackageKey_data-nevra.sql | 59
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/050-rhnException_data-nevra.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/051-lookup_package_key_type-non-deterministic.sql | 37
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/052-lookup_package_provider-non-deterministic.sql | 37
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-1-rhnPackageSignature-drop.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-2-rhn_package_sig_id_seq-drop.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-1-rhnPackageSigType-drop.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-0-rhnPackageChangeLog-sequence.sql | 3
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-1-rhnPackageChangeLog-id.sql | 4
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-2-rhnPackageChangeLog-id-data.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-3-rhnPackageChangeLog-id-not-null.sql | 7
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/056-create_new_org-no-password.sql | 146
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/057-create_first_org-no-password.sql | 172 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/058-web_customer-drop-password.sql | 4
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/060-rhn_channel-deterministic.sql | 1368 +++++++
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/061-rhn_package-deterministic.sql | 45
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/062-rpm.pks-non-deterministic.sql | 56
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/063-rpm.pkb-deterministic.sql | 267 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/064-channel_name_join-deterministic.sql | 52
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/065-id_join-deterministic.sql | 53
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/066-label_join-deterministic.sql | 53
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/067-lookup_channel_arch-non-deterministic.sql | 46
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/068-lookup_client_capability-non-deterministic.sql | 47
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/069-lookup_config_filename-non-deterministic.sql | 46
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/070-lookup_cve-non-deterministic.sql | 52
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/071-lookup_evr-non-deterministic.sql | 48
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/072-lookup_package_arch-non-deterministic.sql | 50
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/073-lookup_package_capability-non-deterministic.sql | 55
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/074-lookup_package_delta-non-deterministic.sql | 46
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/075-lookup_package_name-non-deterministic.sql | 58
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/076-lookup_server_arch-non-deterministic.sql | 46
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql | 45
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/078-lookup_source_name-non-deterministic.sql | 46
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/079-lookup_tag-non-deterministic.sql | 49
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/080-lookup_tag_name-non-deterministic.sql | 47
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/081-lookup_transaction_package-non-deterministic.sql | 83
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/082-name_join-deterministic.sql | 53
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/083-truncateCacheQueue-execute-immediate.sql | 29
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/084-rhnServerNeededPackageCache-indexes.sql | 42
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/090-enable-row-movement.sql | 391 ++
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/091-rhn_command_parameter_data-user.sql | 5
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/092-rhn_command_parameter_data-sshbannerignore.sql | 127
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/093-rhnChannelCloned_triggers.sql | 41
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql | 12
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/103-rhnKSData.sql | 7
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/104-rhnKSData.sql | 7
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/105-rhnKSData.sql | 13
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/200-rhn_cache.pks.sql | 45
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/201-rhn_cache.pkb.sql | 92
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/202-rhn_channel.pks.sql | 246 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/203-rhn_channel.pkb.sql | 1368 +++++++
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/204-rhn_entitlements.pks.sql | 225 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/205-rhn_entitlements.pkb.sql | 1719 ++++++++++
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/206-rhn_org.pks.sql | 55
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/207-rhn_org.pkb.sql | 304 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pkb.sql | 308 +
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pks.sql | 64
schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/500-rhnPrivateErrataMail.sql | 155
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/001-rhnServerArch_data-solaris-sun4v.sql | 13
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/002-rhnPackageArch_data-solaris-sun4v.sql | 13
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/004-rhnCpuArch_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql | 11
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql | 33
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql | 94
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql | 23
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql | 11
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/010-rhnKSInstallType_data-fedora_9.sql | 4
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/011-rhnKickstartCommandName_data-fedora_9.sql | 7
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/012-rhnTemplateString_data-strings.sql | 13
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/014-remove-db_change-tables.sql | 14
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-1-rhnActionType-name.sql | 4
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-2-rhnActionType-strings.sql | 17
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/021-rhnFAQClass-strings.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/022-rhnFAQ-purge.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/023-rhnFAQ_satdata.sql | 760 ----
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/024-rhnKSTreeType-strings.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/025-rhnKickstartSessionState-strings.sql | 9
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/026-rhnOrgEntitlementType-strings.sql | 21
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/027-rhnServerGroupType-strings.sql | 17
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/028-rhnTemplateString_data-strings.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/029-rhnUserGroupType_data-strings.sql | 9
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/030-rhn_config_macro_data-strings.sql | 36
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/031-rhn_notification_formats_data-strings.sql | 6
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/032-rhn_command.sql | 4
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/033-rhn_command_queue_commands_data.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/034-rhn_config_parameter_data.sql.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/035-check_email_uniqueness-drop.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/040-rhnPackage-index-nevra.sql | 10
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/041-rhnPackageProvider-nevra.sql | 61
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/042-rhnPackageKeyType-nevra.sql | 61
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/043-rhnPackageKey-nevra.sql | 68
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/044-rhnPackageKeyAssociation-nevra.sql | 45
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/045-lookup_package_key_type-nevra.sql | 38
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/046-lookup_package_provider-nevra.sql | 38
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/047-rhnPackageKeyType_data-nevra.sql | 34
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/048-rhnPackageProvider_data-nevra.sql | 39
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/049-rhnPackageKey_data-nevra.sql | 59
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/050-rhnException_data-nevra.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/051-lookup_package_key_type-non-deterministic.sql | 37
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/052-lookup_package_provider-non-deterministic.sql | 37
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-1-rhnPackageSignature-drop.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-2-rhn_package_sig_id_seq-drop.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-1-rhnPackageSigType-drop.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-0-rhnPackageChangeLog-sequence.sql | 3
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-1-rhnPackageChangeLog-id.sql | 4
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-2-rhnPackageChangeLog-id-data.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-3-rhnPackageChangeLog-id-not-null.sql | 7
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/056-create_new_org-no-password.sql | 146
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/057-create_first_org-no-password.sql | 172 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/058-web_customer-drop-password.sql | 4
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/060-rhn_channel-deterministic.sql | 1368 -------
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/061-rhn_package-deterministic.sql | 45
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/062-rpm.pks-non-deterministic.sql | 56
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/063-rpm.pkb-deterministic.sql | 267 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/064-channel_name_join-deterministic.sql | 52
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/065-id_join-deterministic.sql | 53
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/066-label_join-deterministic.sql | 53
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/067-lookup_channel_arch-non-deterministic.sql | 46
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/068-lookup_client_capability-non-deterministic.sql | 47
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/069-lookup_config_filename-non-deterministic.sql | 46
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/070-lookup_cve-non-deterministic.sql | 52
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/071-lookup_evr-non-deterministic.sql | 48
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/072-lookup_package_arch-non-deterministic.sql | 50
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/073-lookup_package_capability-non-deterministic.sql | 55
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/074-lookup_package_delta-non-deterministic.sql | 46
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/075-lookup_package_name-non-deterministic.sql | 58
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/076-lookup_server_arch-non-deterministic.sql | 46
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql | 45
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/078-lookup_source_name-non-deterministic.sql | 46
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/079-lookup_tag-non-deterministic.sql | 49
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/080-lookup_tag_name-non-deterministic.sql | 47
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/081-lookup_transaction_package-non-deterministic.sql | 83
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/082-name_join-deterministic.sql | 53
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/083-truncateCacheQueue-execute-immediate.sql | 29
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/084-rhnServerNeededPackageCache-indexes.sql | 42
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/090-enable-row-movement.sql | 391 --
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/091-rhn_command_parameter_data-user.sql | 5
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/092-rhn_command_parameter_data-sshbannerignore.sql | 127
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/093-rhnChannelCloned_triggers.sql | 41
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql | 12
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/103-rhnKSData.sql | 7
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/104-rhnKSData.sql | 7
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/105-rhnKSData.sql | 13
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/200-rhn_cache.pks.sql | 45
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/201-rhn_cache.pkb.sql | 92
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/202-rhn_channel.pks.sql | 246 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/203-rhn_channel.pkb.sql | 1368 -------
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/204-rhn_entitlements.pks.sql | 225 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/205-rhn_entitlements.pkb.sql | 1719 ----------
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/206-rhn_org.pks.sql | 55
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/207-rhn_org.pkb.sql | 304 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pkb.sql | 308 -
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pks.sql | 64
schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/500-rhnPrivateErrataMail.sql | 155
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/100-rhnCpuArch-i86pc.sql | 9
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/101-rhnKickstartPackage-position.sql | 12
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/102-rhnIndexerWork-last_modified.sql | 8
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-drop-rhn-clean-current-state.sql | 1
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-rhn_config_parameter_data-move_opt.sql | 13
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-drop-is-user-org-admin.sql | 1
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-rhn_command-move_opt.sql | 4
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/105-rhn_command_queue_commands-move_opt.sql | 3
schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/110-rhn_contact_groups-cleanup.sql | 8
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/112-rhnKSData-drop-name.sql | 35
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/113-rhnActionKickstart-add-kshost.sql | 27
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/114-rhnChannelTrust.sql | 51
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/115-rhnChannel-add-maint-columns.sql | 54
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/116-rhnTrustedOrgs.sql | 45
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/117-rhnAllowTrust.sql | 42
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/118-rhnSystemMigrations.sql | 51
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/119-rhnSharedChannelView.sql | 55
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/120-rhnUserChannel.sql | 66
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/121-rhn_channel.pks.sql | 250 -
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/122-rhn_channel.pkb.sql | 1398 --------
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/123-rhnServerActionVerify-chg-indexes.sql | 42
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/130-delete_server.sql | 268 -
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/131-delete_server_bulk.sql | 40
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/132-rhnActionKickstartGuest-add-kshost.sql | 35
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/133-rhnKickstartVirtualizationType-update.sql | 43
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/135-rhn_config_macro_data.sql | 9
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/136-rhn_config_parameter_data.sql | 27
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/137-rhnKickstartableTree.sql | 32
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/138-rhnRegTokenPackages.sql | 48
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/139-rhnKickstartableTrees.sql | 28
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/140-rhnActionKickstart-drop-kstree_id.sql | 28
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql | 28
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/142-rhnSet-add-element3.sql | 26
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/143-rhnServerProfilePackage-add-arch.sql | 23
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/144-rhnSharedChannelTreeView.sql | 66
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/145-rhnAvailableChannels.sql | 85
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/146-rhnKSData-add-type.sql | 37
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/150-rhn_org.pkb.sql | 321 -
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/151-rhnServer-add-cobbler_id.sql | 29
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/152-rhnKSInstallType-add-generic.sql | 39
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/153-rhnErrata-increase-advisory.sql | 20
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/154-rhnErrataTmp-increase-advisory.sql | 20
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/155-rhnPackageCapability-increase-name.sql | 20
schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/156-rhnPackage-compat-number.sql | 23
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/100-errata-cache.sql | 433 --
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/150-rhnMultiorg-sharing.sql | 88
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/151-rhn_org.pkb.sql | 344 --
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/152-rhnSsmOperation.sql | 50
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/153-rhnPackage-pathidx.sql | 24
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/160-rhnSourceRPM.sql | 13
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/161-rhnKickstartVirtualizationType-update.sql | 44
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/162-rhnRepoRegenQueue.sql | 29
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/163-rhn_config_parameter_data.sql | 9
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/170-rhnErrataNotificationQueue.sql | 3
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/180-rhnServerGroup_indexes.sql | 6
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/181-rhnServerGroupMembers_indexes.sql | 3
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/182-rhnServerNeededCache_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/183-rhnServerPackage_indexes.sql | 3
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/184-rhnUserGroup_indexes.sql | 6
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/185-rhnUserGroupMembers_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/186-web_contact_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/187-web_user_site_info_index.sql | 3
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/188-rhnUserInfo_data.sql | 19
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/189-rhnReleaseChannelMap-unique.sql | 3
schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/99-rhnPackage-Copyright.sql | 9
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/100-rhnCpuArch-i86pc.sql | 9
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/101-rhnKickstartPackage-position.sql | 12
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/102-rhnIndexerWork-last_modified.sql | 8
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-drop-rhn-clean-current-state.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-rhn_config_parameter_data-move_opt.sql | 13
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-drop-is-user-org-admin.sql | 1
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-rhn_command-move_opt.sql | 4
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/105-rhn_command_queue_commands-move_opt.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/110-rhn_contact_groups-cleanup.sql | 8
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/112-rhnKSData-drop-name.sql | 35
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/113-rhnActionKickstart-add-kshost.sql | 27
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/114-rhnChannelTrust.sql | 51
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/115-rhnChannel-add-maint-columns.sql | 54
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/116-rhnTrustedOrgs.sql | 45
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/117-rhnAllowTrust.sql | 42
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/118-rhnSystemMigrations.sql | 51
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/119-rhnSharedChannelView.sql | 55
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/120-rhnUserChannel.sql | 66
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/121-rhn_channel.pks.sql | 250 +
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/122-rhn_channel.pkb.sql | 1398 ++++++++
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/123-rhnServerActionVerify-chg-indexes.sql | 42
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/130-delete_server.sql | 268 +
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/131-delete_server_bulk.sql | 40
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/132-rhnActionKickstartGuest-add-kshost.sql | 35
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/133-rhnKickstartVirtualizationType-update.sql | 43
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/135-rhn_config_macro_data.sql | 9
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/136-rhn_config_parameter_data.sql | 27
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/137-rhnKickstartableTree.sql | 32
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/138-rhnRegTokenPackages.sql | 48
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/139-rhnKickstartableTrees.sql | 28
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/140-rhnActionKickstart-drop-kstree_id.sql | 28
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql | 28
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/142-rhnSet-add-element3.sql | 26
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/143-rhnServerProfilePackage-add-arch.sql | 23
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/144-rhnSharedChannelTreeView.sql | 66
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/145-rhnAvailableChannels.sql | 85
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/146-rhnKSData-add-type.sql | 37
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/150-rhn_org.pkb.sql | 321 +
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/151-rhnServer-add-cobbler_id.sql | 29
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/152-rhnKSInstallType-add-generic.sql | 39
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/153-rhnErrata-increase-advisory.sql | 20
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/154-rhnErrataTmp-increase-advisory.sql | 20
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/155-rhnPackageCapability-increase-name.sql | 20
schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/156-rhnPackage-compat-number.sql | 23
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5 | 1
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/100-errata-cache.sql | 433 ++
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/150-rhnMultiorg-sharing.sql | 88
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/151-rhn_org.pkb.sql | 344 ++
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/152-rhnSsmOperation.sql | 50
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/153-rhnPackage-pathidx.sql | 24
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/160-rhnSourceRPM.sql | 13
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/161-rhnKickstartVirtualizationType-update.sql | 44
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/162-rhnRepoRegenQueue.sql | 29
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/163-rhn_config_parameter_data.sql | 9
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/170-rhnErrataNotificationQueue.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/180-rhnServerGroup_indexes.sql | 6
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/181-rhnServerGroupMembers_indexes.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/182-rhnServerNeededCache_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/183-rhnServerPackage_indexes.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/184-rhnUserGroup_indexes.sql | 6
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/185-rhnUserGroupMembers_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/186-web_contact_indexes.sql | 4
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/187-web_user_site_info_index.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/188-rhnUserInfo_data.sql | 19
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/189-rhnReleaseChannelMap-unique.sql | 3
schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/99-rhnPackage-Copyright.sql | 9
330 files changed, 14594 insertions(+), 14598 deletions(-)
New commits:
commit a7b6c5482a406474d0a9c95366f616036c4fbd91
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 16:01:25 2009 +0200
rename schema upgrade directories
Rename directories with schema upgrade scripts so that we don't need
symlinks in here.
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/001-rhnServerArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/001-rhnServerArch_data-solaris-sun4v.sql
new file mode 100644
index 0000000..03024f7
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/001-rhnServerArch_data-solaris-sun4v.sql
@@ -0,0 +1,13 @@
+insert into rhnServerArch (id, label, name, arch_type_id) (
+ select rhn_server_arch_id_seq.nextval,
+ 'sparc-sun4v-solaris',
+ 'Sparc Solaris',
+ lookup_arch_type('sysv-solaris')
+ from dual
+ where not exists (
+ select label, name, arch_type_id
+ from rhnServerArch
+ where label = 'sparc-sun4v-solaris' and
+ name = 'Sparc Solaris' and
+ arch_type_id = lookup_arch_type('sysv-solaris'))
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/002-rhnPackageArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/002-rhnPackageArch_data-solaris-sun4v.sql
new file mode 100644
index 0000000..14a70ac
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/002-rhnPackageArch_data-solaris-sun4v.sql
@@ -0,0 +1,13 @@
+insert into rhnPackageArch (id, label, name, arch_type_id) (
+ select rhn_package_arch_id_seq.nextval,
+ 'sparc.sun4v-solaris',
+ 'Sparc Solaris sun4v',
+ lookup_arch_type('sysv-solaris')
+ from dual
+ where not exists (
+ select id, label, name, arch_type_id
+ from rhnPackageArch
+ where label = 'sparc.sun4v-solaris' and
+ name = 'Sparc Solaris sun4v'and
+ arch_type_id = lookup_arch_type('sysv-solaris'))
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql
new file mode 100644
index 0000000..d5cf7f1
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql
@@ -0,0 +1,11 @@
+insert into rhnChannelPackageArchCompat (channel_arch_id, package_arch_id) (
+ select lookup_channel_arch('channel-sparc-sun-solaris'),
+ lookup_package_arch('sparc.sun4v-solaris')
+ from dual
+ where not exists (
+ select channel_arch_id, package_arch_id
+ from rhnChannelPackageArchCompat
+ where channel_arch_id = lookup_channel_arch('channel-sparc-sun-solaris') and
+ package_arch_id = lookup_package_arch('sparc.sun4v-solaris')
+ )
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/004-rhnCpuArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/004-rhnCpuArch_data-solaris-sun4v.sql
new file mode 100644
index 0000000..2ceadc0
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/004-rhnCpuArch_data-solaris-sun4v.sql
@@ -0,0 +1,11 @@
+insert into rhnCpuArch (id, label, name) (
+ select rhn_cpu_arch_id_seq.nextval,
+ 'sun4v',
+ 'sun4v'
+ from dual
+ where not exists (
+ select label, name
+ from rhnCpuArch
+ where label = 'sun4v' and
+ name = 'sun4v')
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql
new file mode 100644
index 0000000..f990c26
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql
@@ -0,0 +1,11 @@
+insert into rhnServerChannelArchCompat (server_arch_id, channel_arch_id) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_channel_arch('channel-sparc-sun-solaris')
+ from dual
+ where not exists (
+ select server_arch_id, channel_arch_id
+ from rhnServerChannelArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ channel_arch_id = lookup_channel_arch('channel-sparc-sun-solaris')
+ )
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql
new file mode 100644
index 0000000..289f28c
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql
@@ -0,0 +1,33 @@
+update rhnServerPackageArchCompat
+set preference = 710
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris-patch-cluster');
+
+update rhnServerPackageArchCompat
+set preference = 610
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris-patch');
+
+update rhnServerPackageArchCompat
+set preference = 510
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris');
+
+update rhnServerPackageArchCompat
+set preference = 410
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris-patch-cluster');
+
+update rhnServerPackageArchCompat
+set preference = 310
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris-patch');
+
+update rhnServerPackageArchCompat
+set preference = 210
+where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
+ and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris');
+
+insert into rhnServerPackageArchCompat
+(server_arch_id, package_arch_id, preference) values
+(LOOKUP_SERVER_ARCH('sparc-sun4m-solaris'), LOOKUP_PACKAGE_ARCH('sparc.sun4v-solaris'), 100);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql
new file mode 100644
index 0000000..d78834a
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql
@@ -0,0 +1,94 @@
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'), lookup_package_arch('sparc.sun4v-solaris'), 10
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('sparc.sun4v-solaris') and
+ preference = 10)
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('sparc-solaris'),
+ 100
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('sparc-solaris') and
+ preference = 100
+ )
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('sparc-solaris-patch'),
+ 210
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('sparc-solaris-patch') and
+ preference = 210
+ )
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('sparc-solaris-patch-cluster'),
+ 310
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('sparc-solaris-patch-cluster') and
+ preference = 310
+ )
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('noarch-solaris'),
+ 410
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('noarch-solaris') and
+ preference = 410
+ )
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('noarch-solaris-patch'),
+ 510
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('noarch-solaris-patch') and
+ preference = 510
+ )
+);
+
+insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
+ select lookup_server_arch('sparc-sun4v-solaris'),
+ lookup_package_arch('noarch-solaris-patch-cluster'),
+ 610
+ from dual
+ where not exists (
+ select server_arch_id, package_arch_id, preference
+ from rhnServerPackageArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ package_arch_id = lookup_package_arch('noarch-solaris-patch-cluster') and
+ preference = 610
+ )
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql
new file mode 100644
index 0000000..aa5447f
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql
@@ -0,0 +1,23 @@
+insert into rhnServerServerGroupArchCompat (server_arch_id, server_group_type) (
+ select lookup_server_arch('sparc-sun4v-solaris'), lookup_sg_type('enterprise_entitled')
+ from dual
+ where not exists (
+ select server_arch_id,
+ server_group_type
+ from rhnServerServerGroupArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ server_group_type = lookup_sg_type('enterprise_entitled')
+ )
+);
+
+insert into rhnServerServerGroupArchCompat (server_arch_id, server_group_type) (
+ select lookup_server_arch('sparc-sun4v-solaris'), lookup_sg_type('provisioning_entitled')
+ from dual
+ where not exists (
+ select server_arch_id,
+ server_group_type
+ from rhnServerServerGroupArchCompat
+ where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
+ server_group_type = lookup_sg_type('provisioning_entitled')
+ )
+);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql
new file mode 100644
index 0000000..24e8cd4
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql
@@ -0,0 +1,11 @@
+insert into rhnServerPackageArchCompat
+(server_arch_id, package_arch_id, preference) values
+(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris'), 410);
+
+insert into rhnServerPackageArchCompat
+(server_arch_id, package_arch_id, preference) values
+(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris-patch'), 510);
+
+insert into rhnServerPackageArchCompat
+(server_arch_id, package_arch_id, preference) values
+(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris-patch-cluster'), 610);
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/010-rhnKSInstallType_data-fedora_9.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/010-rhnKSInstallType_data-fedora_9.sql
new file mode 100644
index 0000000..1f95d1f
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/010-rhnKSInstallType_data-fedora_9.sql
@@ -0,0 +1,4 @@
+insert into rhnKSInstallType (id, label, name)
+ values (rhn_ksinstalltype_id_seq.nextval,
+ 'fedora_9','Fedora 9'
+ );
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/011-rhnKickstartCommandName_data-fedora_9.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/011-rhnKickstartCommandName_data-fedora_9.sql
new file mode 100644
index 0000000..696db8e
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/011-rhnKickstartCommandName_data-fedora_9.sql
@@ -0,0 +1,7 @@
+update rhnKickstartCommandName
+set required = 'N'
+where name = 'langsupport';
+
+update rhnKickstartCommandName
+set required = 'N'
+where name = 'mouse';
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/012-rhnTemplateString_data-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/012-rhnTemplateString_data-strings.sql
new file mode 100644
index 0000000..ec30e28
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/012-rhnTemplateString_data-strings.sql
@@ -0,0 +1,13 @@
+
+update rhnTemplateString
+set description = 'Footer for Spacewalk e-mail'
+where label = 'email_footer';
+
+update rhnTemplateString
+set value = '
+Account Information:
+ Your Spacewalk login: <login />
+ Your Spacewalk email address: <email-address />',
+description = 'Account info lines for Spacewalk e-mail'
+where label = 'email_account_info';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/014-remove-db_change-tables.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/014-remove-db_change-tables.sql
new file mode 100644
index 0000000..bf030a0
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/014-remove-db_change-tables.sql
@@ -0,0 +1,14 @@
+
+drop table db_change_history cascade constraints;
+drop table db_change_history_output cascade constraints;
+drop table db_change_ignore_errs cascade constraints;
+drop table db_change_lock cascade constraints;
+drop table db_change_resource_changes cascade constraints;
+drop table db_change_resource_names cascade constraints;
+drop table db_change_resource_types cascade constraints;
+drop table db_change_resources cascade constraints;
+drop table db_change_script cascade constraints;
+drop table db_change_script_expanded cascade constraints;
+drop table db_change_script_parsed cascade constraints;
+drop table db_change_script_source cascade constraints;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-1-rhnActionType-name.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-1-rhnActionType-name.sql
new file mode 100644
index 0000000..19ea516
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-1-rhnActionType-name.sql
@@ -0,0 +1,4 @@
+
+alter table rhnActionType
+modify name varchar2(100);
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-2-rhnActionType-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-2-rhnActionType-strings.sql
new file mode 100644
index 0000000..d379fc2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/020-2-rhnActionType-strings.sql
@@ -0,0 +1,17 @@
+
+update rhnActionType
+set name = 'Spacewalk Daemon Configuration'
+where label = 'rhnsd.configure';
+
+update rhnActionType
+set name = 'Allows for rhn-applet use with an Spacewalk'
+where label = 'rhn_applet.use_satellite';
+
+update rhnActionType
+set name = 'Subscribes a server to the Spacewalk Tools channel associated with its base channel.'
+where label = 'kickstart_host.add_tools_channel';
+
+update rhnActionType
+set name = 'Subscribes a virtualization guest to the Spacewalk Tools channel associated with its base channel.'
+where label = 'kickstart_guest.add_tools_channel';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/021-rhnFAQClass-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/021-rhnFAQClass-strings.sql
new file mode 100644
index 0000000..89e69f3
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/021-rhnFAQClass-strings.sql
@@ -0,0 +1,5 @@
+
+update RHNFAQCLASS
+set name = 'Using Spacewalk'
+where label = 'using_rhn';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/022-rhnFAQ-purge.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/022-rhnFAQ-purge.sql
new file mode 100644
index 0000000..8da8dd2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/022-rhnFAQ-purge.sql
@@ -0,0 +1,3 @@
+
+delete from RHNFAQ;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/023-rhnFAQ_satdata.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/023-rhnFAQ_satdata.sql
new file mode 100644
index 0000000..b48f345
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/023-rhnFAQ_satdata.sql
@@ -0,0 +1,760 @@
+--
+-- 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.
+--
+-- $Id$
+--
+-- EXCLUDE: production
+
+-- data for rhnFAQ in the satellite case
+
+SET SQLBLANKLINES ON
+SET SCAN OFF
+
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+64, 'pvt: This message is being forwarded to customerservice(a)redhat.com', 'This message has been forwarded to customerservice(a)redhat.com. That group handles all billing and purchasing related questions.'
+, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/12/2003 10:18:24 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 22, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+65, 'I''m having trouble registering my Red Hat Enterprise Linux product. Why?', 'Enterprise entitlements are required for use with Red Hat Enterprise Linux.
+
+A customer who registers an Enterprise Linux system with Spacewalk without having any Enterprise Linux entitlements will receive an error message similar to:
+
+"No public channels available for ("2.1AS'', ''i686'')"
+
+In order to register your system, you first need to activate your Spacewalk Enterprise Linux entitlements at:
+
+http://www.redhat.com/support
+
+Use the product ID that came with your Red Hat Enterprise Linux product.
+'
+, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 13, 7);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+66, 'pvt: I bought service with Spacewalk, but it won''t let me use Priority FTP access. Why not?vp'
+, 'Instant ISO access is not the same as Priority FTP access; they are separate entities. Customers who purchase Spacewalk service have Instant ISO access only. Priority FTP access is available only to legacy users, and is in the process of being phased out.
+'
+, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 09:34:56 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 6, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+67, 'How do I register a system for Spacewalk service on Red Hat Linux?', 'To register a system for Spacewalk service on Red Hat Linux please run "rhn_register". Refer to the Spacewalk User Guide (also available through the Help link at the Spacewalk website) for additional instructions.
+
+Note: for Red Hat Linux 8.0 and later, please run "up2date --register" instead of "rhn_register".
+'
+, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:09:30 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 19, 3);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+25, 'The Spacewalk website and up2date do not agree on what errata is needed for my system.'
+, 'You can refresh the profile package list by running "up2date -p" on the machine itself. Alternatively, you can schedule this from the website by clicking on the system in the System List, choosing the Packages tab, and then clicking on the "Update Package List" button at the bottom of the page.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/14/2003 09:24:01 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 10, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+26, 'I had to re-install my system. How do I re-register and get my entitlement back?'
+, 'You''ll need to re-register the client system if you haven''t already, and then move an entitlement to the new profile.
+
+* Log into our website at: https://rhn.redhat.com.
+* Click on "Systems" in the top navigation bar, then the name of the old system in the System List.
+* Click "delete system" on the top-right corner of the page.
+* As root at the command line, delete the file /etc/sysconfig/rhn/systemid from your system.
+* Run "rhn_register" (Red Hat Linux 7.x) or "up2date --register" (Red Hat Linux 8.0 and newer) on your system.
+* Once the system is registered, log in at https://rhn.redhat.com.
+* Click "Systems" in the top navigation bar, then "System Entitlements" on the left.
+* Select the appropriate entitlement level for the new system and click "Update Entitlements."'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:42:55 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 411, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+27, 'How can I request a new feature or improvement for the Spacewalk?', 'For technical requests, you can make a "Request for Enhancement" (RFE) at http://bugzilla.redhat.com/bugzilla. The product is "Spacewalk" and the various components are prefaced by "Spacewalk/". Please put "[RFE]" at the beginning of the summary line of your request.
+
+If you would like to provide non-technical feedback to Spacewalk, please go to https://rhn.redhat.com/help/contact.pxt and follow the directions for "feedback".
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:56:14 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 74, 9);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+28, 'Where do I report a bug in the Spacewalk website or update agent?', 'Bugs can be reported at http://bugzilla.redhat.com/bugzilla -- the product is "Spacewalk", and the various components are prefixed with "Spacewalk/".
+
+Please be sure to read the FAQ and review all of the open bugs before submitting your bug.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/15/2003 10:47:49 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 45, 9);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+30, 'What is the difference between i386, i586, and i686 packages?', 'i386 is a generic designation for all processors backwardly compatible with the Intel 80386; i586 is for all processors backwardly compatible with the Intel Pentium; and i686 is for Intel processors backwardly compatible with the Pentium Pro chip (Pentium II, III, IV, etc). Only the kernel has i586 and i686 versions, and glibc has an i686 version. up2date should automatically determine which versions of the kernel and glibc packages are appropriate for your systems.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/15/2003 10:33:49 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 8, 11);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+1, 'What is Spacewalk?', 'Spacewalk is a systems support and management environment for Red Hat Linux systems and networks. For more information, please see the Spacewalk product information page:
+http://www.redhat.com/software/rhn/products/
+
+For individual systems and small networks, see http://www.redhat.com/software/rhn
+
+For enterprise deployments, see http://www.redhat.com/software/rhen
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 05:00:08 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 26, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+3, 'Does Spacewalk only work on Linux? Which versions?', 'Yes. Spacewalk currently only supports versions of Red Hat Linux and Red Hat Enterprise Linux that are still active (have not yet reached End of Life status). For a list of currently maintained Red Hat versions, please go to http://www.redhat.com/apps/support/errata/
+
+Please note that Red Hat''s Enterprise Network Monitoring Module does support different platforms. For more information, please go to http://www.redhat.com/software/rhen/system_mgmt/
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 4, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+5, 'I can''t find the Spacewalk Registration Client. What is it and where do I find it?'
+, 'The Spacewalk Registration Client steps you through the process of creating a user account if you do not already have one and registering your system by creating a System Profile. It can be started by using one of the following methods:
+
+* On the GNOME desktop, go to the Main Menu Button (on the Panel) => Programs => System => Spacewalk.
+* On the KDE desktop, go to the Main Menu Button (on the Panel) => System => Spacewalk
+* At a shell prompt, type the command "rhn_register".
+
+In Red Hat Linux 8.0 and newer, rhn_register exists as a mode of the up2date client, so:
+
+* On the GNOME and KDE desktops, go to the Main Menu Button (on the Panel) => System Tools => Spacewalk. (If the system is unregistered, it will automatically launch in registration mode.)
+* At a shell prompt (for example, an xterm or gnome-terminal), type the command "up2date --register".
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/19/2003 01:31:52 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 126, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+7, 'I forgot my username and password. How do I access my account?', 'From the front page, click on the "Lost Password?" link, enter your username and email address, and then click the "Send Password" button.
+
+If you have neither your username nor your password, enter your email address in the second field provided, and then click the "Send Account List" button.
+
+If the email address matches the email address on file for your account, your information will be sent to you. If this does not work for you, please call our customer service desk at 1-866-2-RedHat.
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:14:22 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 16, 2);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+8, 'What are the service levels for Spacewalk?', 'Spacewalk currently offers three levels of service: Spacewalk Demo Service, Spacewalk Update Service and Spacewalk Management Service. For more details, go to http://www.redhat.com/software/rhn/offerings
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/08/2003 03:43:45 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 50, 4);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+69, 'pvt: You are sending packets to my machine! (Firewall log attached)', 'As you can see, the packets you are seeing are response packets coming from our host and port 443 to your machine.
+
+These packets have the SYN/ACK flags set up. These types of packets are sent only in response to a connection request from your computer.
+
+TCP uses a three-way handshake protocol to establish a connection:
+* the client sends a SYN packet to the server requesting a connection
+* the server acknowledges the request and sends back a SYN/ACK packet
+* the client responds back with an ACK packet and the connection is established
+
+Your firewall rules are not allowing the server responses to pass through. The rhnsd daemon is initiating these requests. You have 2 choices:
+
+* fix the firewall rules so you allow the reply packets to pass through and therefore allow your host to connect outside; or
+* disable the rhnsd daemon: service rhnsd stop
+'
+, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 3, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+125, 'pvt: no RHL support at rhn-help', 'This address is intended for support questions related only to Red Hat
+Network. General Red Hat Linux support is not available from this address.
+
+If you have not already done so, you can activate your product and receive advanced support at:
+
+https://www.redhat.com/apps/support/
+
+Even if you are not registered with Red Hat Support, you are welcome to browse
+our documentation and online resources available at:
+
+https://www.redhat.com/docs/
+
+You may also get access to Tips, FAQs, and online HOWTOs to guide you through
+Linux-related tasks if you start looking from our Support Resources Home Page
+available at:
+
+https://www.redhat.com/apps/support/resources/
+
+The Red Hat mailing lists are also good venues for finding answers to your
+questions. For more information on the Red Hat mailing lists, please see:
+
+http://www.redhat.com/mailing-lists/
+
+If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
+
+http://bugzilla.redhat.com/bugzilla
+'
+, 1, TO_Date( '12/11/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 288, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+126, 'How do I change my Spacewalk password?', 'To change your password:
+
+* Log in to the Spacewalk website with your existing username and password.
+* If you are not at Your Spacewalk page, click its link in the top navigation bar.
+* Click "Your Account" in the left navigation bar.
+* Type your new password in both the Password and Password Confirmation fields.
+* Click the "Update" button.
+'
+, 0, TO_Date( '12/12/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 9, 2);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+13, 'What is "rhnsd" and why is it running on my system?', '"rhnsd" is the Spacewalk Daemon. Every other hour, it sends a request to Spacewalk asking for any notifications or updates and works in coordination with Spacewalk to schedule automated tasks. It sends information to Spacewalk only requested by you. If you add a new system using the Spacewalk web interface, the next time the Spacewalk Daemon probes Spacewalk it receives a request to return the information you requested as part of your System Profile, such as what package versions are installed on your system.
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/08/2003 10:52:29 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 9, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+15, 'My systems are not checking in. What does that mean?', 'When the Spacewalk client connects to Spacewalk to see if there are any updates available, or if any actions have been scheduled, this is considered a checkin.
+
+If you are seeing a message indicating that checkins are not happening, it means that the Spacewalk client on your system is not successfully reaching Spacewalk for some reason. Things to check:
+* Make certain that your client is configured correctly.
+* Make sure that your system can communicate with Spacewalk via SSL (port 443). You may test this by running the following command from a shell prompt: telnet xmlrpc.rhn.redhat.com 443
+* Make sure that the rhnsd daemon is activated and running. You may ensure this by running the following commands:
+chkconfig --level 345 rhnsd on
+service rhnsd start
+
+If these settings are correct and your system still is not checking in, the ''Repairing a corrupt rpm database'' faq at http://rhn.redhat.com/help/faq/technical_questions.pxt#227 , or get in touch with our technical support team.
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 05:04:29 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 151, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+17, 'Can I use Spacewalk to upgrade my Red Hat Linux kernel?', 'Yes. You must use Red Hat Update Agent version 2.5.4 or higher. If you choose the kernel packages and allow Spacewalk to install them to your system, it will modify your LILO or GRUB configuration file so that your system boots the new kernel the next time it is rebooted.
+'
+, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 11, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+41, 'pvt: Updates to newer versions recommended by third-party security advisories.'
+, 'We have released fixes for all known vulnerabilities you are mentioning. Red Hat does not usually update to a new code base for the core applications and libraries if we have other options available. In the cases you have mentioned we choose to backport the security fixes to the code base we initially shipped to our customers. We do this in order to minimize the impact on the stability and the QA resources that both we and the customers invest in qualifying a particular release for a particular task.
+
+The latest versions of those packages provided by Red Hat are not vulnerable to the issues you mention.
+'
+, 1, TO_Date( '10/01/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/13/2003 11:31:22 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 10, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+62, 'Is Red Hat Technical Support available in other languages besides English?', 'At this time, Spacewalk technical support is English only.
+'
+, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/27/2003 10:32:41 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 26, 4);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+63, 'How do I download RPMs for a system without using up2date?', 'It is possible for Spacewalk users to download updated packages directly from the Spacewalk website without using up2date.
+
+To download them:
+
+* Log in to the Spacewalk web site.
+* Click "Software" in the top navigation bar.
+* Click the appropriate channel name.
+* On the Channel Details page, click the "Packages" tab.
+* Select the RPMs you want and click the "Download" button. You will be presented with a confirmation screen.
+* Click "Download Selected Packages Now!"
+* You will then be asked for the location to save the tar archive containing all the packages you selected.
+* To extract the packages once the download is complete, run: tar -xvf rhn-packages.tar
+'
+, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 9, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+31, 'The update agent wants to install an older version of a package. Why?', 'This is probably because of the epoch number of the package. RPM checks three things when it tries to determine whether a package is newer: epoch, version, and release, in that order. A higher epoch number trumps both version and release. To see the epoch number on an installed package, use the command:
+
+rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}:%{EPOCH}\n" packagename
+
+The epoch is the number after the colon. On the Spacewalk website, you can also see the epoch for the package on the Installed Packages list for the system, (again, the number after the colon).
+
+Epoch numbers are used to preserve RPM''s concept of "newer" when package versions are changed inconveniently. The classic example of the need for an epoch is perl, which changed from version 5.00503 to 5.6, thereby breaking rpm''s segmented version comparison (i.e the integer 6 < 503, rather than 5.6 > 5.00503).
+
+To keep the update agent from trying to update your package, add it to the package skip list (pkgSkipList) in your up2date configuration:
+
+up2date --configure --nox
+
+However, the package will still show up on your list of applicable errata.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/06/2003 10:26:15 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 7, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+32, 'pvt: Red Hat Linux support', 'This address is intended for support questions related only to Spacewalk. General Red Hat Linux support is not available from this address. If you are registered with Red Hat Support, you may address your questions at:
+http://www.redhat.com/support
+
+If you have not already done so, you can activate your product and receive advanced support at:
+
+https://www.redhat.com/apps/support/
+
+Even if you are not registered with Red Hat Support, you are welcome to browse
+our documentation and online resources available at:
+
+https://www.redhat.com/docs/
+
+You may also get access to Tips, FAQs, and online HOWTOs to guide you through
+Linux-related tasks if you start looking from our Support Resources Home Page
+available at:
+
+https://www.redhat.com/apps/support/resources/
+
+The Red Hat mailing lists are also good venues for finding answers to your
+questions. For more information on the Red Hat mailing lists, please see:
+
+http://www.redhat.com/mailing-lists/
+
+If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
+
+http://bugzilla.redhat.com/bugzilla
+'
+, 1, TO_Date( '06/22/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/19/2003 01:13:04 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 768, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+33, 'How do I delete System Profiles?', 'In order to delete System Profiles from Spacewalk, you need to log in to the Spacewalk website at https://rhn.redhat.com. Once logged in, click on the "Systems" link in the top navigation bar, which will take you to a list of the profiles you have registered with Spacewalk. (If you instead see System Groups, click "View Systems" near the top of the page.)
+
+Click on the name of the profile you wish to delete from the service. This will bring up its System Details page. Click the "delete system" button at the top-right corner of the page. Then confirm that you wish to delete the profile.
+
+The profile will be removed after confirmation.
+'
+, 0, TO_Date( '06/24/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/12/2003 10:57:15 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 89, 7);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+36, 'pvt: Educational Channel', 'The educational channel and Red Hat educational initiative is currently undergoing some changes (all for the positive). Please stay tuned and periodically check the following websites for more information:
+
+www.redhat.com
+www.redhat.com/index2.html
+www.redhat.com/software/rhn
+'
+, 1, TO_Date( '08/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:13 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 14, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+35, 'An errata install fails with dependency errors, but dependencies are satisfied. Why?'
+, 'Sometimes the application of an errata from the Spacewalk web site will fail because the errata applies to packages that are set to be skipped in the local skip list for a system''s up2date client. The error message in the history log will incorrectly cite a dependency problem.
+
+To fix this problem, run:
+
+up2date --configure
+
+...as root from the client system, and remove the relevant packages from the skip list. Rescheduling the errata should then work as expected.
+'
+, 0, TO_Date( '08/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/13/2003 10:24:11 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 23, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+249, 'Where can I see a copy of the SLA (Service Level Agreement) for Spacewalk Technical Support?'
+, 'This can be viewed online at the following site:
+
+http://www.redhat.com/services/techsupport/production/RHN_basic.html'
+, 0, TO_Date( '03/31/2003 11:55:25 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/09/2003 11:00:32 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 6, 4);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+288, 'My system''s IP address and hostname have changed, but Spacewalk doesn''t reflect this. What should I do?'
+, 'Spacewalk stores a profile for each registered system. In addition to properties set by the user during registration, this profile may contain various kinds of information about the system''s hardware, including processor type, networking addresses, and storage devices. This information can be found in the Spacewalk website:
+
+1. Once logged in, click on Systems in the top navigation bar.
+2. Click on the name of a system in one of the lists. (This may require leaving a System Groups view.)
+3. In the System Details page, click the Hardware subtab. All of the hardware information Spacewalk has collected about your system will appear on the resulting page.
+4. To update this information, click the Schedule Hardware Refresh button. The hardware profile will be updated at the system''s next connection to Spacewalk.'
+, 0, TO_Date( '04/22/2003 04:00:05 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/23/2003 09:45:57 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+290, 'Why does up2date tell me "Your system is fully updated" when the Spacewalk website lists updates for my system?'
+, 'This error is likely caused by one of two problems: Either the system''s package profile on Spacewalk is out of date or up2date''s package exceptions list is preventing the updates from occurring.
+
+Since updating the package profile is simplest, try this first. Log into the Spacewalk website, click "Systems" in the top navigation bar, and then click the name of the system. In the System Details page, click the "Packages" tab and then click the "Update Package List" button. The profile will be updated when the system next connects to Spacewalk. This should either remove the updates listed for your system or allow you to conduct the updates if they remain.
+
+If this still does not resolve the error, check your package exceptions list, which enables you to identify packages to be exempt from updates. To ensure your settings are not preventing the updates, launch the Update Agent Configuration Tool by running the command:
+
+up2date-config
+
+In the tool, click the "Package Exceptions" tab and look for the packages listed as requiring updating.
+To check the package skip list in the up2date configuration file, open the file /etc/sysconfig/rhn/up2date and look for the package entries under the pkgSkipList setting. To override the package exceptions and force an update of the entire system, run the command:
+
+up2date -uf
+
+If the packages aren''t updated, the Spacewalk website will continue to list them as outdated, regardless of their inclusion in the system''s package exceptions list.'
+, 0, TO_Date( '04/22/2003 06:32:03 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/25/2003 08:04:45 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+291, 'Why does Apache fail to restart after I update my Spacewalk Management Satellite Server?', 'Apache RPMs do not restart the httpd service upon installation. Therefore, after conducting a full update of an Spacewalk Management Satellite Server (such as with the command up2date -uf), Apache fails. The error will look something like:
+
+[Mon Feb 10 11:50:12 2003] [notice] SIGHUP received. Attempting to restart
+Syntax error on line 214 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_log_config.so into server: /etc/httpd/modules/mod_log_config.so: undefined symbol: ap_escape_logitem
+
+To resolve this, restart the httpd service.'
+, 0, TO_Date( '04/22/2003 08:27:51 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/23/2003 09:48:30 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 7);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+308, 'How do I resolve dropped connections during ISO downloads?', 'Red Hat recommends using the Curl open source tool for downloading ISO images. This tool enables you to resume downloads that have been interrupted. If you use Spacewalk and don''t currently have Curl, you may install it by running the command "up2date curl" from a shell prompt.
+
+Once Curl is installed, at a shell prompt, cut and paste the URL for the ISO into the Curl command as follows:
+
+[user@localhost home]$ curl -C - -O ''very_long_url''
+
+The URL, which can be derived from the Easy ISOs page of the Spacewalk website, is very long because it contains session authentication information. Be sure to include the single quotation marks around it. The ''-C -'' option allows you to continue the download if it is interrupted, such as by a lost connection. The ''-O'' (the letter ''O'', not a zero) option will save the file with the same name as on the Spacewalk Servers.'
+, 0, TO_Date( '04/30/2003 07:02:36 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/02/2003 11:41:21 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+310, 'Why does the registration process prompt me for an organization ID if I don''t need one to register?'
+, 'The organization ID is legacy from the days in which Spacewalk allowed users to request addition to an existing organization, which then required an Organization Administrator to approve the new user.
+
+Now, the Spacewalk website allows Organization Administrators to create user accounts directly. Unfortunately, older versions of the registration tools (both rhn_register and up2date) still contain organization ID and password fields. You may disregard them.'
+, 0, TO_Date( '05/02/2003 08:51:09 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/03/2003 09:07:56 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 3);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+221, 'How do I get more legal information?', 'Please go to http://www.redhat.com/software/rhn/legal'
+, 0, TO_Date( '03/27/2003 06:47:21 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 8);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+224, 'What is an ISO?', 'An ISO is an image file of the contents of a CD.
+
+For example, by downloading the Red Hat Linux ISOs to your system, you can then burn a CD that will be identical to the Red Hat Linux CDs that are available in retail stores.'
+, 0, TO_Date( '03/28/2003 11:22:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:07:32 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 11);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+225, 'What is Errata?', 'An Errata is a message about new updates for your system, usually accompanied by updated packages.
+
+Spacewalk is a tool to update your system with these errata packages.'
+, 0, TO_Date( '03/28/2003 11:25:25 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:08:17 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 11);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+227, 'How do I repair a corrupt RPM database?', 'Occasionally, the RPM database on a Red Hat Linux machine will become corrupt. This usually happens when an RPM transaction is interrupted at a critical time. Symptoms of this problem include one of the following programs not responding or freezing:
+
+* up2date
+* The Spacewalk alert notification tool (applet in the Gnome or KDE panel)
+* rhn_check
+* rpm
+
+This problem can also cause a system to stop checking in with Spacewalk.
+
+To fix this problem, run the following commands as root:
+
+* kill all RPM processes (rhn_check, up2date, rpm, rhn-applet):
+ $ ps -axwww | grep rhn_check
+In the list of processes, the first number on each line is the PID. For all PIDs listed except for the one associated with grep:
+ $ kill -9 <PID>
+Repeat the above steps for each of the programs listed.
+
+* remove any RPM lock files (/var/lib/rpm/__db*):
+ $ rm -rf /var/lib/rpm/__db*
+
+* rebuild the rpm database:
+ $ rpm --rebuilddb
+
+If the above steps do not work, please contact technical support for more assistance.'
+, 0, TO_Date( '03/28/2003 11:34:34 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/07/2003 11:31:57 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 2, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+231, 'How do I move my Spacewalk entitlement to another machine?', 'All of the systems that you want to entitle, or un-entitle, must be registered with Spacewalk. Please see the FAQ question relating to registering new systems.
+
+First Step - unentitle old system
+
+1) Sign in with Spacewalk
+2) Click on "Systems"
+3) Click on "Systems Entitlements"
+4) Change entitlement of old system to "none"
+5) Click "Update Entitlements"
+
+Next Step - entitle new system
+
+From same screen, change the entitlement on the new system to the entitlement you would like to have. Click "Update Entitlements".'
+, 0, TO_Date( '03/28/2003 12:07:10 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 09:33:40 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 2, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+230, 'I just upgraded my system. How do I re-register it with Spacewalk?', 'If you are running a version of Red Hat Linux 7.3 (or prior release), do the following:
+
+1) Log in as root
+2) Type "rhn_register"
+
+If you are running a version of Red Hat Linux 8.0 (or later release), do the following:
+
+1) Log in as root
+2) Type "up2date --register"'
+, 0, TO_Date( '03/28/2003 12:01:49 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 10:47:23 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 2, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+232, 'How do I get copies of the latest release notes for Spacewalk?', 'Click on the Help button in the upper right hand corner. Then click on Release Notes listed on the navigation bar on the left.'
+, 0, TO_Date( '03/28/2003 12:16:19 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+70, 'pvt: Updating kernel and config files', 'Because of the wide range of changes and setups involved in the scenarios you describe we have chosen the conservative path in the default configuration.
+
+We recommend that you upgrade the kernel on the boxes while you can observe the process (ie, running "up2date --force kernel" from the command line). The same goes for the packages which have config files DBmodified - please check the results of the upgrade process to make sure you will not have an interruption of service due to changed config files.
+
+Once you have been through this process a few times and get a better feel for how Spacewalk handles your particular setup, you can decide to let Spacewalk perform these updates for you automatically.
+'
+, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/14/2003 10:30:31 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 26, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+73, 'pvt: I can''t get into ftp.redhat.com. Why?', '
+Due to the popularity of Red Hat Linux 8.0, our ftp servers are currently heavily loaded, and are at their capacity. We apologize for any inconvenience this may cause.
+
+If you are not able to log into the ftp.redhat.com ftp site, it is probably because the servers are serving the maximum number of users currently. You can try later, or better yet, try one of the many Red Hat mirror sites. They are listed at:
+
+https://www.redhat.com/download/mirror.html
+ '
+, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 09:35:36 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 3, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+82, 'Red Hat''s "GPG Key" - what is it and how do I install it?', 'The first time you run the graphical version of the Red Hat Update Agent, it prompts you to install the Red Hat GPG key. This key is required to authenticate the packages downloaded from Spacewalk. If you run the command line version the first time you start Red Hat Update Agent, you need to install the Red Hat GPG key manually; follow the instructions that up2date displays.'
+, 0, TO_Date( '10/17/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/06/2003 11:15:40 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 10, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+124, 'pvt: no RHL support at rhn-feedback', 'This address is intended for feedback related only to Red Hat
+Network. General Red Hat Linux support is not available from this address.
+If you are registered with Red Hat Support, you may address your questions
+at:
+http://www.redhat.com/support
+
+Even if you are not registered with Red Hat Support, you are welcome to browse
+our documentation and online resources available at:
+
+https://www.redhat.com/docs/
+
+You may also get access to Tips, FAQs, and online HOWTOs to guide you through
+Linux-related tasks if you start looking from our Support Resources Home Page
+available at:
+
+https://www.redhat.com/apps/support/resources/
+
+The Red Hat mailing lists are also good venues for finding answers to your
+questions. For more information on the Red Hat mailing lists, please see:
+
+http://www.redhat.com/mailing-lists/
+
+If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
+
+http://bugzilla.redhat.com/bugzilla'
+, 1, TO_Date( '12/11/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 10, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+191, 'pvt: I want to unsubscribe from the maillist !', 'To stop receiving mails from Spacewalk , please see below:
+
+Use your Spacewalk account to login, then go to "Your Spacewalk"==>"Your preferences" .
+
+The Your Preferences page allows you to configure Spacewalk options, including:
+
+ Errata Email Notification — Determine whether you want to receive email every time an Errata Alert is applicable to one or more systems in your Spacewalk account.
+
+ Spacewalk List Page Size — Maximum number of items that will appear in a list on a single page. If more items are in the list, clicking the Next button will display the next group of items. This preference applies to system lists, Errata lists, package lists, and so on.
+
+ Time Zone — Set your time zone so that scheduled actions are scheduled according to the time in your time zone.
+
+ Red Hat Contact Options — Identify what ways (email, phone, fax, or mail) Red Hat may contact you.
+
+After making changes to any of these options, click the Save Preferences button on the bottom right-hand corner.
+'
+, 1, TO_Date( '02/19/2003 08:20:46 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/27/2003 11:53:51 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 89, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+209, 'I can''t log in with my username or password. What should I do?', 'First, please check to see if you are using the correct username and password (see answers to questions in this section). If you are using the correct username and password, please call customer service at 1-866-2-RedHat or contact them at customerservice(a)redhat.com'
+, 0, TO_Date( '03/27/2003 03:57:30 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 2);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+228, 'pvt: How can I subscribe for Red Hat 9 now?', 'Red Hat Linux 9 ISOs will be available to paid subscribers starting March 31, 2003--a week before they will be available on redhat.com, in stores, or on Red Hat FTP. A paid subscription also gets you access to Spacewalk technical support, errata updates, priority access during peak times, and immediate email notification. It''s the quickest way to get Red Hat Linux 9.
+
+Note: Spacewalk does not include printed documentation or Red Hat Linux Installation Support. If that''s what you''re looking for, you can purchase Red Hat Linux 9 at redhat.com or at retail stores, available April 7, 2003. Red Hat Linux 9 or Red Hat Linux 9 Professional includes source code and documentation CDs, printed documentation manuals, installation support, and 1- or 2- month Update Subscription to Spacewalk.
+
+For more informations please visit this page:
+http://www.redhat.com/mktg/rh9iso/
+'
+, 1, TO_Date( '03/25/2003 03:09:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/06/2003 09:07:11 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 9, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+208, 'I am new to Spacewalk. How do I create an account?', 'Go to http://rhn.redhat.com and click on the link that says "Create Account". From here, please follow the directions.'
+, 0, TO_Date( '03/27/2003 03:55:40 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 3);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+210, 'How do I login to Spacewalk?', 'Go to http://rhn.redhat.com
+
+From this page, enter in your username and password in the box. If you do not have your username and password, please see the FAQ relating to this.'
+, 0, TO_Date( '03/27/2003 03:59:43 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 3);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+212, 'How do I contact Spacewalk?', 'To contact Spacewalk, please go to: http://www.redhat.com/software/rhn/contact'
+, 0, TO_Date( '03/27/2003 04:02:07 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+215, 'How do I know when I need to update my system?', 'Once your system is registered on Spacewalk, a small icon will appear on your tool bar (Red Hat Linux 7.3 and higher). The icon will display either an exclamation point with red background (meaning that there is an update waiting to be downloaded) or a check mark with blue background (meaning that there are no updates waiting). If your icon portrays a question mark, it means that Spacewalk is not able to see your system.
+
+By double clicking on the icon, this will activate Spacewalk update tool.'
+, 0, TO_Date( '03/27/2003 04:27:48 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+217, 'Can I use Spacewalk to upgrade to a newer version of Red Hat Linux?', 'No. While Spacewalk always supports the latest version of Red Hat Linux, Spacewalk cannot be used today to upgrade your system from one version of Red Hat Linux to the next. You will need to do a CD based install. However, if you are a paid subscriber to Spacewalk (Update or Management), you have access to the new Red Hat Linux ISOs the moment they are made available. For more information, see http://www.redhat.com/software/rhn/offerings
+'
+, 0, TO_Date( '03/27/2003 04:39:01 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 5);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+219, 'What are the terms and conditions of Spacewalk?', 'To see a copy of the Spacewalk Terms and Conditions, please go to http://www.redhat.com/licenses/rhn.html'
+, 0, TO_Date( '03/27/2003 06:03:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 0, 8);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+23, 'How do I remove a pending action?', 'A pending action will be removed when there are no longer any systems scheduled for it. For Demo or Update entitlements this will always be done on a per system basis:
+
+* Log into the Spacewalk website.
+* Click "Schedule" on the top navigation bar, then "Pending Actions" in the left navigation bar.
+* Click on the numeral in the "In Progress" column of the row for the action you want to remove.
+* Click on the desired system name.
+* Click on the "Events" tab in the System Details navigation.
+* Click on the "Pending" subtab.
+* Select the event you wish to cancel, and click "Cancel Events"
+* Click the "Cancel Selected Events" on the confirmation page.
+
+For systems with Management entitlements, simply remove the systems from the action:
+
+* Click "Schedule" on the top navigation bar, then "Pending Actions" in the left navigation bar.
+* Click on the numeral in the "In Progress" column of the row for the action you want to remove.
+* Select the systems for removal from the action and then click on the "Unschedule Action" button.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:53:59 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 14, 7);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+24, 'Why do scheduled kernel errata fail to install?', 'By default, the kernel packages are marked to be skipped by the update agent. You can change this configuration by running:
+
+up2date --configure --nox
+
+...and changing or clearing the "pkgSkipList" parameter. You should then be able to schedule your kernel update.
+'
+, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/30/2003 04:21:47 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 11, 6);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+131, 'pvt: openssl packages', 'The latest releases of the OpenSSL packages from Red Hat include fixes for all known security vulnerabilities, including the various types of worms that float around.
+
+Please remember that just upgrading the packages is not sufficient. You will have to restart at least your Apache server in order for the new libraries to be loaded by the running Apache process.
+
+More details about the applicable OpenSSL errata can be found at:
+
+https://rhn.redhat.com/errata/RHSA-2002-160.html
+and
+https://rhn.redhat.com/network/errata/errata_details.pxt?eid=1143
+'
+, 1, TO_Date( '12/19/2002 07:33:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 4, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+148, 'pvt: delayed response', 'Due to significant interest & volume in Spacewalk services, we have been unable to respond to your question in a timely manner. We apologize for the delay and any inconvenience this delay may have caused you. In response to your question, below is a response to your question. If this solution does not resolve your issue, please resubmit with additional information.
+'
+, 1, TO_Date( '02/05/2003 12:41:33 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/03/2003 11:24:13 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 39, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+168, 'pvt: New To Linux', 'This address is intended for support questions from paid subscribers and is related only to Spacewalk. General Red Hat Linux support is not available from this address. If you are registered with Red Hat Support, you may address your questions at:
+http://www.redhat.com/support
+
+If you have not already done so, you can activate your product and receive advanced support at:
+
+https://www.redhat.com/apps/support/
+
+Even if you are not registered with Red Hat Support, you are welcome to browse
+our documentation and online resources available at:
+
+https://www.redhat.com/docs/
+
+You may also get access to Tips, FAQs, and online HOWTOs to guide you through
+Linux-related tasks if you start looking from our Support Resources Home Page
+available at:
+
+https://www.redhat.com/apps/support/resources/
+
+The Red Hat mailing lists are also good venues for finding answers to your
+questions. For more information on the Red Hat mailing lists, please see:
+
+http://www.redhat.com/mailing-lists/
+
+If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
+
+http://bugzilla.redhat.com/bugzilla
+'
+, 1, TO_Date( '02/13/2003 04:23:15 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 6, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+169, 'How do I change my email address?', 'To change your email:
+
+* Log in to the Spacewalk website with your existing username and password.
+* If you are not at Your Spacewalk page, click its link in the top navigation bar.
+* Click "Your Account" in the left navigation bar.
+* Click "Change Email"
+* Type your new email in field.
+* Click the "Send Verification" or "Update" button.'
+, 0, TO_Date( '02/13/2003 10:03:56 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/13/2003 09:15:55 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 16, 2);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+170, 'pvt: How to entitle system in my Spacewalk', '* Once the system is registered, log in at https://rhn.redhat.com.
+* Click "Systems" in the top navigation bar, then "System Entitlements" on the left.
+* Select the appropriate entitlement level for the new system and click "Update Entitlements."'
+, 1, TO_Date( '02/13/2003 10:36:28 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/15/2003 09:36:58 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 54, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+188, 'pvt: system on a closed net , but still want to update', 'Spacewalk Management Satellite Server provides for local management of system profiles, thus allowing for completely disconnected operation from external networks.
+More information, please follow this link:
+https://rhn.redhat.com/info/purchase_info.pxt
+'
+, 1, TO_Date( '02/18/2003 09:35:22 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/07/2003 11:03:00 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 8, 1);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+189, 'What are the differences between Update, Management, and Demo Accounts?', 'Update service level subscriptions to Spacewalk allow individuals to register one or more systems, manage these systems independently, receive priority access to Spacewalk, and download Easy ISOs (full versions of Red Hat Linux). Update subscriptions are $60 per system and renew annually. Customers may receive also limited time (less than one year) Update subscriptions with the Red Hat Linux distribution products.
+
+Management service level subscriptions to Spacewalk allow organizations to manage multiple systems, individually or in groups of systems. Management subscriptions efficiently combine the power and flexibility of fine-grained control with the scalability to support thousands of systems.
+
+Demo refers to our complimentary service level. Any user may receive one Demo account with Spacewalk to receive notifications and system updates. Demo users are asked to take a short survey every 60 days in order to provide Red Hat with valued customer input and to validate that the account is still active. Please note that there can be only one demo account per email address.
+
+Note: A Demo account does not provide guaranteed access to errata or bandwidth allocation during peak times, as these resources are reserved for paying subscribers. For this reason, Red Hat strongly recommends purchasing at least an Update service level if you are using your Linux system for home or business production use.
+
+For more information, please follow this link:
+http://www.redhat.com/software/rhn/offerings'
+, 0, TO_Date( '02/18/2003 10:53:18 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/21/2003 12:08:01 PM', 'MM/DD/YYYY HH:MI:SS AM')
+, 48, 4);
+INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
+CLASS_ID ) VALUES (
+190, 'pvt:How can i delete my account in Spacewalk?', 'Sorry,you can not delete your account in Spacewalk now. But your account will be disabled if you do not accept the survey per 60 days.'
+, 1, TO_Date( '02/19/2003 04:22:18 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
+, 25, 1);
+COMMIT;
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/024-rhnKSTreeType-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/024-rhnKSTreeType-strings.sql
new file mode 100644
index 0000000..a36838b
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/024-rhnKSTreeType-strings.sql
@@ -0,0 +1,5 @@
+
+update rhnKSTreeType
+set name = 'Spacewalk managed kickstart tree'
+where label = 'rhn-managed';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/025-rhnKickstartSessionState-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/025-rhnKickstartSessionState-strings.sql
new file mode 100644
index 0000000..e47ee5f
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/025-rhnKickstartSessionState-strings.sql
@@ -0,0 +1,9 @@
+
+update rhnKickstartSessionState
+set description = 'The system has downloaded the kickstart configuraton file from Spacewalk.'
+where label = 'configuration_accessed';
+
+update rhnKickstartSessionState
+set description = 'The system has successfully registered with Spacewalk after kickstarting.'
+where label = 'registered';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/026-rhnOrgEntitlementType-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/026-rhnOrgEntitlementType-strings.sql
new file mode 100644
index 0000000..6680e33
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/026-rhnOrgEntitlementType-strings.sql
@@ -0,0 +1,21 @@
+
+update rhnOrgEntitlementType
+set name = 'Spacewalk Monitoring'
+where label = 'rhn_monitor';
+
+update rhnOrgEntitlementType
+set name = 'Spacewalk Provisioning'
+where label = 'rhn_provisioning';
+
+update rhnOrgEntitlementType
+set name = 'Spacewalk Non-Linux'
+where label = 'rhn_nonlinux';
+
+update rhnOrgEntitlementType
+set name = 'Spacewalk Virtualization'
+where label = 'rhn_virtualization';
+
+update rhnOrgEntitlementType
+set name = 'Spacewalk Virtualization Platform'
+where label = 'rhn_virtualization_platform';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/027-rhnServerGroupType-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/027-rhnServerGroupType-strings.sql
new file mode 100644
index 0000000..69013cb
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/027-rhnServerGroupType-strings.sql
@@ -0,0 +1,17 @@
+
+update rhnServerGroupType
+set name = 'Spacewalk Update Entitled Servers'
+where label = 'sw_mgr_entitled';
+
+update rhnServerGroupType
+set name = 'Spacewalk Management Entitled Servers'
+where label = 'enterprise_entitled';
+
+update rhnServerGroupType
+set name = 'Spacewalk Provisioning Entitled Servers'
+where label = 'provisioning_entitled';
+
+update rhnServerGroupType
+set name = 'Spacewalk Monitoring Entitled Servers'
+where label = 'monitoring_entitled';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/028-rhnTemplateString_data-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/028-rhnTemplateString_data-strings.sql
new file mode 100644
index 0000000..f86b3e4
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/028-rhnTemplateString_data-strings.sql
@@ -0,0 +1,5 @@
+
+update rhnTemplateString
+set value = '-' || '-the Spacewalk Team'
+where label = 'email_footer';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/029-rhnUserGroupType_data-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/029-rhnUserGroupType_data-strings.sql
new file mode 100644
index 0000000..9f67685
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/029-rhnUserGroupType_data-strings.sql
@@ -0,0 +1,9 @@
+
+update rhnUserGroupType
+set name = 'Spacewalk Support Administrator'
+where label = 'rhn_support';
+
+update rhnUserGroupType
+set name = 'Spacewalk Superuser'
+where label = 'rhn_superuser';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/030-rhn_config_macro_data-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/030-rhn_config_macro_data-strings.sql
new file mode 100644
index 0000000..dc3a5c7
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/030-rhn_config_macro_data-strings.sql
@@ -0,0 +1,36 @@
+
+update rhn_config_macro
+set description = 'Spacewalk administrator email'
+where environment = 'LICENSE'
+ and name = 'RHN_ADMIN_EMAIL';
+
+update rhn_config_macro
+set description = 'Spacewalk database name '
+where environment = 'LICENSE'
+ and name = 'RHN_DB_NAME';
+
+update rhn_config_macro
+set description = 'Spacewalk database password'
+where environment = 'LICENSE'
+ and name = 'RHN_DB_PASSWD';
+
+update rhn_config_macro
+set description = 'Spacewalk Database table owner'
+where environment = 'LICENSE'
+ and name = 'RHN_DB_TABLE_OWNER';
+
+update rhn_config_macro
+set description = 'Spacewalk database username'
+where environment = 'LICENSE'
+ and name = 'RHN_DB_USERNAME';
+
+update rhn_config_macro
+set description = 'Spacewalk hostname (FQDN)'
+where environment = 'LICENSE'
+ and name = 'RHN_SAT_HOSTNAME';
+
+update rhn_config_macro
+set description = 'Spacewalk webserver port (80 for http, 443 for https)'
+where environment = 'LICENSE'
+ and name = 'RHN_SAT_WEB_PORT';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/031-rhn_notification_formats_data-strings.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/031-rhn_notification_formats_data-strings.sql
new file mode 100644
index 0000000..03d2ad9
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/031-rhn_notification_formats_data-strings.sql
@@ -0,0 +1,6 @@
+
+update rhn_notification_formats
+set body_format = replace(body_format, 'RHN', 'Spacewalk')
+where description in ( 'New Default (2.15)', 'New Default (2.18)' )
+ and customer_id is null;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/032-rhn_command.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/032-rhn_command.sql
new file mode 100644
index 0000000..f4b0e57
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/032-rhn_command.sql
@@ -0,0 +1,4 @@
+
+alter table rhn_command
+modify command_class default '/opt/home/nocpulse/libexec/plugin';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/033-rhn_command_queue_commands_data.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/033-rhn_command_queue_commands_data.sql
new file mode 100644
index 0000000..e7b8dff
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/033-rhn_command_queue_commands_data.sql
@@ -0,0 +1,5 @@
+
+update rhn_command_queue_commands
+set command_line = '/opt/home/nocpulse/bin/scheduleEvents'
+where recid = 1;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/034-rhn_config_parameter_data.sql.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/034-rhn_config_parameter_data.sql.sql
new file mode 100644
index 0000000..766c82a
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/034-rhn_config_parameter_data.sql.sql
@@ -0,0 +1,5 @@
+
+update rhn_config_parameter
+set value = '/opt' || value
+where value like '/home/nocpulse/%';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/035-check_email_uniqueness-drop.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/035-check_email_uniqueness-drop.sql
new file mode 100644
index 0000000..2f1ef22
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/035-check_email_uniqueness-drop.sql
@@ -0,0 +1,3 @@
+
+drop function check_email_uniqueness;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/040-rhnPackage-index-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/040-rhnPackage-index-nevra.sql
new file mode 100644
index 0000000..7f39e67
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/040-rhnPackage-index-nevra.sql
@@ -0,0 +1,10 @@
+
+drop index rhn_package_n_e_pa_o_uq;
+drop index rhn_package_md5_nid_eid_oid_uq;
+
+create unique index rhn_package_md5_oid_uq
+ on rhnPackage(md5sum, org_id)
+ tablespace [[2m_tbs]]
+ storage( pctincrease 1 freelists 16 )
+ initrans 32;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/041-rhnPackageProvider-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/041-rhnPackageProvider-nevra.sql
new file mode 100644
index 0000000..b9cd641
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/041-rhnPackageProvider-nevra.sql
@@ -0,0 +1,61 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnPackageProvider
+(
+ id number
+ constraint rhn_pkg_provider_id_nn not null,
+ name varchar2(64)
+ constraint rhn_pkg_provider_key_nn not null,
+ created date default(sysdate)
+ constraint rhn_pkg_provider_created_nn not null,
+ modified date default(sysdate)
+ constraint rhn_pkg_provider_modified_nn not null
+)
+ storage ( freelists 16 )
+ initrans 32;
+
+create sequence rhn_package_provider_id_seq start with 100;
+
+-- these must be in this order.
+create index rhn_pkg_provider_id_n_idx
+ on rhnPackageProvider(id,name)
+ tablespace [[2m_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+alter table rhnPackageProvider add constraint rhn_pkg_provider_id_pk primary key (id);
+alter table rhnPackageProvider add constraint rhn_pkg_provider_name_uq unique ( name );
+
+
+
+create or replace trigger
+rhn_pkg_provider_mod_trig
+before insert or update on rhnPackageProvider
+for each row
+begin
+ :new.modified := sysdate;
+end;
+/
+
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 21:50:21 jsherrill
+-- new package gpg tracking
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/042-rhnPackageKeyType-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/042-rhnPackageKeyType-nevra.sql
new file mode 100644
index 0000000..a88fe9b
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/042-rhnPackageKeyType-nevra.sql
@@ -0,0 +1,61 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnPackageKeyType
+(
+ id number
+ constraint rhn_pkg_key_type_id_nn not null,
+ label varchar2(64)
+ constraint rhn_pkg_key_type_label_nn not null,
+ created date default(sysdate)
+ constraint rhn_pkg_key_type_created_nn not null,
+ modified date default(sysdate)
+ constraint rhn_pkg_key_type_modified_nn not null
+)
+ storage ( freelists 16 )
+ initrans 32;
+
+create sequence rhn_package_key_type_id_seq start with 100;
+
+-- these must be in this order.
+create index rhn_pkg_key_type_id_n_idx
+ on rhnPackageKeyType(id,label)
+ tablespace [[2m_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+alter table rhnPackageKeyType add constraint rhn_pkg_key_type_id_pk primary key (id);
+alter table rhnPackageKeyType add constraint rhn_pkg_key_type_label_uq unique ( label );
+
+
+
+create or replace trigger
+rhn_pkg_key_type_mod_trig
+before insert or update on rhnPackageKeyType
+for each row
+begin
+ :new.modified := sysdate;
+end;
+/
+
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 21:50:21 jsherrill
+-- new package key tracking
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/043-rhnPackageKey-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/043-rhnPackageKey-nevra.sql
new file mode 100644
index 0000000..43ca329
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/043-rhnPackageKey-nevra.sql
@@ -0,0 +1,68 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnPackageKey
+(
+ id number
+ constraint rhn_pkey_id_nn not null,
+ key_id varchar2(64)
+ constraint rhn_pkey_key_nn not null,
+ key_type_id number
+ constraint rhn_pkey_type_id_nn not null
+ constraint rhn_pkey_type_id_prid_fk
+ references rhnPackageKeyType(id),
+ provider_id number
+ constraint rhn_pkey_prid_fk
+ references rhnPackageProvider(id),
+ created date default(sysdate)
+ constraint rhn_pkey_created_nn not null,
+ modified date default(sysdate)
+ constraint rhn_pkey_modified_nn not null
+)
+ storage ( freelists 16 )
+ initrans 32;
+
+create sequence rhn_pkey_id_seq start with 100;
+
+-- these must be in this order.
+create index rhn_pkey_id_k_pid_idx
+ on rhnPackageKey(id,key_id,provider_id,key_type_id)
+ tablespace [[2m_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+alter table rhnPackageKey add constraint rhn_pkey_id_pk primary key (id);
+alter table rhnPackageKey add constraint rhn_pkey_keyid_uq unique ( key_id );
+
+
+
+create or replace trigger
+rhn_pkg_gpg_mod_trig
+before insert or update on rhnPackageKey
+for each row
+begin
+ :new.modified := sysdate;
+end;
+/
+
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 21:50:21 jsherrill
+-- new package key tracking
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/044-rhnPackageKeyAssociation-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/044-rhnPackageKeyAssociation-nevra.sql
new file mode 100644
index 0000000..7f90f32
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/044-rhnPackageKeyAssociation-nevra.sql
@@ -0,0 +1,45 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--/
+
+create table
+rhnPackageKeyAssociation
+(
+ package_id number
+ constraint rhn_pkeya_pid_nn not null
+ constraint rhn_pkeya_pid_fk
+ references rhnPackage(id) on delete cascade,
+ key_id number
+ constraint rhn_pkeya_kid_nn not null
+ constraint rhn_pkeya_kid_fk
+ references rhnPackageKey(id),
+ created date default (sysdate)
+ constraint rhn_pkeya_created_nn not null,
+ modified date default (sysdate)
+ constraint rhn_pkeya_modified_nn not null
+)
+ storage ( freelists 16 )
+ initrans 32;
+
+create unique index rhn_pkeya_pk_uq
+ on rhnPackageKeyAssociation(package_id,key_id)
+ tablespace [[64k_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+
+-- Revision 1.1 2008/07/01 02:00:55 jlsherrill
+-- initial add
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/045-lookup_package_key_type-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/045-lookup_package_key_type-nevra.sql
new file mode 100644
index 0000000..c121f61
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/045-lookup_package_key_type-nevra.sql
@@ -0,0 +1,38 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace function
+lookup_package_key_type(label_in in varchar2)
+return number
+deterministic
+is
+ package_key_type_id number;
+begin
+ select id into package_key_type_id from rhnPackageKeyType where label = label_in;
+ return package_key_type_id;
+exception
+ when no_data_found then
+ rhn_exception.raise_exception('package_key_type_not_found');
+end;
+/
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 23:16:18 jsherrill
+-- adding
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/046-lookup_package_provider-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/046-lookup_package_provider-nevra.sql
new file mode 100644
index 0000000..5163872
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/046-lookup_package_provider-nevra.sql
@@ -0,0 +1,38 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace function
+lookup_package_provider(name_in in varchar2)
+return number
+deterministic
+is
+ package_provider_id number;
+begin
+ select id into package_provider_id from rhnPackageProvider where name = name_in;
+ return package_provider_id;
+exception
+ when no_data_found then
+ rhn_exception.raise_exception('package_provider_not_found');
+end;
+/
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 23:16:18 jsherrill
+-- adding
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/047-rhnPackageKeyType_data-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/047-rhnPackageKeyType_data-nevra.sql
new file mode 100644
index 0000000..df51e83
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/047-rhnPackageKeyType_data-nevra.sql
@@ -0,0 +1,34 @@
+--
+-- 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.
+--
+-- $Id$
+
+insert into rhnPackageKeyType (id, label) values
+(rhn_package_key_type_id_seq.nextval, 'gpg' );
+insert into rhnPackageKeyType (id, label) values
+(rhn_package_key_type_id_seq.nextval, 'pgp' );
+insert into rhnPackageKeyType (id, label) values
+(rhn_package_key_type_id_seq.nextval, 'rsa' );
+insert into rhnPackageKeyType (id, label) values
+(rhn_package_key_type_id_seq.nextval, 'dsa' );
+
+
+
+commit;
+
+-- $Log$
+-- Revision 1.1 2008/07/02 23:42:28 jsherrill
+-- Sequence; data to populate stuff
+--
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/048-rhnPackageProvider_data-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/048-rhnPackageProvider_data-nevra.sql
new file mode 100644
index 0000000..4cb9b49
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/048-rhnPackageProvider_data-nevra.sql
@@ -0,0 +1,39 @@
+--
+-- 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.
+--
+-- $Id$
+
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'Red Hat Inc.' );
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'Fedora' );
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'CentOS' );
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'Scientific Linux' );
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'Suse' );
+insert into rhnPackageProvider (id, name) values
+(rhn_package_provider_id_seq.nextval, 'Oracle Inc.' );
+
+
+
+
+commit;
+
+-- $Log$
+-- Revision 1.1 2008/07/02 23:42:28 jsherrill
+-- Sequence; data to populate stuff
+--
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/049-rhnPackageKey_data-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/049-rhnPackageKey_data-nevra.sql
new file mode 100644
index 0000000..326954a
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/049-rhnPackageKey_data-nevra.sql
@@ -0,0 +1,59 @@
+--
+-- 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.
+--
+-- $Id$
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '5326810137017186', lookup_package_key_type('gpg'), lookup_package_provider('Red Hat Inc.'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '219180cddb42a60e', lookup_package_key_type('gpg'), lookup_package_provider('Red Hat Inc.'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, 'b44269d04f2a6fd2', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, 'a8a447dce8562897', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '2802e89216ff0e46', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, 'a53d0bab443e1821', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '7049e44d025e513b', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '25dbef78a7048f8d', lookup_package_key_type('gpg'), lookup_package_provider('Scientific Linux'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '66ced3de1e5e0159', lookup_package_key_type('gpg'), lookup_package_provider('Oracle Inc.'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, '2e2bcdbcb38a8516', lookup_package_key_type('gpg'), lookup_package_provider('Oracle Inc.'));
+
+insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
+(rhn_pkey_id_seq.nextval, 'a84edae89c800aca', lookup_package_key_type('gpg'), lookup_package_provider('Suse'));
+
+
+
+
+commit;
+
+-- $Log$
+-- Revision 1.1 2008/07/02 23:42:28 jsherrill
+-- Sequence; data to populate stuff
+--
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/050-rhnException_data-nevra.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/050-rhnException_data-nevra.sql
new file mode 100644
index 0000000..2ff078a
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/050-rhnException_data-nevra.sql
@@ -0,0 +1,5 @@
+
+insert into rhnException values (-20292, 'package_provider_not_found', 'The specified package provider could not be found.');
+
+insert into rhnException values (-20293, 'package_key_type_not_found', 'The specified package key type could not be found.');
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/051-lookup_package_key_type-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/051-lookup_package_key_type-non-deterministic.sql
new file mode 100644
index 0000000..f2868c2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/051-lookup_package_key_type-non-deterministic.sql
@@ -0,0 +1,37 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace function
+lookup_package_key_type(label_in in varchar2)
+return number
+is
+ package_key_type_id number;
+begin
+ select id into package_key_type_id from rhnPackageKeyType where label = label_in;
+ return package_key_type_id;
+exception
+ when no_data_found then
+ rhn_exception.raise_exception('package_key_type_not_found');
+end;
+/
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 23:16:18 jsherrill
+-- adding
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/052-lookup_package_provider-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/052-lookup_package_provider-non-deterministic.sql
new file mode 100644
index 0000000..475d338
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/052-lookup_package_provider-non-deterministic.sql
@@ -0,0 +1,37 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace function
+lookup_package_provider(name_in in varchar2)
+return number
+is
+ package_provider_id number;
+begin
+ select id into package_provider_id from rhnPackageProvider where name = name_in;
+ return package_provider_id;
+exception
+ when no_data_found then
+ rhn_exception.raise_exception('package_provider_not_found');
+end;
+/
+show errors
+
+-- $Log$
+-- Revision 1.1 2008/07/01 23:16:18 jsherrill
+-- adding
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-1-rhnPackageSignature-drop.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-1-rhnPackageSignature-drop.sql
new file mode 100644
index 0000000..1988eb0
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-1-rhnPackageSignature-drop.sql
@@ -0,0 +1,3 @@
+
+drop table rhnPackageSignature;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-2-rhn_package_sig_id_seq-drop.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-2-rhn_package_sig_id_seq-drop.sql
new file mode 100644
index 0000000..5de4c79
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/053-2-rhn_package_sig_id_seq-drop.sql
@@ -0,0 +1,3 @@
+
+drop sequence rhn_package_sig_id_seq;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-1-rhnPackageSigType-drop.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-1-rhnPackageSigType-drop.sql
new file mode 100644
index 0000000..2253866
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-1-rhnPackageSigType-drop.sql
@@ -0,0 +1,3 @@
+
+drop table rhnPackageSigType;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql
new file mode 100644
index 0000000..6bf2fb2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql
@@ -0,0 +1,3 @@
+
+drop sequence rhn_package_sig_type_id_seq;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-0-rhnPackageChangeLog-sequence.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-0-rhnPackageChangeLog-sequence.sql
new file mode 100644
index 0000000..2c942a9
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-0-rhnPackageChangeLog-sequence.sql
@@ -0,0 +1,3 @@
+
+create sequence rhn_pkg_cl_id_seq;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-1-rhnPackageChangeLog-id.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-1-rhnPackageChangeLog-id.sql
new file mode 100644
index 0000000..c49ed94
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-1-rhnPackageChangeLog-id.sql
@@ -0,0 +1,4 @@
+
+alter table rhnPackageChangelog
+add id number;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-2-rhnPackageChangeLog-id-data.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-2-rhnPackageChangeLog-id-data.sql
new file mode 100644
index 0000000..d3e50c8
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-2-rhnPackageChangeLog-id-data.sql
@@ -0,0 +1,5 @@
+
+update rhnPackageChangelog
+set id = rhn_pkg_cl_id_seq.nextval
+where id is null;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-3-rhnPackageChangeLog-id-not-null.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-3-rhnPackageChangeLog-id-not-null.sql
new file mode 100644
index 0000000..7f3db05
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/055-3-rhnPackageChangeLog-id-not-null.sql
@@ -0,0 +1,7 @@
+
+alter table rhnPackageChangelog
+modify id
+ constraint rhn_pkg_cl_id_nn not null
+ constraint rhn_pkg_cl_id_pk primary key
+ using index tablespace [[64k_tbs]];
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/056-create_new_org-no-password.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/056-create_new_org-no-password.sql
new file mode 100644
index 0000000..1cc42e5
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/056-create_new_org-no-password.sql
@@ -0,0 +1,146 @@
+--
+-- 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.
+--
+--
+-- $Id: create_new_org.sql 118829 2007-08-03 00:04:50Z mmccune $
+--
+--
+
+create or replace procedure
+create_new_org
+(
+ name_in in varchar2,
+ password_in in varchar2,
+ org_id_out out number
+) is
+ ug_type number;
+ group_val number;
+ new_org_id number;
+begin
+
+ select web_customer_id_seq.nextval into new_org_id from dual;
+
+ insert into web_customer (
+ id, name,
+ oracle_customer_id, oracle_customer_number,
+ customer_type
+ ) values (
+ new_org_id, name_in,
+ new_org_id, new_org_id, 'B'
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_applicant';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) VALues (
+ group_val, 'Organization Applicants',
+ 'Organization Applicants for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in,
+ NULL, ug_type, new_org_id
+ );
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
+ 0, sgt.id, new_org_id
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+ org_id_out := new_org_id;
+
+end create_new_org;
+/
+show errors;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/057-create_first_org-no-password.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/057-create_first_org-no-password.sql
new file mode 100644
index 0000000..6f162b4
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/057-create_first_org-no-password.sql
@@ -0,0 +1,172 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+-- EXCLUDE: production
+--
+-- This creates an org with ID of 1, and errors if there already is one
+--
+
+
+
+create or replace procedure
+create_first_org
+(
+ name_in in varchar2,
+ password_in in varchar2
+) is
+ ug_type number;
+ group_val number;
+begin
+ insert into web_customer (
+ id, name,
+ oracle_customer_id, oracle_customer_number,
+ customer_type
+ ) values (
+ 1, name_in,
+ 1, 1, 'B'
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Organization Administrators',
+ 'Organization Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'org_applicant';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) VALues (
+ group_val, 'Organization Applicants',
+ 'Organization Applicants for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'system_group_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'System Group Administrators',
+ 'System Group Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'activation_key_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Activation Key Administrators',
+ 'Activation Key Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ -- config admin is special; it gets created in
+ -- rhn_entitlements.set_customer_provisioning instead.
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'channel_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Channel Administrators',
+ 'Channel Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+ select rhn_user_group_id_seq.nextval into group_val from dual;
+
+ select id
+ into ug_type
+ from rhnUserGroupType
+ where label = 'satellite_admin';
+
+ insert into rhnUserGroup (
+ id, name,
+ description,
+ max_members, group_type, org_id
+ ) values (
+ group_val, 'Satellite Administrators',
+ 'Satellite Administrators for Org ' || name_in || ' (1)',
+ NULL, ug_type, 1
+ );
+
+
+ -- if they need more than 16GB, they'll call us and we'll whip
+ -- out a "can be null" patch, which we should do for next
+ -- version anyway. (I thought we did that for this version?)
+ insert into rhnOrgQuota(
+ org_id, total
+ ) values (
+ 1, 1024*1024*1024*16
+ );
+
+
+ -- there aren't any users yet, so we don't need to update
+ -- rhnUserServerPerms
+ insert into rhnServerGroup
+ ( id, name, description, max_members, group_type, org_id )
+ select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
+ 0, sgt.id, 1
+ from rhnServerGroupType sgt
+ where sgt.label = 'sw_mgr_entitled';
+
+end create_first_org;
+/
+show errors;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/058-web_customer-drop-password.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/058-web_customer-drop-password.sql
new file mode 100644
index 0000000..b50d169
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/058-web_customer-drop-password.sql
@@ -0,0 +1,4 @@
+
+alter table web_customer
+drop column password;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/060-rhn_channel-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/060-rhn_channel-deterministic.sql
new file mode 100644
index 0000000..f10baea
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/060-rhn_channel-deterministic.sql
@@ -0,0 +1,1368 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_channel
+IS
+ body_version varchar2(100) := '$Id$';
+
+ -- Cursor that fetches all the possible base channels for a
+ -- (server_arch_id, release, org_id) combination
+ cursor base_channel_cursor(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number
+ ) return rhnChannel%ROWTYPE is
+ select distinct c.*
+ from rhnDistChannelMap dcm,
+ rhnServerChannelArchCompat scac,
+ rhnChannel c,
+ rhnChannelPermissions cp
+ where cp.org_id = org_id_in
+ and cp.channel_id = c.id
+ and c.parent_channel is null
+ and c.id = dcm.channel_id
+ and c.channel_arch_id = dcm.channel_arch_id
+ and dcm.release = release_in
+ and scac.server_arch_id = server_arch_id_in
+ and scac.channel_arch_id = c.channel_arch_id;
+
+ FUNCTION get_license_path(channel_id_in IN NUMBER)
+ RETURN VARCHAR2
+ IS
+ license_val VARCHAR2(1000);
+ BEGIN
+ SELECT CFL.license_path INTO license_val
+ FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
+ WHERE CFM.channel_id = channel_id_in
+ AND CFM.channel_family_id = CFL.channel_family_id;
+
+ RETURN license_val;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END get_license_path;
+
+
+ PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_consent_no_license');
+ END IF;
+
+ INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
+ VALUES (channel_family_id_val, user_id_in, server_id_in);
+ END license_consent;
+
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
+ IS
+ channel_parent_val rhnChannel.parent_channel%TYPE;
+ parent_subscribed BOOLEAN;
+ server_has_base_chan BOOLEAN;
+ server_already_in_chan BOOLEAN;
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ consenting_user NUMBER;
+ allowed number := 0;
+ current_members_val number;
+ BEGIN
+ if user_id_in is not null then
+ allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
+ else
+ allowed := 1;
+ end if;
+
+ if allowed = 0 then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+
+
+ SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
+
+ IF channel_parent_val IS NOT NULL
+ THEN
+ -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
+ parent_subscribed := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
+ LOOP
+ parent_subscribed := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT parent_subscribed
+ THEN
+ RETURN;
+ END IF;
+ ELSE
+ -- base channel
+ server_has_base_chan := FALSE;
+ FOR base IN server_base_subscriptions(server_id_in)
+ LOOP
+ server_has_base_chan := TRUE;
+ END LOOP base;
+
+ IF server_has_base_chan
+ THEN
+ rhn_exception.raise_exception('channel_server_one_base');
+ END IF;
+ END IF;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ select current_members
+ into current_members_val
+ from rhnPrivateChannelFamily
+ where org_id = server_org_id_val and channel_family_id = channel_family_id_val
+ for update of current_members;
+
+ available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
+
+ IF available_subscriptions IS NULL OR
+ available_subscriptions > 0 or
+ can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
+ THEN
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
+ THEN
+ BEGIN
+
+ SELECT user_id INTO consenting_user
+ FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_consent');
+ END;
+ END IF;
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ queue_server(server_id_in, immediate_in);
+ ELSE
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ END IF;
+
+ END subscribe_server;
+
+ function can_server_consume_virt_channl(
+ server_id_in in number,
+ family_id_in in number )
+ return number
+ is
+
+ cursor server_virt_families is
+ select vi.virtual_system_id, cfvsl.channel_family_id
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnVirtualInstance vi
+ where
+ vi.virtual_system_id = server_id_in
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ and cfvsl.channel_family_id = family_id_in
+ and exists (
+ select 1
+ from rhnServerEntitlementView sev
+ where vi.host_system_id = sev.server_id
+ and sev.server_group_type_id = sgtvsl.server_group_type_id );
+ begin
+
+ for server_virt_family in server_virt_families loop
+ return 1;
+ end loop;
+
+ return 0;
+
+ end;
+
+
+ PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END LOOP server;
+ END bulk_subscribe_server;
+
+ PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ IF rhn_server.can_change_base_channel(server.element) = 1
+ THEN
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END IF;
+ END LOOP server;
+ END bulk_server_base_change;
+
+ procedure bulk_server_basechange_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ old_channel_id_in in number,
+ new_channel_id_in in number
+ ) is
+ cursor servers is
+ select sc.server_id id
+ from rhnChannel nc,
+ rhnServerChannelArchCompat scac,
+ rhnServer s,
+ rhnChannel oc,
+ rhnServerChannel sc,
+ rhnSet st
+ where 1=1
+ -- first, find the servers we're looking for.
+ and st.label = set_label_in
+ and st.user_id = set_uid_in
+ and st.element = sc.server_id
+ -- now, filter out anything that's not in the
+ -- old base channel.
+ and sc.channel_id = old_channel_id_in
+ and sc.channel_id = oc.id
+ and oc.parent_channel is null
+ -- now, see if it's compatible with the new base channel
+ and nc.id = new_channel_id_in
+ and nc.parent_channel is null
+ and sc.server_id = s.id
+ and s.server_arch_id = scac.server_arch_id
+ and scac.channel_arch_id = nc.channel_arch_id;
+ begin
+ for s in servers loop
+ insert into rhnSet (
+ user_id, label, element
+ ) values (
+ set_uid_in,
+ set_label_in || 'basechange',
+ s.id
+ );
+ end loop channel;
+ bulk_server_base_change(new_channel_id_in,
+ set_label_in || 'basechange',
+ set_uid_in);
+ delete from rhnSet
+ where label = set_label_in||'basechange'
+ and user_id = set_uid_in;
+ end bulk_server_basechange_from;
+
+ procedure bulk_guess_server_base(
+ set_label_in in varchar2,
+ set_uid_in in number
+ ) is
+ channel_id number;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ -- anything that doesn't work, we just ignore
+ begin
+ if rhn_server.can_change_base_channel(server.element) = 1
+ then
+ channel_id := guess_server_base(TO_NUMBER(server.element));
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
+ end if;
+ exception when others then
+ null;
+ end;
+ end loop server;
+ end;
+
+ function guess_server_base(
+ server_id_in in number
+ ) RETURN number is
+ cursor server_cursor is
+ select s.server_arch_id, s.release, s.org_id
+ from rhnServer s
+ where s.id = server_id_in;
+ begin
+ for s in server_cursor loop
+ for channel in base_channel_cursor(s.release,
+ s.server_arch_id, s.org_id)
+ loop
+ return channel.id;
+ end loop base_channel_cursor;
+ end loop server_cursor;
+ -- Server not found, or no base channel applies to it
+ return null;
+ end;
+
+ -- Private function
+ function normalize_server_arch(server_arch_in in varchar2)
+ return varchar2
+ deterministic
+ is
+ suffix VARCHAR2(128) := '-redhat-linux';
+ suffix_len NUMBER := length(suffix);
+ begin
+ if server_arch_in is NULL then
+ return NULL;
+ end if;
+ if instr(server_arch_in, '-') > 0
+ then
+ -- Suffix already present
+ return server_arch_in;
+ end if;
+ return server_arch_in || suffix;
+ end normalize_server_arch;
+
+ --
+ --
+ -- Raises:
+ -- server_arch_not_found
+ -- no_subscribe_permissions
+ function base_channel_for_release_arch(
+ release_in in varchar2,
+ server_arch_in in varchar2,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ server_arch varchar2(256) := normalize_server_arch(server_arch_in);
+ server_arch_id number;
+ begin
+ -- Look up the server arch
+ begin
+ select id
+ into server_arch_id
+ from rhnServerArch
+ where label = server_arch;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('server_arch_not_found');
+ end;
+ return base_channel_rel_archid(release_in, server_arch_id,
+ org_id_in, user_id_in);
+ end base_channel_for_release_arch;
+
+ function base_channel_rel_archid(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ denied_channel_id number := null;
+ valid_org_id number := org_id_in;
+ valid_user_id number := user_id_in;
+ channel_subscribable number;
+ begin
+ if org_id_in = -1 and user_id_in is not null then
+ -- Get the org id from the user id
+ begin
+ select org_id
+ into valid_org_id
+ from web_contact
+ where id = user_id_in;
+ exception
+ when no_data_found then
+ -- User doesn't exist
+ -- XXX Only list public stuff for now
+ valid_user_id := null;
+ valid_org_id := -1;
+ end;
+ end if;
+
+ for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
+ loop
+ -- This row is a possible match
+ if valid_user_id is null then
+ -- User ID not specified, so no user to channel permissions to
+ -- check
+ return c.id;
+ end if;
+
+ -- Check user to channel permissions
+ select loose_user_role_check(c.id, user_id_in, 'subscribe')
+ into channel_subscribable
+ from dual;
+
+ if channel_subscribable = 1 then
+ return c.id;
+ end if;
+
+ -- Base channel exists, but is not subscribable; keep trying
+ denied_channel_id := c.id;
+ end loop base_channel_fetch;
+
+ if denied_channel_id is not null then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+ -- No base channel applies
+ return NULL;
+ end base_channel_rel_archid;
+
+ procedure bulk_guess_server_base_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ channel_id_in in number
+ ) is
+ cursor channels(server_id_in in number) is
+ select rsc.channel_id
+ from rhnServerChannel rsc,
+ rhnChannel rc
+ where server_id_in = rsc.server_id
+ and rsc.channel_id = rc.id
+ and rc.parent_channel is null;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ for channel in channels(server.element)
+ loop
+ if channel.channel_id = channel_id_in
+ then
+ insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
+ end if;
+ end loop channel;
+ end loop server;
+ bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
+ delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
+ end;
+
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
+ IS
+ cursor server_channels(server_id_in in number) is
+ select s.org_id, sc.channel_id, cfm.channel_family_id
+ from rhnServer s,
+ rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where s.id = server_id_in
+ and s.id = sc.server_id
+ and sc.channel_id = cfm.channel_id;
+ BEGIN
+ for channel in server_channels(server_id_in)
+ loop
+ unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
+ rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
+ end loop channel;
+ END clear_subscriptions;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server IN NUMBER := 0 )
+ IS
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ server_already_in_chan BOOLEAN;
+ cursor channel_family_is_proxy(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-proxy';
+ cursor channel_family_is_satellite(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-satellite';
+ -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
+ -- with the package-level one, we get a "cursor already open", so we need a
+ -- copy on our call stack instead. GROAN.
+ cursor local_chk_server_parent_memb (
+ server_id_in number,
+ channel_id_in number ) is
+ select c.id
+ from rhnChannel c,
+ rhnServerChannel sc
+ where 1=1
+ and c.parent_channel = channel_id_in
+ and c.id = sc.channel_id
+ and sc.server_id = server_id_in;
+ BEGIN
+ FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
+ LOOP
+ if unsubscribe_children_in = 1 then
+ unsubscribe_server(server_id_in => server_id_in,
+ channel_id_in => child.id,
+ immediate_in => immediate_in,
+ unsubscribe_children_in => unsubscribe_children_in,
+ deleting_server => deleting_server);
+ else
+ rhn_exception.raise_exception('channel_unsubscribe_child_exists');
+ end if;
+ END LOOP child;
+
+ server_already_in_chan := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ if deleting_server = 0 then
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ end if;
+
+ DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
+
+ if deleting_server = 0 then
+ queue_server(server_id_in, immediate_in);
+ end if;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_unsubscribe_no_family');
+ END IF;
+
+ for ignore in channel_family_is_satellite(channel_family_id_val) loop
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ delete from rhnSatelliteChannelFamily where server_id = server_id_in;
+ end loop;
+
+ for ignore in channel_family_is_proxy(channel_family_id_val) loop
+ delete from rhnProxyInfo where server_id = server_id_in;
+ end loop;
+
+ DELETE FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ END unsubscribe_server;
+
+ PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
+ END LOOP server;
+ END bulk_unsubscribe_server;
+
+ FUNCTION family_for_channel(channel_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN channel_family_id_val;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END family_for_channel;
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ cfp channel_family_perm_cursor%ROWTYPE;
+ current_members_val NUMBER;
+ max_members_val NUMBER;
+ found NUMBER;
+ BEGIN
+ IF NOT channel_family_perm_cursor%ISOPEN
+ THEN
+ OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
+ END IF;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+
+ WHILE channel_family_perm_cursor%FOUND
+ LOOP
+ found := 1;
+
+ current_members_val := cfp.current_members;
+ max_members_val := cfp.max_members;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+ END LOOP;
+
+ IF channel_family_perm_cursor%ISOPEN
+ THEN
+ CLOSE channel_family_perm_cursor;
+ END IF;
+
+ -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
+ -- either way, there are no available subscriptions
+
+ IF found IS NULL
+ THEN
+ RETURN 0;
+ END IF;
+
+ -- null max members? in that case, pass it on; NULL means infinite
+ IF max_members_val IS NULL
+ THEN
+ RETURN NULL;
+ END IF;
+
+ -- otherwise, return the delta
+ RETURN max_members_val - current_members_val;
+ END available_family_subscriptions;
+
+ -- *******************************************************************
+ -- FUNCTION: channel_family_current_members
+ -- Calculates and returns the actual count of systems consuming
+ -- physical channel subscriptions.
+ -- Called by: update_family_counts
+ -- rhn_entitlements.repoll_virt_guest_entitlements
+ -- *******************************************************************
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number
+ is
+ current_members_count number := 0;
+ begin
+ select count(sc.server_id)
+ into current_members_count
+ from rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnServer s
+ where s.org_id = org_id_in
+ and s.id = sc.server_id
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and exists (
+ select 1
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
+ and cfsp.server_id = s.id
+ );
+
+ return current_members_count;
+ end;
+
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ IS
+ BEGIN
+ update rhnPrivateChannelFamily
+ set current_members = (
+ channel_family_current_members(channel_family_id_in, org_id_in)
+ )
+ where org_id = org_id_in
+ and channel_family_id = channel_family_id_in;
+ END update_family_counts;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN rhn_channel.available_family_subscriptions(
+ channel_family_id_val, org_id_in);
+ END available_chan_subscriptions;
+
+ -- *******************************************************************
+ -- PROCEDURE: entitle_customer
+ -- Creates a chan fam bucket, or sets max_members for an existing bucket
+ -- Called by: rhn_ep.poll_customer_internal
+ -- Calls: set_family_maxmembers + update_family_counts if the row
+ -- already exists, else it creates it in rhnPrivateChannelFamily.
+ -- *******************************************************************
+ procedure entitle_customer(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor permissions is
+ select 1
+ from rhnPrivateChannelFamily pcf
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ begin
+ for perm in permissions loop
+ set_family_maxmembers(
+ customer_id_in,
+ channel_family_id_in,
+ quantity_in
+ );
+ rhn_channel.update_family_counts(
+ channel_family_id_in,
+ customer_id_in
+ );
+ return;
+ end loop;
+
+ insert into rhnPrivateChannelFamily pcf (
+ channel_family_id, org_id, max_members, current_members
+ ) values (
+ channel_family_id_in, customer_id_in, quantity_in, 0
+ );
+ end;
+
+ -- *******************************************************************
+ -- PROCEDURE: set_family_maxmembers
+ -- Prunes an existing channel family bucket by unsubscribing the
+ -- necessary servers and sets max_members.
+ -- Called by: rhn_channel.entitle_customer
+ -- Calls: unsubscribe_server_from_family
+ -- *******************************************************************
+ procedure set_family_maxmembers(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor servers is
+ select server_id from (
+ select rownum row_number, server_id, modified from (
+ select rcfsp.server_id,
+ rcfsp.modified
+ from rhnChannelFamilyServerPhysical rcfsp
+ where rcfsp.customer_id = customer_id_in
+ and rcfsp.channel_family_id = channel_family_id_in
+ order by modified
+ )
+ where rownum > quantity_in
+ );
+ begin
+ -- prune subscribed servers
+ for server in servers loop
+ rhn_channel.unsubscribe_server_from_family(server.server_id,
+ channel_family_id_in);
+ end loop;
+
+ update rhnPrivateChannelFamily pcf
+ set pcf.max_members = quantity_in
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ end;
+
+ procedure unsubscribe_server_from_family(server_id_in in number,
+ channel_family_id_in in number)
+ is
+ begin
+ delete
+ from rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and channel_id in (
+ select rcfm.channel_id
+ from rhnChannelFamilyMembers rcfm
+ where rcfm.channel_family_id = channel_family_id_in);
+ end;
+
+ function get_org_id(channel_id_in in number)
+ return number
+ is
+ org_id_out number;
+ begin
+ select org_id into org_id_out
+ from rhnChannel
+ where id = channel_id_in;
+
+ return org_id_out;
+ end get_org_id;
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
+ return number
+ is
+ cursor families is
+ select 1
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = org_id_in;
+ begin
+ -- the idea: if we get past this query,
+ -- the user has the role, else catch the exception and return 0
+ for family in families loop
+ return 1;
+ end loop;
+ return 0;
+ end;
+
+ function get_org_access(channel_id_in in number, org_id_in in number)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query,
+ -- the org has access to the channel, else catch the exception and return 0
+ select distinct 1 into throwaway
+ from rhnChannelFamilyMembers CFM,
+ rhnOrgChannelFamilyPermissions CFP
+ where cfp.org_id = org_id_in
+ and CFM.channel_family_id = CFP.channel_family_id
+ and CFM.channel_id = channel_id_in
+ and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if a user has a given role, or if such a role is inferrable
+ function user_role_check_debug(channel_id_in in number,
+ user_id_in in number,
+ role_in in varchar2,
+ reason_out out varchar2)
+ return number
+ is
+ org_id number;
+ begin
+ org_id := rhn_user.get_org_id(user_id_in);
+
+ if role_in = 'manage' and
+ NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
+ reason_out := 'channel_not_owned';
+ return 0;
+ end if;
+
+ if role_in = 'subscribe' and
+ rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
+ reason_out := 'channel_not_available';
+ return 0;
+ end if;
+
+ -- channel admins have all roles
+ if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
+ reason_out := 'channel_admin';
+ return 1;
+ end if;
+
+ -- the subscribe permission is inferred
+ -- UNLESS the not_globally_subscribable flag is set
+ if role_in = 'subscribe'
+ then
+ if rhn_channel.org_channel_setting(channel_id_in,
+ org_id,
+ 'not_globally_subscribable') = 0 then
+ reason_out := 'globally_subscribable';
+ return 1;
+ end if;
+ end if;
+
+ -- all other roles (manage right now) are explicitly granted
+ reason_out := 'direct_permission';
+ return rhn_channel.direct_user_role_check(channel_id_in,
+ user_id_in, role_in);
+ end;
+
+ -- same as above, but with no OUT param; useful in views, etc
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway varchar2(256);
+ begin
+ return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
+ end;
+
+ -- same as above, but returns 1 if user_id_in is null
+ -- This is useful in queries where user_id is not specified
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ begin
+ if user_id_in is null then
+ return 1;
+ end if;
+ return user_role_check(channel_id_in, user_id_in, role_in);
+ end loose_user_role_check;
+
+ -- directly checks the table, no inferred permissions
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnChannelPermissionRole CPR,
+ rhnChannelPermission CP
+ where CP.user_id = user_id_in
+ and CP.channel_id = channel_id_in
+ and CPR.label = role_in
+ and CP.role_id = CPR.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if an org has a certain setting
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnOrgChannelSettingsType OCST,
+ rhnOrgChannelSettings OCS
+ where OCS.org_id = org_id_in
+ and OCS.channel_id = channel_id_in
+ and OCST.label = setting_in
+ and OCS.setting_id = OCST.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ FUNCTION channel_priority(channel_id_in IN number)
+ RETURN number
+ IS
+ channel_name varchar2(64);
+ priority number;
+ end_of_life_val date;
+ org_id_val number;
+ BEGIN
+
+ select name, end_of_life, org_id
+ into channel_name, end_of_life_val, org_id_val
+ from rhnChannel
+ where id = channel_id_in;
+
+ if end_of_life_val is not null then
+ return -400;
+ end if;
+
+ if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
+ priority := 1000;
+ if channel_name not like '%Beta%' then
+ priority := priority + 1000;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 5%' then 600
+ when channel_name like '%v. 4%' then 500
+ when channel_name like '%v. 3%' then 400
+ when channel_name like '%v. 2%' then 300
+ when channel_name like '%v. 1%' then 200
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
+ when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
+ when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
+ when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
+ when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
+ when channel_name like '%Extras%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%)' then 5
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+ elsif channel_name like 'Red Hat Desktop%' then
+ priority := 900;
+
+ if channel_name not like '%Beta%' then
+ priority := priority + 50;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 4%' then 40
+ when channel_name like '%v. 3%' then 30
+ when channel_name like '%v. 2%' then 20
+ when channel_name like '%v. 1%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+
+ elsif org_id_val is not null then
+ priority := 600;
+ else
+ priority := 500;
+ end if;
+
+ return -priority;
+
+ end channel_priority;
+
+ -- right now this only does the accounting changes; the cascade
+ -- actually does the rhnServerChannel delete.
+ procedure delete_server_channels(server_id_in in number)
+ is
+ begin
+ update rhnPrivateChannelFamily
+ set current_members = current_members -1
+ where org_id in (
+ select org_id
+ from rhnServer
+ where id = server_id_in
+ )
+ and channel_family_id in (
+ select rcfm.channel_family_id
+ from rhnChannelFamilyMembers rcfm,
+ rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and rsc.channel_id = rcfm.channel_id
+ and not exists (
+ select 1
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnServerEntitlementView sev,
+ rhnVirtualInstance vi
+ where
+ -- system is a virtual instance
+ vi.virtual_system_id = server_id_in
+ and vi.host_system_id = sev.server_id
+ -- system's host has a virt ent
+ and sev.label in ('virtualization_host',
+ 'virtualization_host_platform')
+ and sev.server_group_type_id =
+ sgtvsl.server_group_type_id
+ -- the host's virt ent grants a cf virt sub level
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ -- the cf is in that virt sub level
+ and cfvsl.channel_family_id = rcfm.channel_family_id
+ )
+ );
+ end;
+
+ -- this could certainly be optimized to do updates if needs be
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
+ is
+ begin
+ delete from rhnChannelNewestPackage where channel_id = channel_id_in;
+ insert into rhnChannelNewestPackage
+ ( channel_id, name_id, evr_id, package_id, package_arch_id )
+ ( select channel_id,
+ name_id, evr_id,
+ package_id, package_arch_id
+ from rhnChannelNewestPackageView
+ where channel_id = channel_id_in
+ );
+ insert into rhnChannelNewestPackageAudit (channel_id, caller)
+ values (channel_id_in, caller_in);
+ update rhnChannel
+ set last_modified = greatest(sysdate, last_modified + 1/86400)
+ where id = channel_id_in;
+ end;
+
+ procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate )
+ is
+
+ channel_last_modified date;
+ last_modified_value date;
+
+ cursor snapshots is
+ select snapshot_id id
+ from rhnSnapshotChannel
+ where channel_id = channel_id_in;
+
+ begin
+
+ select last_modified
+ into channel_last_modified
+ from rhnChannel
+ where id = channel_id_in;
+
+ last_modified_value := date_to_use;
+
+ if last_modified_value <= channel_last_modified then
+ last_modified_value := last_modified_value + 1/86400;
+ end if;
+
+ update rhnChannel set last_modified = last_modified_value
+ where id = channel_id_in;
+
+ if invalidate_ss = 1 then
+ for snapshot in snapshots loop
+ update rhnSnapshot
+ set invalid = lookup_snapshot_invalid_reason('channel_modified')
+ where id = snapshot.id;
+ end loop;
+ end if;
+
+ end update_channel;
+
+ procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelPackage
+ where package_id = package_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we want to invalidate the snapshot assocated with the channel when we
+ -- do this b/c we know we've added or removed or packages
+ rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
+ end loop;
+ end update_channels_by_package;
+
+
+ procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelErrata
+ where errata_id = errata_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we won't invalidate snapshots, b/c just changing the errata associated with
+ -- a channel shouldn't invalidate snapshots
+ rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
+ end loop;
+ end update_channels_by_errata;
+
+END rhn_channel;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.75 2005/03/04 00:04:19 jslagle
+-- bz #147617
+-- Made Red Hat Desktop sort a little better.
+--
+-- Revision 1.74 2005/02/22 03:24:47 jslagle
+-- bz #147617
+-- Improve channel_priority function to order channels better.
+--
+-- Revision 1.73 2004/08/16 20:39:30 pjones
+-- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
+--
+-- Revision 1.72 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.71 2004/04/13 16:28:36 bretm
+-- bugzilla: 119871
+--
+-- keep track of rhnServer.channels_changed through the pl/sql fns
+--
+-- Revision 1.70 2004/03/26 18:11:32 rbb
+-- Bugzilla: 114057
+--
+-- Add a script to determine channel priority.
+--
+-- Revision 1.69 2004/02/17 20:16:52 pjones
+-- bugzilla: none -- add cvs tags into the package as long as we're touching
+-- it anyway
+--
+-- Revision 1.68 2004/02/17 20:05:38 pjones
+-- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
+-- with arches incompatible with the target channel
+--
+-- Revision 1.67 2004/02/06 02:36:10 misa
+-- Changed normalize_server_arch to allow for solaris arches
+--
+-- Revision 1.66 2003/11/13 16:58:34 cturner
+-- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
+--
+-- Revision 1.65 2003/10/23 20:26:24 bretm
+-- bugzilla: none
+--
+-- note the channel label when we unsubscribe, too
+--
+-- Revision 1.64 2003/10/15 14:47:17 bretm
+-- bugzilla: none
+--
+-- add the channel label to the server history summary line when we log a channel change
+--
+-- Revision 1.63 2003/09/24 19:25:56 pjones
+-- this wasn't the right fix, put it back
+--
+-- Revision 1.62 2003/09/24 17:42:19 pjones
+-- bugzilla: none
+--
+-- limit our server base channel guess to channels with available permissions
+--
+-- Revision 1.61 2003/09/22 21:00:40 cturner
+-- add method for easy acl check
+--
+-- Revision 1.60 2003/09/17 22:14:11 misa
+-- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
+--
+-- Revision 1.59 2003/08/21 13:41:17 cturner
+-- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
+--
+-- Revision 1.58 2003/07/24 16:46:22 cturner
+-- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
+--
+-- Revision 1.57 2003/07/24 16:44:16 misa
+-- bugzilla: none A function more usable on the rhnapp side
+--
+-- Revision 1.56 2003/07/23 22:36:51 cturner
+-- argh, max returns null even when now rows; use distinct. how revolting
+--
+-- Revision 1.55 2003/07/23 22:01:31 cturner
+-- oops, this one can return multiple rows; eliminate that in a lazy way
+--
+-- Revision 1.54 2003/07/23 21:59:19 cturner
+-- rework how rhnUserChannel works; move to plsql for speed and maintenance
+--
+-- Revision 1.53 2003/07/21 17:49:12 pjones
+-- bugzilla: none
+--
+-- add optional user for subscribe_server
+--
+-- Revision 1.52 2003/07/14 22:19:29 misa
+-- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
+--
+-- Revision 1.51 2003/06/26 22:09:04 pjones
+-- bugzilla: none
+--
+-- log subscribe and unsubscribe
+--
+-- Revision 1.50 2003/06/05 19:31:15 pjones
+-- bugzilla: 88278 -- make the cursor name smaller
+--
+-- Revision 1.49 2003/06/05 19:18:21 pjones
+-- bugzilla: 88278
+--
+-- unsubscribe_server() opens the package-level cursor when it invokes itself,
+-- so we're using a local copy instead.
+--
+-- Revision 1.48 2003/06/04 16:41:39 pjones
+-- bugzilla: none
+--
+-- make bulk_guess_server_base() silently ignore unguessables
+--
+-- Revision 1.47 2003/06/04 16:27:03 pjones
+-- bugzilla: 88822
+--
+-- eliminate the last outliers that remove things from channels without using
+-- unsubscribe_server, I think.
+--
+-- Revision 1.46 2003/06/03 20:49:37 pjones
+-- bugzilla: 88822
+-- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
+-- for the server in question
+--
+-- Revision 1.45 2003/06/02 20:41:45 pjones
+-- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
+-- problem. Basicly, if you're out of the channel for any reason, you're
+-- also out of rhnProxyInfo/rhnProxyInfo
+--
+-- Revision 1.44 2003/03/24 15:26:28 pjones
+-- bugzilla: 85812
+--
+-- bulk_server_base_change silently ignores servers that are satellites
+-- or proxies, as requested.
+--
+-- Revision 1.43 2003/02/26 20:28:17 pjones
+-- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
+-- the old codepath is:
+--
+-- ep ->
+-- rhn_ep.entitlement_run_me() ->
+-- rhn_ep.poll_customer() ->
+-- rhn_channel.entitle_customer()
+--
+-- which doesn't change current_members, even though it may remove servers
+-- from the family.
+--
+-- There's another bug here: currently, we don't try to order forced
+-- unsubscribes in any way; we just use
+-- rhn_channel.unsubscribe_server_from_family . If there are any child
+-- channel subscriptions, this will leave them subscribed. We really need
+-- to iterate across the channels again, and subscribe any channel for which
+-- there are no parent channel subscriptions.
+--
+-- Ugh.
+--
+-- Revision 1.42 2003/01/28 00:19:45 pjones
+-- fix clear_subscriptions; AFAICT, this is only hit on the
+-- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
+-- it infrequent enough that it could be our "bad count" culprit.
+--
+-- Revision 1.41 2003/01/14 19:51:45 pjones
+-- make setting current_members on rhnChannelFamilyPermissions work when
+-- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/061-rhn_package-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/061-rhn_package-deterministic.sql
new file mode 100644
index 0000000..8bd505f
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/061-rhn_package-deterministic.sql
@@ -0,0 +1,45 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE rhn_package
+IS
+ CURSOR channel_occupancy_cursor(package_id_in IN NUMBER) IS
+ SELECT C.id channel_id, C.name channel_name
+ FROM rhnChannel C,
+ rhnChannelPackage CP
+ WHERE C.id = CP.channel_id
+ AND CP.package_id = package_id_in
+ ORDER BY C.name DESC;
+
+ FUNCTION canonical_name(name_in IN VARCHAR2, evr_in IN EVR_T,
+ arch_in IN VARCHAR2 := NULL)
+ RETURN VARCHAR2
+ DETERMINISTIC;
+
+ FUNCTION channel_occupancy_string(package_id_in IN NUMBER, separator_in VARCHAR2 := ', ')
+ RETURN VARCHAR2;
+
+END rhn_package;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.3 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/062-rpm.pks-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/062-rpm.pks-non-deterministic.sql
new file mode 100644
index 0000000..a6428c4
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/062-rpm.pks-non-deterministic.sql
@@ -0,0 +1,56 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+-- PL/SQL version of rpmvercompare
+--
+
+CREATE OR REPLACE PACKAGE rpm AS
+ FUNCTION vercmp(
+ e1 VARCHAR2, v1 VARCHAR2, r1 VARCHAR2,
+ e2 VARCHAR2, v2 VARCHAR2, r2 VARCHAR2)
+ RETURN NUMBER
+ DETERMINISTIC
+ PARALLEL_ENABLE;
+ PRAGMA RESTRICT_REFERENCES(vercmp, WNDS, RNDS);
+
+ FUNCTION vercmpCounter
+ return NUMBER
+ PARALLEL_ENABLE;
+ PRAGMA RESTRICT_REFERENCES(vercmpCounter, WNDS, RNDS);
+
+ FUNCTION vercmpResetCounter
+ return NUMBER
+ PARALLEL_ENABLE;
+ PRAGMA RESTRICT_REFERENCES(vercmpResetCounter, WNDS, RNDS);
+
+END rpm;
+/
+SHOW ERRORS;
+
+-- $Log$
+-- Revision 1.4 2002/05/10 22:08:23 pjones
+-- id/log
+--
+-- Revision 1.3 2002/04/02 23:19:44 misa
+-- Added the comparison counter and assorted functions for handling it.
+--
+-- Revision 1.2 2002/03/21 20:21:24 misa
+-- For some reason this doesn't work. I'll further investigate it.
+--
+-- Revision 1.1 2002/03/21 20:14:10 misa
+-- The packaged version of the PL/SQL rpmvercmp
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/063-rpm.pkb-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/063-rpm.pkb-deterministic.sql
new file mode 100644
index 0000000..5ccf511
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/063-rpm.pkb-deterministic.sql
@@ -0,0 +1,267 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+-- PL/SQL version of rpmvercompare
+
+CREATE OR REPLACE PACKAGE BODY rpm AS
+ vercmp_counter NUMBER := 0;
+
+ FUNCTION isdigit(ch CHAR)
+ RETURN BOOLEAN
+ deterministic
+ IS
+ BEGIN
+ if ascii(ch) between ascii('0') and ascii('9')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END isdigit;
+
+
+ FUNCTION isalpha(ch CHAR)
+ RETURN BOOLEAN
+ deterministic
+ IS
+ BEGIN
+ if ascii(ch) between ascii('a') and ascii('z') or
+ ascii(ch) between ascii('A') and ascii('Z')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END isalpha;
+
+
+ FUNCTION isalphanum(ch CHAR)
+ RETURN BOOLEAN
+ deterministic
+ IS
+ BEGIN
+ if ascii(ch) between ascii('a') and ascii('z') or
+ ascii(ch) between ascii('A') and ascii('Z') or
+ ascii(ch) between ascii('0') and ascii('9')
+ then
+ return TRUE;
+ end if;
+ return FALSE;
+ END isalphanum;
+
+
+ FUNCTION rpmstrcmp (string1 IN VARCHAR2, string2 IN VARCHAR2)
+ RETURN NUMBER
+ deterministic
+ IS
+ digits CHAR(10) := '0123456789';
+ lc_alpha CHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
+ uc_alpha CHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
+ alpha CHAR(54) := lc_alpha || uc_alpha;
+ str1 VARCHAR2(32767) := string1;
+ str2 VARCHAR2(32767) := string2;
+ one VARCHAR2(32767);
+ two VARCHAR2(32767);
+ isnum BOOLEAN;
+ BEGIN
+ if str1 is NULL or str2 is NULL
+ then
+ raise VALUE_ERROR;
+ end if;
+ -- easy comparison to see if versions are identical
+ if str1 = str2
+ then
+ return 0;
+ end if;
+ -- loop through each version segment of str1 and str2 and compare them
+ one := str1;
+ two := str2;
+
+ <<segment_loop>>
+ while one is not null and two is not null
+ loop
+ declare
+ segm1 VARCHAR2(32767);
+ segm2 VARCHAR2(32767);
+ begin
+ --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
+ -- Throw out all non-alphanum characters
+ while one is not null and not isalphanum(one)
+ loop
+ one := substr(one, 2);
+ end loop;
+ while two is not null and not isalphanum(two)
+ loop
+ two := substr(two, 2);
+ end loop;
+ --DBMS_OUTPUT.PUT_LINE('new params: ' || one || ',' || two);
+
+ str1 := one;
+ str2 := two;
+
+ /* grab first completely alpha or completely numeric segment */
+ /* leave one and two pointing to the start of the alpha or numeric */
+ /* segment and walk str1 and str2 to end of segment */
+
+ if str1 is not null and isdigit(str1)
+ then
+ str1 := ltrim(str1, digits);
+ str2 := ltrim(str2, digits);
+ isnum := true;
+ else
+ str1 := ltrim(str1, alpha);
+ str2 := ltrim(str2, alpha);
+ isnum := false;
+ end if;
+
+ --DBMS_OUTPUT.PUT_LINE('Len: ' || length(str1) || ',' || length(str2));
+ -- Oracle trats the length of an empty string as null
+ if str1 is not null
+ then segm1 := substr(one, 1, length(one) - length(str1));
+ else segm1 := one;
+ end if;
+
+ if str2 is not null
+ then segm2 := substr(two, 1, length(two) - length(str2));
+ else segm2 := two;
+ end if;
+
+ --DBMS_OUTPUT.PUT_LINE('Segments: ' || segm1 || ',' || segm2);
+ --DBMS_OUTPUT.PUT_LINE('Rest: ' || str1 || ',' || str2);
+ /* take care of the case where the two version segments are */
+ /* different types: one numeric and one alpha */
+ if segm1 is null then return -1; end if; /* arbitrary */
+ if segm2 is null then
+ if isnum then
+ return 1;
+ else
+ return -1;
+ end if;
+ end if;
+
+ if isnum
+ then
+ /* this used to be done by converting the digit segments */
+ /* to ints using atoi() - it's changed because long */
+ /* digit segments can overflow an int - this should fix that. */
+
+ /* throw away any leading zeros - it's a number, right? */
+ segm1 := ltrim(segm1, '0');
+ segm2 := ltrim(segm2, '0');
+
+ /* whichever number has more digits wins */
+ -- length of empty string is null
+ if segm1 is null and segm2 is not null
+ then
+ return -1;
+ end if;
+ if segm1 is not null and segm2 is null
+ then
+ return 1;
+ end if;
+ if length(segm1) > length(segm2) then return 1; end if;
+ if length(segm2) > length(segm1) then return -1; end if;
+ end if;
+
+ /* strcmp will return which one is greater - even if the two */
+ /* segments are alpha or if they are numeric. don't return */
+ /* if they are equal because there might be more segments to */
+ /* compare */
+
+ if segm1 < segm2 then return -1; end if;
+ if segm1 > segm2 then return 1; end if;
+
+ one := str1;
+ two := str2;
+ end;
+ end loop segment_loop;
+ /* this catches the case where all numeric and alpha segments have */
+ /* compared identically but the segment sepparating characters were */
+ /* different */
+ if one is null and two is null then return 0; end if;
+
+ /* whichever version still has characters left over wins */
+ if one is null then return -1; end if;
+ return 1;
+ END rpmstrcmp;
+
+
+ FUNCTION vercmp(
+ e1 VARCHAR2, v1 VARCHAR2, r1 VARCHAR2,
+ e2 VARCHAR2, v2 VARCHAR2, r2 VARCHAR2)
+ RETURN NUMBER
+ IS
+ rc NUMBER;
+ BEGIN
+ DECLARE
+ ep1 NUMBER;
+ ep2 NUMBER;
+ BEGIN
+ vercmp_counter := vercmp_counter + 1;
+ if e1 is null then
+ ep1 := 0;
+ else
+ ep1 := TO_NUMBER(e1);
+ end if;
+ if e2 is null then
+ ep2 := 0;
+ else
+ ep2 := TO_NUMBER(e2);
+ end if;
+ -- Epochs are non-null; compare them
+ if ep1 < ep2 then return -1; end if;
+ if ep1 > ep2 then return 1; end if;
+ rc := rpmstrcmp(v1, v2);
+ if rc != 0 then return rc; end if;
+ return rpmstrcmp(r1, r2);
+ END;
+
+ END vercmp;
+
+ FUNCTION vercmpCounter
+ RETURN NUMBER
+ IS
+ BEGIN
+ return vercmp_counter;
+ END vercmpCounter;
+
+ FUNCTION vercmpResetCounter
+ RETURN NUMBER
+ IS
+ result NUMBER;
+ BEGIN
+ result := vercmp_counter;
+ vercmp_counter := 0;
+ return result;
+ END vercmpResetCounter;
+END rpm;
+/
+SHOW ERRORS;
+
+-- $Log$
+-- Revision 1.4 2003/09/02 18:03:50 pjones
+-- bugzilla: none
+--
+-- our rpmvercmp doesn't match the "fixed" rpm way. Does now.
+--
+-- Revision 1.3 2002/05/10 22:08:23 pjones
+-- id/log
+--
+-- Revision 1.2 2002/04/02 23:19:44 misa
+-- Added the comparison counter and assorted functions for handling it.
+--
+-- Revision 1.1 2002/03/21 20:14:10 misa
+-- The packaged version of the PL/SQL rpmvercmp
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/064-channel_name_join-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/064-channel_name_join-deterministic.sql
new file mode 100644
index 0000000..61303b5
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/064-channel_name_join-deterministic.sql
@@ -0,0 +1,52 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace function
+channel_name_join(sep_in in varchar2, ch_in in channel_name_t)
+return varchar2
+deterministic
+is
+ ret varchar2(4000);
+ i binary_integer;
+begin
+ ret := '';
+ i := ch_in.first;
+
+ if i is null
+ then
+ return ret;
+ end if;
+
+ ret := ch_in(i);
+ i := ch_in.next(i);
+
+ while i is not null
+ loop
+ ret := ret || sep_in || ch_in(i);
+ i := ch_in.next(i);
+ end loop;
+
+ return ret;
+end;
+/
+
+-- $Log$
+-- Revision 1.3 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/065-id_join-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/065-id_join-deterministic.sql
new file mode 100644
index 0000000..3e2dadf
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/065-id_join-deterministic.sql
@@ -0,0 +1,53 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+ID_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_id_t)
+RETURN VARCHAR2
+deterministic
+IS
+ ret VARCHAR2(4000);
+ i BINARY_INTEGER;
+BEGIN
+ ret := '';
+ i := ugi_in.FIRST;
+
+ IF i IS NULL
+ THEN
+ RETURN ret;
+ END IF;
+
+ ret := ugi_in(i);
+ i := ugi_in.NEXT(i);
+
+ WHILE i IS NOT NULL
+ LOOP
+ ret := ret || sep_in || ugi_in(i);
+ i := ugi_in.NEXT(i);
+ END LOOP;
+
+ RETURN ret;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/066-label_join-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/066-label_join-deterministic.sql
new file mode 100644
index 0000000..2de8201
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/066-label_join-deterministic.sql
@@ -0,0 +1,53 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LABEL_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_label_t)
+RETURN VARCHAR2
+deterministic
+IS
+ ret VARCHAR2(4000);
+ i BINARY_INTEGER;
+BEGIN
+ ret := '';
+ i := ugi_in.FIRST;
+
+ IF i IS NULL
+ THEN
+ RETURN ret;
+ END IF;
+
+ ret := ugi_in(i);
+ i := ugi_in.NEXT(i);
+
+ WHILE i IS NOT NULL
+ LOOP
+ ret := ret || sep_in || ugi_in(i);
+ i := ugi_in.NEXT(i);
+ END LOOP;
+
+ RETURN ret;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/067-lookup_channel_arch-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/067-lookup_channel_arch-non-deterministic.sql
new file mode 100644
index 0000000..51de490
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/067-lookup_channel_arch-non-deterministic.sql
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CHANNEL_ARCH(label_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ channel_arch_id NUMBER;
+BEGIN
+ SELECT id
+ INTO channel_arch_id
+ FROM rhnChannelArch
+ WHERE label = label_in;
+
+ RETURN channel_arch_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('channel_arch_not_found');
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2004/02/20 18:08:51 pjones
+-- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
+-- insert
+-- add changes files for nonlinux systems
+--
+-- Revision 1.1 2002/11/13 23:16:18 pjones
+-- lookup_*_arch()
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/068-lookup_client_capability-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/068-lookup_client_capability-non-deterministic.sql
new file mode 100644
index 0000000..a60c907
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/068-lookup_client_capability-non-deterministic.sql
@@ -0,0 +1,47 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CLIENT_CAPABILITY(name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ cap_name_id NUMBER;
+BEGIN
+ SELECT id
+ INTO cap_name_id
+ FROM rhnClientCapabilityName
+ WHERE name = name_in;
+
+ RETURN cap_name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnClientCapabilityName (id, name)
+ VALUES (rhn_client_capname_id_seq.nextval, name_in)
+ RETURNING id INTO cap_name_id;
+ COMMIT;
+ RETURN cap_name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/07/21 22:30:04 misa
+-- bugzilla: none Lookup function for capabilities
+--
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/069-lookup_config_filename-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/069-lookup_config_filename-non-deterministic.sql
new file mode 100644
index 0000000..77408c9
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/069-lookup_config_filename-non-deterministic.sql
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CONFIG_FILENAME(name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ SELECT id
+ INTO name_id
+ FROM rhnConfigFileName
+ WHERE path = name_in;
+
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnConfigFileName (id, path)
+ VALUES (rhn_cfname_id_seq.nextval, name_in)
+ RETURNING id INTO name_id;
+ COMMIT;
+ RETURN name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/07/31 16:55:34 cturner
+-- lookup helper function and blob for configfiles
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/070-lookup_cve-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/070-lookup_cve-non-deterministic.sql
new file mode 100644
index 0000000..5c0d707
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/070-lookup_cve-non-deterministic.sql
@@ -0,0 +1,52 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_CVE(name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ SELECT id
+ INTO name_id
+ FROM rhnCve
+ WHERE name = name_in;
+
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnCve (id, name)
+ VALUES (rhn_cve_id_seq.nextval, name_in)
+ RETURNING id INTO name_id;
+ COMMIT;
+ RETURN name_id;
+END LOOKUP_CVE;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2004/07/07 21:48:25 pjones
+-- bugzilla: 123370 -- "end lookup_cve", to be consistent with the dbchange way
+--
+-- Revision 1.1 2004/07/07 17:27:36 bretm
+-- bugzilla: 123370
+--
+-- lookup_cve utility function
+--
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/071-lookup_evr-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/071-lookup_evr-non-deterministic.sql
new file mode 100644
index 0000000..d38b4ae
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/071-lookup_evr-non-deterministic.sql
@@ -0,0 +1,48 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_EVR(e_in IN VARCHAR2, v_in IN VARCHAR2, r_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ evr_id NUMBER;
+BEGIN
+ SELECT id INTO evr_id
+ FROM rhnPackageEvr
+ WHERE ((epoch IS NULL and e_in IS NULL) OR (epoch = e_in))
+ AND version = v_in AND release = r_in;
+
+ RETURN evr_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnPackageEvr (id, epoch, version, release, evr)
+ VALUES (rhn_pkg_evr_seq.nextval, e_in, v_in, r_in,
+ EVR_T(e_in, v_in, r_in))
+ RETURNING id INTO evr_id;
+ COMMIT;
+ RETURN evr_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.3 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/072-lookup_package_arch-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/072-lookup_package_arch-non-deterministic.sql
new file mode 100644
index 0000000..34a703f
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/072-lookup_package_arch-non-deterministic.sql
@@ -0,0 +1,50 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_PACKAGE_ARCH(label_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ package_arch_id NUMBER;
+BEGIN
+ if label_in is null then
+ return null;
+ end if;
+
+ SELECT id
+ INTO package_arch_id
+ FROM rhnPackageArch
+ WHERE label = label_in;
+
+ RETURN package_arch_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('package_arch_not_found');
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2004/02/20 18:08:51 pjones
+-- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
+-- insert
+-- add changes files for nonlinux systems
+--
+-- Revision 1.1 2002/11/13 23:16:18 pjones
+-- lookup_*_arch()
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/073-lookup_package_capability-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/073-lookup_package_capability-non-deterministic.sql
new file mode 100644
index 0000000..9cf7da4
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/073-lookup_package_capability-non-deterministic.sql
@@ -0,0 +1,55 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_PACKAGE_CAPABILITY(name_in IN VARCHAR2,
+ version_in IN VARCHAR2 DEFAULT NULL)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ IF version_in IS NULL THEN
+ SELECT id
+ INTO name_id
+ FROM rhnPackageCapability
+ WHERE name = name_in
+ AND version IS NULL;
+ ELSE
+ SELECT id
+ INTO name_id
+ FROM rhnPackageCapability
+ WHERE name = name_in
+ AND version = version_in;
+ END IF;
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnPackageCapability (id, name, version)
+ VALUES (rhn_pkg_capability_id_seq.nextval, name_in, version_in)
+ RETURNING id INTO name_id;
+ COMMIT;
+ RETURN name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/03/03 16:46:51 misa
+-- bugzilla: 83674 Reworked the schema for package removal
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/074-lookup_package_delta-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/074-lookup_package_delta-non-deterministic.sql
new file mode 100644
index 0000000..63b2272
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/074-lookup_package_delta-non-deterministic.sql
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_PACKAGE_DELTA(n_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ SELECT id INTO name_id
+ FROM rhnPackageDelta
+ WHERE label = n_in;
+
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnPackageDelta (id, label)
+ VALUES (rhn_packagedelta_id_seq.nextval, n_in)
+ RETURNING id INTO name_id;
+ COMMIT;
+ RETURN name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/06/30 22:14:16 misa
+-- bugzilla: none Added a lookup function for package delta
+--
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/075-lookup_package_name-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/075-lookup_package_name-non-deterministic.sql
new file mode 100644
index 0000000..8166080
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/075-lookup_package_name-non-deterministic.sql
@@ -0,0 +1,58 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_PACKAGE_NAME(name_in IN VARCHAR2, ignore_null in number := 0)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ if ignore_null = 1 and name_in is null then
+ return null;
+ end if;
+
+ SELECT id
+ INTO name_id
+ FROM rhnPackageName
+ WHERE name = name_in;
+
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnPackageName (id, name)
+ VALUES (rhn_pkg_name_seq.nextval, name_in)
+ RETURNING id INTO name_id;
+ COMMIT;
+ RETURN name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.5 2003/02/28 19:58:35 pjones
+-- api change for lookup_package_name
+--
+-- Revision 1.4 2003/02/28 19:27:32 pjones
+-- make lookup_package_name return early null with null input
+-- lookup_hw* in lookup_functions target
+--
+-- Revision 1.3 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/076-lookup_server_arch-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/076-lookup_server_arch-non-deterministic.sql
new file mode 100644
index 0000000..9ab75f5
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/076-lookup_server_arch-non-deterministic.sql
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_SERVER_ARCH(label_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ server_arch_id NUMBER;
+BEGIN
+ SELECT id
+ INTO server_arch_id
+ FROM rhnServerArch
+ WHERE label = label_in;
+
+ RETURN server_arch_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('server_arch_not_found');
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2004/02/20 18:08:51 pjones
+-- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
+-- insert
+-- add changes files for nonlinux systems
+--
+-- Revision 1.1 2002/11/13 23:16:18 pjones
+-- lookup_*_arch()
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql
new file mode 100644
index 0000000..eb4a80d
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql
@@ -0,0 +1,45 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+lookup_snapshot_invalid_reason(label_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ snapshot_invalid_reason_id number;
+BEGIN
+ SELECT id
+ INTO snapshot_invalid_reason_id
+ FROM rhnSnapshotInvalidReason
+ WHERE label = label_in;
+
+ RETURN snapshot_invalid_reason_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('invalid_snapshot_invalid_reason');
+END;
+/
+SHOW ERRORS
+
+--
+-- $Log$
+-- Revision 1.1 2003/10/07 20:49:18 pjones
+-- bugzilla: 106188
+--
+-- snapshot invalidation
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/078-lookup_source_name-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/078-lookup_source_name-non-deterministic.sql
new file mode 100644
index 0000000..cfbc58a
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/078-lookup_source_name-non-deterministic.sql
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_SOURCE_NAME(name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ source_id NUMBER;
+BEGIN
+ select id into source_id
+ from rhnSourceRPM
+ where name = name_in;
+
+ RETURN source_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ insert into rhnSourceRPM(id, name)
+ values (rhn_sourcerpm_id_seq.nextval, name_in)
+ returning id into source_id;
+ COMMIT;
+ RETURN source_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.5 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/079-lookup_tag-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/079-lookup_tag-non-deterministic.sql
new file mode 100644
index 0000000..00a24ad
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/079-lookup_tag-non-deterministic.sql
@@ -0,0 +1,49 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_TAG(org_id_in IN NUMBER, name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ tag_id NUMBER;
+BEGIN
+ select id into tag_id
+ from rhnTag
+ where org_id = org_id_in
+ and name_id = lookup_tag_name(name_in);
+
+ RETURN tag_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ insert into rhnTag(id, org_id, name_id)
+ values (rhn_tag_id_seq.nextval, org_id_in, lookup_tag_name(name_in))
+ returning id into tag_id;
+ COMMIT;
+ RETURN tag_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/10/16 14:23:33 bretm
+-- bugzilla: 107189
+--
+-- o added server_id to rhnSnapshotTag
+-- o added lookup_tag(org_id, tagname)
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/080-lookup_tag_name-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/080-lookup_tag_name-non-deterministic.sql
new file mode 100644
index 0000000..9b995b2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/080-lookup_tag_name-non-deterministic.sql
@@ -0,0 +1,47 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_TAG_NAME(name_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ name_id NUMBER;
+BEGIN
+ select id into name_id
+ from rhnTagName
+ where name = name_in;
+
+ RETURN name_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ insert into rhnTagName(id, name)
+ values (rhn_tagname_id_seq.nextval, name_in)
+ returning id into name_id;
+ COMMIT;
+ RETURN name_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.1 2003/10/15 20:29:53 bretm
+-- bugzilla: 107189
+--
+-- 1st pass at snapshot tagging schema
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/081-lookup_transaction_package-non-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/081-lookup_transaction_package-non-deterministic.sql
new file mode 100644
index 0000000..5ae1c92
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/081-lookup_transaction_package-non-deterministic.sql
@@ -0,0 +1,83 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+LOOKUP_TRANSACTION_PACKAGE(o_in IN VARCHAR2, n_in IN VARCHAR2,
+ e_in IN VARCHAR2, v_in IN VARCHAR2, r_in IN VARCHAR2, a_in IN VARCHAR2)
+RETURN NUMBER
+IS
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ o_id NUMBER;
+ n_id NUMBER;
+ e_id NUMBER;
+ p_arch_id NUMBER;
+ tp_id NUMBER;
+BEGIN
+ BEGIN
+ SELECT id
+ INTO o_id
+ FROM rhnTransactionOperation
+ WHERE label = o_in;
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('invalid_transaction_operation');
+ END;
+
+ SELECT LOOKUP_PACKAGE_NAME(n_in)
+ INTO n_id
+ FROM dual;
+
+ SELECT LOOKUP_EVR(e_in, v_in, r_in)
+ INTO e_id
+ FROM dual;
+
+ p_arch_id := NULL;
+ IF a_in IS NOT NULL
+ THEN
+ SELECT LOOKUP_PACKAGE_ARCH(a_in)
+ INTO p_arch_id
+ FROM dual;
+ END IF;
+
+ SELECT id
+ INTO tp_id
+ FROM rhnTransactionPackage
+ WHERE operation = o_id
+ AND name_id = n_id
+ AND evr_id = e_id
+ AND (package_arch_id = p_arch_id OR (p_arch_id IS NULL AND package_arch_id IS NULL));
+ RETURN tp_id;
+EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ INSERT INTO rhnTransactionPackage
+ (id, operation, name_id, evr_id, package_arch_id)
+ VALUES (rhn_transpack_id_seq.nextval, o_id, n_id, e_id, p_arch_id)
+ RETURNING id INTO tp_id;
+ COMMIT;
+ RETURN tp_id;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2003/07/09 16:29:33 cturner
+-- update some strings and change lookup_transaction_package to throw an exception instead of SILENTLY RETURNING NULL
+--
+-- Revision 1.1 2003/07/01 14:52:35 misa
+-- bugzilla: 90376 Need function to add transactions in the DB
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/082-name_join-deterministic.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/082-name_join-deterministic.sql
new file mode 100644
index 0000000..b314fec
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/082-name_join-deterministic.sql
@@ -0,0 +1,53 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE FUNCTION
+NAME_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_name_t)
+RETURN VARCHAR2
+deterministic
+IS
+ ret VARCHAR2(4000);
+ i BINARY_INTEGER;
+BEGIN
+ ret := '';
+ i := ugi_in.FIRST;
+
+ IF i IS NULL
+ THEN
+ RETURN ret;
+ END IF;
+
+ ret := ugi_in(i);
+ i := ugi_in.NEXT(i);
+
+ WHILE i IS NOT NULL
+ LOOP
+ ret := ret || sep_in || ugi_in(i);
+ i := ugi_in.NEXT(i);
+ END LOOP;
+
+ RETURN ret;
+END;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.2 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/083-truncateCacheQueue-execute-immediate.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/083-truncateCacheQueue-execute-immediate.sql
new file mode 100644
index 0000000..9ee020b
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/083-truncateCacheQueue-execute-immediate.sql
@@ -0,0 +1,29 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace procedure truncateCacheQueue as
+begin
+ execute immediate 'Truncate Table rhnOrgErrataCacheQueue';
+end;
+/
+
+-- $Log$
+-- Revision 1.2 2002/05/13 22:53:38 pjones
+-- cvs id/log
+-- some (note enough) readability fixes
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/084-rhnServerNeededPackageCache-indexes.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/084-rhnServerNeededPackageCache-indexes.sql
new file mode 100644
index 0000000..26ba826
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/084-rhnServerNeededPackageCache-indexes.sql
@@ -0,0 +1,42 @@
+
+drop index rhn_snpc_pid_eid_sid_idx;
+drop index rhn_snpc_sid_pid_eid_idx;
+drop index rhn_snpc_eid_sid_pid_idx;
+drop index rhn_snpc_oid_eid_sid_idx;
+
+create index rhn_snpc_pid_idx
+ on rhnServerNeededPackageCache(package_id)
+ parallel
+ tablespace [[128m_tbs]]
+ storage ( pctincrease 1 freelists 16 )
+ pctfree 10
+ initrans 32
+ nologging;
+
+create index rhn_snpc_sid_idx
+ on rhnServerNeededPackageCache(server_id)
+ parallel
+ tablespace [[128m_tbs]]
+ storage ( pctincrease 1 freelists 16 )
+ pctfree 10
+ initrans 32
+ nologging;
+
+create index rhn_snpc_eid_idx
+ on rhnServerNeededPackageCache(errata_id)
+ parallel
+ tablespace [[128m_tbs]]
+ storage ( pctincrease 1 freelists 16 )
+ pctfree 10
+ initrans 32
+ nologging;
+
+create index rhn_snpc_oid_idx
+ on rhnServerNeededPackageCache(org_id)
+ parallel
+ tablespace [[128m_tbs]]
+ storage ( pctincrease 1 freelists 16 )
+ pctfree 10
+ initrans 32
+ nologging;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/090-enable-row-movement.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/090-enable-row-movement.sql
new file mode 100644
index 0000000..7d10acf
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/090-enable-row-movement.sql
@@ -0,0 +1,391 @@
+
+alter table PXTSessions enable row movement;
+alter table demo_log enable row movement;
+alter table rhnAction enable row movement;
+alter table rhnActionConfigChannel enable row movement;
+alter table rhnActionConfigDate enable row movement;
+alter table rhnActionConfigDateFile enable row movement;
+alter table rhnActionConfigFileName enable row movement;
+alter table rhnActionConfigRevision enable row movement;
+alter table rhnActionConfigRevisionResult enable row movement;
+alter table rhnActionDaemonConfig enable row movement;
+alter table rhnActionErrataUpdate enable row movement;
+alter table rhnActionKickstart enable row movement;
+alter table rhnActionKickstartFileList enable row movement;
+alter table rhnActionKickstartGuest enable row movement;
+alter table rhnActionPackage enable row movement;
+alter table rhnActionPackageAnswerfile enable row movement;
+alter table rhnActionPackageDelta enable row movement;
+alter table rhnActionPackageOrder enable row movement;
+alter table rhnActionPackageRemovalFailure enable row movement;
+alter table rhnActionScript enable row movement;
+alter table rhnActionStatus enable row movement;
+alter table rhnActionTransactions enable row movement;
+alter table rhnActionType enable row movement;
+alter table rhnActionVirtDestroy enable row movement;
+alter table rhnActionVirtReboot enable row movement;
+alter table rhnActionVirtRefresh enable row movement;
+alter table rhnActionVirtResume enable row movement;
+alter table rhnActionVirtSchedulePoller enable row movement;
+alter table rhnActionVirtSetMemory enable row movement;
+alter table rhnActionVirtShutdown enable row movement;
+alter table rhnActionVirtStart enable row movement;
+alter table rhnActionVirtSuspend enable row movement;
+alter table rhnActionVirtVcpu enable row movement;
+alter table rhnActivationKey enable row movement;
+alter table rhnAppInstallInstance enable row movement;
+alter table rhnAppInstallSession enable row movement;
+alter table rhnAppInstallSessionData enable row movement;
+alter table rhnArchType enable row movement;
+alter table rhnArchTypeActions enable row movement;
+alter table rhnBeehivePathMap enable row movement;
+alter table rhnBlacklistObsoletes enable row movement;
+alter table rhnCVE enable row movement;
+alter table rhnChannel enable row movement;
+alter table rhnChannelArch enable row movement;
+alter table rhnChannelCloned enable row movement;
+alter table rhnChannelComps enable row movement;
+alter table rhnChannelDownloads enable row movement;
+alter table rhnChannelErrata enable row movement;
+alter table rhnChannelFamily enable row movement;
+alter table rhnChannelFamilyLicense enable row movement;
+alter table rhnChannelFamilyLicenseConsent enable row movement;
+alter table rhnChannelFamilyMembers enable row movement;
+alter table rhnChannelFamilyVirtSubLevel enable row movement;
+alter table rhnChannelNewestPackage enable row movement;
+alter table rhnChannelNewestPackageAudit enable row movement;
+alter table rhnChannelPackage enable row movement;
+alter table rhnChannelPackageArchCompat enable row movement;
+alter table rhnChannelParent enable row movement;
+alter table rhnChannelPermission enable row movement;
+alter table rhnChannelPermissionRole enable row movement;
+alter table rhnChannelProduct enable row movement;
+alter table rhnClientCapability enable row movement;
+alter table rhnClientCapabilityName enable row movement;
+alter table rhnConfigChannel enable row movement;
+alter table rhnConfigChannelType enable row movement;
+alter table rhnConfigContent enable row movement;
+alter table rhnConfigFile enable row movement;
+alter table rhnConfigFileFailure enable row movement;
+alter table rhnConfigFileName enable row movement;
+alter table rhnConfigFileState enable row movement;
+alter table rhnConfigFileType enable row movement;
+alter table rhnConfigInfo enable row movement;
+alter table rhnConfigRevision enable row movement;
+alter table rhnCpu enable row movement;
+alter table rhnCpuArch enable row movement;
+alter table rhnCryptoKey enable row movement;
+alter table rhnCryptoKeyKickstart enable row movement;
+alter table rhnCryptoKeyType enable row movement;
+alter table rhnCustomDataKey enable row movement;
+alter table rhnDaemonState enable row movement;
+alter table rhnDailySummaryQueue enable row movement;
+alter table rhnDevice enable row movement;
+alter table rhnDistChannelMap enable row movement;
+alter table rhnDownloadType enable row movement;
+alter table rhnDownloads enable row movement;
+alter table rhnEmailAddress enable row movement;
+alter table rhnEmailAddressLog enable row movement;
+alter table rhnEmailAddressState enable row movement;
+alter table rhnEntitlementLog enable row movement;
+alter table rhnErrata enable row movement;
+alter table rhnErrataBuglist enable row movement;
+alter table rhnErrataBuglistTmp enable row movement;
+alter table rhnErrataCVE enable row movement;
+alter table rhnErrataCloned enable row movement;
+alter table rhnErrataClonedTmp enable row movement;
+alter table rhnErrataFile enable row movement;
+alter table rhnErrataFileChannel enable row movement;
+alter table rhnErrataFileChannelTmp enable row movement;
+alter table rhnErrataFilePackage enable row movement;
+alter table rhnErrataFilePackageSource enable row movement;
+alter table rhnErrataFilePackageTmp enable row movement;
+alter table rhnErrataFileTmp enable row movement;
+alter table rhnErrataFileType enable row movement;
+alter table rhnErrataKeyword enable row movement;
+alter table rhnErrataKeywordTmp enable row movement;
+alter table rhnErrataNotificationQueue enable row movement;
+alter table rhnErrataPackage enable row movement;
+alter table rhnErrataPackageTmp enable row movement;
+alter table rhnErrataQueue enable row movement;
+alter table rhnErrataSeverity enable row movement;
+alter table rhnErrataTmp enable row movement;
+alter table rhnException enable row movement;
+alter table rhnFAQ enable row movement;
+alter table rhnFAQClass enable row movement;
+alter table rhnFeature enable row movement;
+alter table rhnFile enable row movement;
+alter table rhnFileDownload enable row movement;
+alter table rhnFileList enable row movement;
+alter table rhnFileListMembers enable row movement;
+alter table rhnFileLocation enable row movement;
+alter table rhnGrailComponentChoices enable row movement;
+alter table rhnGrailComponents enable row movement;
+alter table rhnIndexerWork enable row movement;
+alter table rhnInfoPane enable row movement;
+alter table rhnKSData enable row movement;
+alter table rhnKSInstallType enable row movement;
+alter table rhnKSTreeFile enable row movement;
+alter table rhnKSTreeType enable row movement;
+alter table rhnKickstartChildChannel enable row movement;
+alter table rhnKickstartCommand enable row movement;
+alter table rhnKickstartCommandName enable row movement;
+alter table rhnKickstartDefaultRegToken enable row movement;
+alter table rhnKickstartDefaults enable row movement;
+alter table rhnKickstartIPRange enable row movement;
+alter table rhnKickstartPackage enable row movement;
+alter table rhnKickstartPreserveFileList enable row movement;
+alter table rhnKickstartScript enable row movement;
+alter table rhnKickstartSession enable row movement;
+alter table rhnKickstartSessionHistory enable row movement;
+alter table rhnKickstartSessionState enable row movement;
+alter table rhnKickstartTimezone enable row movement;
+alter table rhnKickstartVirtualizationType enable row movement;
+alter table rhnKickstartableTree enable row movement;
+alter table rhnMessage enable row movement;
+alter table rhnMessagePriority enable row movement;
+alter table rhnMessageType enable row movement;
+alter table rhnMonitor enable row movement;
+alter table rhnMonitorGranularity enable row movement;
+alter table rhnOrgChannelSettings enable row movement;
+alter table rhnOrgChannelSettingsType enable row movement;
+alter table rhnOrgEntitlementType enable row movement;
+alter table rhnOrgEntitlements enable row movement;
+alter table rhnOrgErrataCacheQueue enable row movement;
+alter table rhnOrgInfo enable row movement;
+alter table rhnOrgQuota enable row movement;
+alter table rhnPackage enable row movement;
+alter table rhnPackageArch enable row movement;
+alter table rhnPackageCapability enable row movement;
+alter table rhnPackageChangeLog enable row movement;
+alter table rhnPackageConflicts enable row movement;
+alter table rhnPackageDelta enable row movement;
+alter table rhnPackageDeltaElement enable row movement;
+alter table rhnPackageEVR enable row movement;
+alter table rhnPackageFile enable row movement;
+alter table rhnPackageFileDeleteQueue enable row movement;
+alter table rhnPackageGroup enable row movement;
+alter table rhnPackageNEVRA enable row movement;
+alter table rhnPackageName enable row movement;
+alter table rhnPackageObsoletes enable row movement;
+alter table rhnPackageProvides enable row movement;
+alter table rhnPackageRequires enable row movement;
+alter table rhnPackageSense enable row movement;
+alter table rhnPackageSenseMap enable row movement;
+alter table rhnPackageSource enable row movement;
+alter table rhnPackageSyncBlacklist enable row movement;
+alter table rhnPathChannelMap enable row movement;
+alter table rhnPrivateChannelFamily enable row movement;
+alter table rhnProduct enable row movement;
+alter table rhnProductChannel enable row movement;
+alter table rhnProductLine enable row movement;
+alter table rhnProductName enable row movement;
+alter table rhnProvisionState enable row movement;
+alter table rhnProxyInfo enable row movement;
+alter table rhnPublicChannelFamily enable row movement;
+alter table rhnPushClient enable row movement;
+alter table rhnPushClientState enable row movement;
+alter table rhnPushDispatcher enable row movement;
+alter table rhnRam enable row movement;
+alter table rhnRedHatCanonVersion enable row movement;
+alter table rhnRegToken enable row movement;
+alter table rhnRegTokenChannels enable row movement;
+alter table rhnRegTokenConfigChannels enable row movement;
+alter table rhnRegTokenEntitlement enable row movement;
+alter table rhnRegTokenGroups enable row movement;
+alter table rhnRegTokenOrgDefault enable row movement;
+alter table rhnRegTokenPackages enable row movement;
+alter table rhnRelationshipType enable row movement;
+alter table rhnReleaseChannelMap enable row movement;
+alter table rhnSGTypeBaseAddonCompat enable row movement;
+alter table rhnSGTypeVirtSubLevel enable row movement;
+alter table rhnSNPErrataQueue enable row movement;
+alter table rhnSNPServerQueue enable row movement;
+alter table rhnSatelliteCert enable row movement;
+alter table rhnSatelliteChannelFamily enable row movement;
+alter table rhnSatelliteInfo enable row movement;
+alter table rhnSatelliteServerGroup enable row movement;
+alter table rhnSavedSearch enable row movement;
+alter table rhnSavedSearchType enable row movement;
+alter table rhnServer enable row movement;
+alter table rhnServerAction enable row movement;
+alter table rhnServerActionPackageResult enable row movement;
+alter table rhnServerActionScriptResult enable row movement;
+alter table rhnServerActionVerifyMissing enable row movement;
+alter table rhnServerActionVerifyResult enable row movement;
+alter table rhnServerArch enable row movement;
+alter table rhnServerCacheInfo enable row movement;
+alter table rhnServerChannel enable row movement;
+alter table rhnServerChannelArchCompat enable row movement;
+alter table rhnServerConfigChannel enable row movement;
+alter table rhnServerCustomDataValue enable row movement;
+alter table rhnServerDMI enable row movement;
+alter table rhnServerEvent enable row movement;
+alter table rhnServerGroup enable row movement;
+alter table rhnServerGroupMembers enable row movement;
+alter table rhnServerGroupNotes enable row movement;
+alter table rhnServerGroupType enable row movement;
+alter table rhnServerGroupTypeFeature enable row movement;
+alter table rhnServerHistory enable row movement;
+alter table rhnServerInfo enable row movement;
+alter table rhnServerInstallInfo enable row movement;
+alter table rhnServerLocation enable row movement;
+alter table rhnServerLock enable row movement;
+alter table rhnServerMessage enable row movement;
+alter table rhnServerNeededErrataCache enable row movement;
+alter table rhnServerNeededPackageCache enable row movement;
+alter table rhnServerNetInterface enable row movement;
+alter table rhnServerNetwork enable row movement;
+alter table rhnServerNotes enable row movement;
+alter table rhnServerPackage enable row movement;
+alter table rhnServerPackageArchCompat enable row movement;
+alter table rhnServerPath enable row movement;
+alter table rhnServerPreserveFileList enable row movement;
+alter table rhnServerProfile enable row movement;
+alter table rhnServerProfilePackage enable row movement;
+alter table rhnServerProfileType enable row movement;
+alter table rhnServerServerGroupArchCompat enable row movement;
+alter table rhnServerTokenRegs enable row movement;
+alter table rhnServerUuid enable row movement;
+alter table rhnSet enable row movement;
+alter table rhnSnapshot enable row movement;
+alter table rhnSnapshotChannel enable row movement;
+alter table rhnSnapshotConfigChannel enable row movement;
+alter table rhnSnapshotConfigRevision enable row movement;
+alter table rhnSnapshotInvalidReason enable row movement;
+alter table rhnSnapshotPackage enable row movement;
+alter table rhnSnapshotServerGroup enable row movement;
+alter table rhnSnapshotTag enable row movement;
+alter table rhnSolarisPackage enable row movement;
+alter table rhnSolarisPatch enable row movement;
+alter table rhnSolarisPatchPackages enable row movement;
+alter table rhnSolarisPatchSet enable row movement;
+alter table rhnSolarisPatchSetMembers enable row movement;
+alter table rhnSolarisPatchType enable row movement;
+alter table rhnSolarisPatchedPackage enable row movement;
+alter table rhnSourceRPM enable row movement;
+alter table rhnTag enable row movement;
+alter table rhnTagName enable row movement;
+alter table rhnTaskQueue enable row movement;
+alter table rhnTemplateCategory enable row movement;
+alter table rhnTemplateString enable row movement;
+alter table rhnTextMessage enable row movement;
+alter table rhnTimezone enable row movement;
+alter table rhnTinyURL enable row movement;
+alter table rhnTransaction enable row movement;
+alter table rhnTransactionElement enable row movement;
+alter table rhnTransactionOperation enable row movement;
+alter table rhnTransactionPackage enable row movement;
+alter table rhnUserDefaultSystemGroups enable row movement;
+alter table rhnUserGroup enable row movement;
+alter table rhnUserGroupMembers enable row movement;
+alter table rhnUserGroupType enable row movement;
+alter table rhnUserInfo enable row movement;
+alter table rhnUserInfoPane enable row movement;
+alter table rhnUserMessage enable row movement;
+alter table rhnUserMessageStatus enable row movement;
+alter table rhnUserMessageType enable row movement;
+alter table rhnUserReserved enable row movement;
+alter table rhnUserServerGroupPerms enable row movement;
+alter table rhnUserServerPerms enable row movement;
+alter table rhnUserServerPrefs enable row movement;
+alter table rhnVersionInfo enable row movement;
+alter table rhnVirtSubLevel enable row movement;
+alter table rhnVirtualInstance enable row movement;
+alter table rhnVirtualInstanceEventLog enable row movement;
+alter table rhnVirtualInstanceEventType enable row movement;
+alter table rhnVirtualInstanceInfo enable row movement;
+alter table rhnVirtualInstanceInstallLog enable row movement;
+alter table rhnVirtualInstanceState enable row movement;
+alter table rhnVirtualInstanceType enable row movement;
+alter table rhnVisibleObjects enable row movement;
+alter table rhnWebContactChangeLog enable row movement;
+alter table rhnWebContactChangeState enable row movement;
+alter table rhn_check_probe enable row movement;
+alter table rhn_check_suite_probe enable row movement;
+alter table rhn_check_suites enable row movement;
+alter table rhn_command enable row movement;
+alter table rhn_command_center_state enable row movement;
+alter table rhn_command_class enable row movement;
+alter table rhn_command_groups enable row movement;
+alter table rhn_command_param_threshold enable row movement;
+alter table rhn_command_parameter enable row movement;
+alter table rhn_command_queue_commands enable row movement;
+alter table rhn_command_queue_execs enable row movement;
+alter table rhn_command_queue_execs_bk enable row movement;
+alter table rhn_command_queue_instances enable row movement;
+alter table rhn_command_queue_instances_bk enable row movement;
+alter table rhn_command_queue_params enable row movement;
+alter table rhn_command_queue_sessions enable row movement;
+alter table rhn_command_requirements enable row movement;
+alter table rhn_command_target enable row movement;
+alter table rhn_config_group enable row movement;
+alter table rhn_config_macro enable row movement;
+alter table rhn_config_parameter enable row movement;
+alter table rhn_config_security_type enable row movement;
+alter table rhn_contact_group_members enable row movement;
+alter table rhn_contact_groups enable row movement;
+alter table rhn_contact_methods enable row movement;
+alter table rhn_current_alerts enable row movement;
+alter table rhn_current_state_summaries enable row movement;
+alter table rhn_db_environment enable row movement;
+alter table rhn_deployed_probe enable row movement;
+alter table rhn_environment enable row movement;
+alter table rhn_host_check_suites enable row movement;
+alter table rhn_host_probe enable row movement;
+alter table rhn_interface_monitoring enable row movement;
+alter table rhn_ll_netsaint enable row movement;
+alter table rhn_method_types enable row movement;
+alter table rhn_metrics enable row movement;
+alter table rhn_multi_scout_threshold enable row movement;
+alter table rhn_notification_formats enable row movement;
+alter table rhn_notifservers enable row movement;
+alter table rhn_os enable row movement;
+alter table rhn_os_commands_xref enable row movement;
+alter table rhn_pager_types enable row movement;
+alter table rhn_physical_location enable row movement;
+alter table rhn_probe enable row movement;
+alter table rhn_probe_param_value enable row movement;
+alter table rhn_probe_state enable row movement;
+alter table rhn_probe_types enable row movement;
+alter table rhn_quanta enable row movement;
+alter table rhn_redirect_criteria enable row movement;
+alter table rhn_redirect_email_targets enable row movement;
+alter table rhn_redirect_group_targets enable row movement;
+alter table rhn_redirect_match_types enable row movement;
+alter table rhn_redirect_method_targets enable row movement;
+alter table rhn_redirect_types enable row movement;
+alter table rhn_redirects enable row movement;
+alter table rhn_sat_cluster enable row movement;
+alter table rhn_sat_cluster_probe enable row movement;
+alter table rhn_sat_node enable row movement;
+alter table rhn_sat_node_probe enable row movement;
+alter table rhn_satellite_state enable row movement;
+alter table rhn_schedule_days enable row movement;
+alter table rhn_schedule_days_norm enable row movement;
+alter table rhn_schedule_types enable row movement;
+alter table rhn_schedule_weeks enable row movement;
+alter table rhn_schedules enable row movement;
+alter table rhn_semantic_data_type enable row movement;
+alter table rhn_server_monitoring_info enable row movement;
+alter table rhn_service_probe_origins enable row movement;
+alter table rhn_snmp_alert enable row movement;
+alter table rhn_strategies enable row movement;
+alter table rhn_threshold_type enable row movement;
+alter table rhn_time_zone_names enable row movement;
+alter table rhn_units enable row movement;
+alter table rhn_url_probe enable row movement;
+alter table rhn_url_probe_step enable row movement;
+alter table rhn_widget enable row movement;
+alter table state_change enable row movement;
+alter table time_series enable row movement;
+alter table valid_countries enable row movement;
+alter table web_contact enable row movement;
+alter table web_customer enable row movement;
+alter table web_customer_notification enable row movement;
+alter table web_user_contact_permission enable row movement;
+alter table web_user_personal_info enable row movement;
+alter table web_user_prefix enable row movement;
+alter table web_user_site_info enable row movement;
+alter table web_user_site_type enable row movement;
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/091-rhn_command_parameter_data-user.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/091-rhn_command_parameter_data-user.sql
new file mode 100644
index 0000000..af72996
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/091-rhn_command_parameter_data-user.sql
@@ -0,0 +1,5 @@
+
+update rhn_command_parameter
+set last_update_user = 'system'
+where last_update_user = 'nhansen';
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/092-rhn_command_parameter_data-sshbannerignore.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/092-rhn_command_parameter_data-sshbannerignore.sql
new file mode 100644
index 0000000..b7218fb
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/092-rhn_command_parameter_data-sshbannerignore.sql
@@ -0,0 +1,127 @@
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (25, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (26, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (27, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (28, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 45, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (29, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (30, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (31, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (99, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (105, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 140, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (106, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 55, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (107, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 65, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (109, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (117, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (118, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 37, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (123, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (226, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (228, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (230, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (249, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 37, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (274, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
+
+insert into command_parameter(command_id, param_name, param_type,
+data_type_name, description, mandatory, default_value, min_value, max_value,
+field_order, field_widget_name, field_visible_length, field_maximum_length,
+field_visible, default_value_visible, last_update_user, last_update_date)
+ values (304, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 27, 'text', 8, 20, 1, 1, 'system', sysdate);
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/093-rhnChannelCloned_triggers.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/093-rhnChannelCloned_triggers.sql
new file mode 100644
index 0000000..d809082
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/093-rhnChannelCloned_triggers.sql
@@ -0,0 +1,41 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace trigger
+rhn_channel_cloned_comps_trig
+before insert on rhnChannelCloned
+for each row
+begin
+ -- if there are not comps in the cloned channel by now,
+ -- we shall clone comps from the original channel
+ insert into rhnChannelComps
+ ( id, channel_id, relative_filename,
+ last_modified, created, modified )
+ select rhn_channelcomps_id_seq.nextval, :new.id, relative_filename,
+ sysdate, sysdate, sysdate
+ from rhnChannelComps
+ where channel_id = :new.original_id
+ and not exists (
+ select 1
+ from rhnChannelComps x
+ where x.channel_id = :new.id
+ );
+end;
+/
+show errors
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql
new file mode 100644
index 0000000..77d255e
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql
@@ -0,0 +1,12 @@
+
+create or replace trigger
+rhn_package_changelog_id_trig
+before insert on rhnPackageChangelog
+for each row
+when (new.id is null)
+begin
+ select rhn_pkg_cl_id_seq.nextval into :new.id from dual;
+end;
+/
+show errors
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/103-rhnKSData.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/103-rhnKSData.sql
new file mode 100644
index 0000000..f4ea766
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/103-rhnKSData.sql
@@ -0,0 +1,7 @@
+
+alter table rhnKSData
+add preLog char(1) default('N')
+ constraint rhn_ks_pre_log_nn not null
+ constraint rhn_ks_pre_log_ck
+ check (preLog in ('Y','N'));
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/104-rhnKSData.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/104-rhnKSData.sql
new file mode 100644
index 0000000..b676d7c
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/104-rhnKSData.sql
@@ -0,0 +1,7 @@
+
+alter table rhnKSData
+add kscfg char(1) default('N')
+ constraint rhn_ks_cfg_save_nn not null
+ constraint rhn_ks_cfg_save_ck
+ check (kscfg in ('Y','N'));
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/105-rhnKSData.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/105-rhnKSData.sql
new file mode 100644
index 0000000..2e4a388
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/105-rhnKSData.sql
@@ -0,0 +1,13 @@
+
+alter table rhnKSData
+add verboseup2date char(1) default('N')
+ constraint rhn_ks_verbose_up2date_nn not null
+ constraint rhn_ks_verbose_up2date_ck
+ check (verboseup2date in ('Y','N'));
+
+alter table rhnKSData
+add nonchrootpost char(1) default('N')
+ constraint rhn_ks_nonchroot_post_nn not null
+ constraint rhn_ks_nonchroot_post_ck
+ check (nonchrootpost in ('Y','N'));
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/200-rhn_cache.pks.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/200-rhn_cache.pks.sql
new file mode 100644
index 0000000..e791ed8
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/200-rhn_cache.pks.sql
@@ -0,0 +1,45 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace package
+rhn_cache
+is
+ version varchar2(100) := '$Id$';
+
+ -- this searches out all users who get perms...
+ procedure update_perms_for_server(
+ server_id_in in number
+ );
+
+ procedure update_perms_for_user(
+ user_id_in in number
+ );
+
+ procedure update_perms_for_server_group(
+ server_group_id_in in number
+ );
+end rhn_cache;
+/
+show errors
+
+--
+-- $Log$
+-- Revision 1.1 2004/07/02 19:14:32 pjones
+-- 125937 -- tools to manipulate rhnUserServerPerms when appropriate.
+--
+
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/201-rhn_cache.pkb.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/201-rhn_cache.pkb.sql
new file mode 100644
index 0000000..7de0b6c
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/201-rhn_cache.pkb.sql
@@ -0,0 +1,92 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace package body
+rhn_cache
+is
+ body_version varchar2(100) := '$Id$';
+
+ -- this searches out all users who get perms...
+ procedure update_perms_for_server(
+ server_id_in in number
+ ) is
+ begin
+ delete from rhnUserServerPerms where server_id = server_id_in;
+ insert into rhnUserServerPerms(user_id, server_id) (
+ select distinct user_id, server_id_in
+ from rhnUserServerPermsDupes
+ where server_id = server_id_in
+ );
+ end update_perms_for_server;
+
+ procedure update_perms_for_user(
+ user_id_in in number
+ ) is
+ begin
+ delete from rhnUserServerPerms
+ where user_id = user_id_in
+ and server_id in
+ (select server_id
+ from rhnUserServerPerms
+ where user_id = user_id_in
+ minus
+ select server_id
+ from rhnUserServerPermsDupes uspd
+ where uspd.user_id = user_id_in);
+
+ insert into rhnUserServerPerms (user_id, server_id)
+ select distinct user_id_in, server_id
+ from rhnUserServerPermsDupes uspd
+ where uspd.user_id = user_id_in
+ and not exists
+ (select 1
+ from rhnUserServerPerms usp
+ where usp.user_id = user_id_in
+ and usp.server_id = uspd.server_id);
+ end update_perms_for_user;
+
+ -- this means a server got added or removed, so we
+ -- can't key off of a server anywhere.
+ procedure update_perms_for_server_group(
+ server_group_id_in in number
+ ) is
+ cursor users is
+ -- org admins aren't affected, so don't test for them
+ select usgp.user_id id
+ from rhnUserServerGroupPerms usgp
+ where usgp.server_group_id = server_group_id_in
+ and not exists (
+ select 1
+ from rhnUserGroup ug,
+ rhnUserGroupMembers ugm,
+ rhnServerGroup sg,
+ rhnUserGroupType ugt
+ where ugt.label = 'org_admin'
+ and sg.id = server_group_id_in
+ and ugm.user_id = usgp.user_id
+ and ug.org_id = sg.org_id
+ and ugm.user_group_id = ug.id
+ );
+ begin
+ for u in users loop
+ update_perms_for_user(u.id);
+ end loop;
+ end update_perms_for_server_group;
+end rhn_cache;
+/
+show errors
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/202-rhn_channel.pks.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/202-rhn_channel.pks.sql
new file mode 100644
index 0000000..85826af
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/202-rhn_channel.pks.sql
@@ -0,0 +1,246 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE rhn_channel
+IS
+ version varchar2(100) := '$Id$';
+
+ CURSOR server_base_subscriptions(server_id_in NUMBER) IS
+ SELECT C.id
+ FROM rhnChannel C, rhnServerChannel SC
+ WHERE C.id = SC.channel_id
+ AND SC.server_id = server_id_in
+ AND C.parent_channel IS NULL;
+
+ CURSOR check_server_subscription(server_id_in NUMBER, channel_id_in NUMBER) IS
+ SELECT channel_id
+ FROM rhnServerChannel
+ WHERE server_id = server_id_in
+ AND channel_id = channel_id_in;
+
+ CURSOR check_server_parent_membership(server_id_in NUMBER, channel_id_in NUMBER) IS
+ SELECT C.id
+ FROM rhnChannel C, rhnServerChannel SC
+ WHERE C.parent_channel = channel_id_in
+ AND C.id = SC.channel_id
+ AND SC.server_id = server_id_in;
+
+ CURSOR channel_family_perm_cursor(channel_family_id_in NUMBER, org_id_in NUMBER) IS
+ SELECT *
+ FROM rhnOrgChannelFamilyPermissions
+ WHERE channel_family_id = channel_family_id_in
+ AND org_id = org_id_in;
+
+ PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER);
+ FUNCTION get_license_path(channel_id_in IN NUMBER) RETURN VARCHAR2;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server in number := 0 );
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in number := null);
+
+ function can_server_consume_virt_channl(
+ server_id_in IN NUMBER,
+ family_id_in in number)
+ return number;
+
+ FUNCTION guess_server_base(server_id_in IN NUMBER) RETURN NUMBER;
+
+ FUNCTION base_channel_for_release_arch(release_in in varchar2,
+ server_arch_in in varchar2, org_id_in in number := -1,
+ user_id_in in number := null) RETURN number;
+
+ FUNCTION base_channel_rel_archid(release_in in varchar2,
+ server_arch_id_in in number, org_id_in in number := -1,
+ user_id_in in number := null) RETURN number;
+
+ FUNCTION channel_priority(channel_id_in in number) RETURN number;
+
+ PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+ PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+
+ PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+ procedure bulk_server_basechange_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ old_channel_id_in in number,
+ new_channel_id_in in number);
+
+ procedure bulk_guess_server_base(
+ set_label_in in varchar2,
+ set_uid_in in number);
+
+ procedure bulk_guess_server_base_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ channel_id_in in number);
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server in number := 0 );
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
+
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number;
+
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER, org_id_in IN NUMBER);
+ FUNCTION family_for_channel(channel_id_in IN NUMBER) RETURN NUMBER;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
+
+ procedure entitle_customer(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
+ procedure set_family_maxmembers(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
+ procedure unsubscribe_server_from_family(server_id_in in number, channel_family_id_in in number);
+
+ procedure delete_server_channels(server_id_in in number);
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)');
+
+ function get_org_id(channel_id_in in number) return number;
+ PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
+
+ function get_org_access(channel_id_in in number, org_id_in in number) return number;
+ PRAGMA RESTRICT_REFERENCES(get_org_access, WNDS, RNPS, WNPS);
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number) return number;
+
+ function user_role_check_debug(channel_id_in in number, user_id_in in number, role_in in varchar2, reason_out out varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(user_role_check_debug, WNDS, RNPS, WNPS);
+
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(user_role_check, WNDS, RNPS, WNPS);
+
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(loose_user_role_check, WNDS, RNPS, WNPS);
+
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(direct_user_role_check, WNDS, RNPS, WNPS);
+
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ RETURN NUMBER;
+
+ PROCEDURE update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate );
+
+ PROCEDURE update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate );
+
+ PROCEDURE update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate );
+
+
+ PRAGMA RESTRICT_REFERENCES(org_channel_setting, WNDS, RNPS, WNPS);
+
+END rhn_channel;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.37 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.36 2004/03/26 18:11:32 rbb
+-- Bugzilla: 114057
+--
+-- Add a script to determine channel priority.
+--
+-- Revision 1.35 2004/02/17 20:16:52 pjones
+-- bugzilla: none -- add cvs tags into the package as long as we're touching
+-- it anyway
+--
+-- Revision 1.34 2003/11/13 18:13:09 cturner
+-- pragmas can now return now that rhn_user pragmas are fixed
+--
+-- Revision 1.32 2003/09/22 21:00:40 cturner
+-- add method for easy acl check
+--
+-- Revision 1.31 2003/09/17 22:14:11 misa
+-- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
+--
+-- Revision 1.30 2003/07/24 16:44:16 misa
+-- bugzilla: none A function more usable on the rhnapp side
+--
+-- Revision 1.29 2003/07/24 14:00:17 misa
+-- bugzilla: none PRAGMA RESTRICT_REFERENCES good
+--
+-- Revision 1.28 2003/07/23 21:59:19 cturner
+-- rework how rhnUserChannel works; move to plsql for speed and maintenance
+--
+-- Revision 1.27 2003/07/21 17:49:12 pjones
+-- bugzilla: none
+--
+-- add optional user for subscribe_server
+--
+-- Revision 1.26 2002/12/19 18:13:42 misa
+-- Added caller with a default value
+--
+-- Revision 1.25 2002/12/11 22:18:46 pjones
+-- rhnChannelNewestPackage
+--
+-- Revision 1.24 2002/11/21 22:08:11 pjones
+-- make unsubscribe_channels have a "unsubscribe_children_in number := 0"
+-- argument so that you can tell it to unsubscribe children.
+--
+-- Also, make it raise an exception instead of silent failure in the
+-- other case.
+--
+-- Revision 1.23 2002/11/18 17:20:50 pjones
+-- this should have gone back too
+--
+-- Revision 1.22 2002/11/13 23:16:18 pjones
+-- lookup_*_arch()
+--
+-- Revision 1.21 2002/10/07 20:01:59 rnorwood
+-- guess base channel for ssm and single system
+--
+-- Revision 1.20 2002/10/02 19:21:03 bretm
+-- o 3rd party channel schema changes, no more clobs...
+--
+-- Revision 1.19 2002/09/20 19:21:58 bretm
+-- o more 3rd party channel stuff...
+--
+-- Revision 1.18 2002/06/12 22:33:03 pjones
+-- procedure bulk_guess_server_base_from(
+-- set_label_in in varchar2,
+-- set_uid_in in number,
+-- channel_id_in in number);
+--
+-- for bretm
+--
+-- Revision 1.17 2002/06/12 22:12:25 pjones
+-- procedure bulk_guess_server_base(
+-- set_label_in in varchar2,
+-- set_uid_in in number);
+--
+-- for bretm
+--
+-- Revision 1.16 2002/06/12 19:37:55 pjones
+-- bulk_server_basechange_from(
+-- set_label_in in varchar2,
+-- set_uid_in in number,
+-- old_channel_id_in in number,
+-- new_channel_id_in in number
+-- );
+--
+-- for bretm
+--
+-- Revision 1.15 2002/05/10 22:08:22 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/203-rhn_channel.pkb.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/203-rhn_channel.pkb.sql
new file mode 100644
index 0000000..f10baea
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/203-rhn_channel.pkb.sql
@@ -0,0 +1,1368 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_channel
+IS
+ body_version varchar2(100) := '$Id$';
+
+ -- Cursor that fetches all the possible base channels for a
+ -- (server_arch_id, release, org_id) combination
+ cursor base_channel_cursor(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number
+ ) return rhnChannel%ROWTYPE is
+ select distinct c.*
+ from rhnDistChannelMap dcm,
+ rhnServerChannelArchCompat scac,
+ rhnChannel c,
+ rhnChannelPermissions cp
+ where cp.org_id = org_id_in
+ and cp.channel_id = c.id
+ and c.parent_channel is null
+ and c.id = dcm.channel_id
+ and c.channel_arch_id = dcm.channel_arch_id
+ and dcm.release = release_in
+ and scac.server_arch_id = server_arch_id_in
+ and scac.channel_arch_id = c.channel_arch_id;
+
+ FUNCTION get_license_path(channel_id_in IN NUMBER)
+ RETURN VARCHAR2
+ IS
+ license_val VARCHAR2(1000);
+ BEGIN
+ SELECT CFL.license_path INTO license_val
+ FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
+ WHERE CFM.channel_id = channel_id_in
+ AND CFM.channel_family_id = CFL.channel_family_id;
+
+ RETURN license_val;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END get_license_path;
+
+
+ PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_consent_no_license');
+ END IF;
+
+ INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
+ VALUES (channel_family_id_val, user_id_in, server_id_in);
+ END license_consent;
+
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
+ IS
+ channel_parent_val rhnChannel.parent_channel%TYPE;
+ parent_subscribed BOOLEAN;
+ server_has_base_chan BOOLEAN;
+ server_already_in_chan BOOLEAN;
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ consenting_user NUMBER;
+ allowed number := 0;
+ current_members_val number;
+ BEGIN
+ if user_id_in is not null then
+ allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
+ else
+ allowed := 1;
+ end if;
+
+ if allowed = 0 then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+
+
+ SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
+
+ IF channel_parent_val IS NOT NULL
+ THEN
+ -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
+ parent_subscribed := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
+ LOOP
+ parent_subscribed := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT parent_subscribed
+ THEN
+ RETURN;
+ END IF;
+ ELSE
+ -- base channel
+ server_has_base_chan := FALSE;
+ FOR base IN server_base_subscriptions(server_id_in)
+ LOOP
+ server_has_base_chan := TRUE;
+ END LOOP base;
+
+ IF server_has_base_chan
+ THEN
+ rhn_exception.raise_exception('channel_server_one_base');
+ END IF;
+ END IF;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ select current_members
+ into current_members_val
+ from rhnPrivateChannelFamily
+ where org_id = server_org_id_val and channel_family_id = channel_family_id_val
+ for update of current_members;
+
+ available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
+
+ IF available_subscriptions IS NULL OR
+ available_subscriptions > 0 or
+ can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
+ THEN
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
+ THEN
+ BEGIN
+
+ SELECT user_id INTO consenting_user
+ FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_consent');
+ END;
+ END IF;
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ queue_server(server_id_in, immediate_in);
+ ELSE
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ END IF;
+
+ END subscribe_server;
+
+ function can_server_consume_virt_channl(
+ server_id_in in number,
+ family_id_in in number )
+ return number
+ is
+
+ cursor server_virt_families is
+ select vi.virtual_system_id, cfvsl.channel_family_id
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnVirtualInstance vi
+ where
+ vi.virtual_system_id = server_id_in
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ and cfvsl.channel_family_id = family_id_in
+ and exists (
+ select 1
+ from rhnServerEntitlementView sev
+ where vi.host_system_id = sev.server_id
+ and sev.server_group_type_id = sgtvsl.server_group_type_id );
+ begin
+
+ for server_virt_family in server_virt_families loop
+ return 1;
+ end loop;
+
+ return 0;
+
+ end;
+
+
+ PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END LOOP server;
+ END bulk_subscribe_server;
+
+ PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ IF rhn_server.can_change_base_channel(server.element) = 1
+ THEN
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END IF;
+ END LOOP server;
+ END bulk_server_base_change;
+
+ procedure bulk_server_basechange_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ old_channel_id_in in number,
+ new_channel_id_in in number
+ ) is
+ cursor servers is
+ select sc.server_id id
+ from rhnChannel nc,
+ rhnServerChannelArchCompat scac,
+ rhnServer s,
+ rhnChannel oc,
+ rhnServerChannel sc,
+ rhnSet st
+ where 1=1
+ -- first, find the servers we're looking for.
+ and st.label = set_label_in
+ and st.user_id = set_uid_in
+ and st.element = sc.server_id
+ -- now, filter out anything that's not in the
+ -- old base channel.
+ and sc.channel_id = old_channel_id_in
+ and sc.channel_id = oc.id
+ and oc.parent_channel is null
+ -- now, see if it's compatible with the new base channel
+ and nc.id = new_channel_id_in
+ and nc.parent_channel is null
+ and sc.server_id = s.id
+ and s.server_arch_id = scac.server_arch_id
+ and scac.channel_arch_id = nc.channel_arch_id;
+ begin
+ for s in servers loop
+ insert into rhnSet (
+ user_id, label, element
+ ) values (
+ set_uid_in,
+ set_label_in || 'basechange',
+ s.id
+ );
+ end loop channel;
+ bulk_server_base_change(new_channel_id_in,
+ set_label_in || 'basechange',
+ set_uid_in);
+ delete from rhnSet
+ where label = set_label_in||'basechange'
+ and user_id = set_uid_in;
+ end bulk_server_basechange_from;
+
+ procedure bulk_guess_server_base(
+ set_label_in in varchar2,
+ set_uid_in in number
+ ) is
+ channel_id number;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ -- anything that doesn't work, we just ignore
+ begin
+ if rhn_server.can_change_base_channel(server.element) = 1
+ then
+ channel_id := guess_server_base(TO_NUMBER(server.element));
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
+ end if;
+ exception when others then
+ null;
+ end;
+ end loop server;
+ end;
+
+ function guess_server_base(
+ server_id_in in number
+ ) RETURN number is
+ cursor server_cursor is
+ select s.server_arch_id, s.release, s.org_id
+ from rhnServer s
+ where s.id = server_id_in;
+ begin
+ for s in server_cursor loop
+ for channel in base_channel_cursor(s.release,
+ s.server_arch_id, s.org_id)
+ loop
+ return channel.id;
+ end loop base_channel_cursor;
+ end loop server_cursor;
+ -- Server not found, or no base channel applies to it
+ return null;
+ end;
+
+ -- Private function
+ function normalize_server_arch(server_arch_in in varchar2)
+ return varchar2
+ deterministic
+ is
+ suffix VARCHAR2(128) := '-redhat-linux';
+ suffix_len NUMBER := length(suffix);
+ begin
+ if server_arch_in is NULL then
+ return NULL;
+ end if;
+ if instr(server_arch_in, '-') > 0
+ then
+ -- Suffix already present
+ return server_arch_in;
+ end if;
+ return server_arch_in || suffix;
+ end normalize_server_arch;
+
+ --
+ --
+ -- Raises:
+ -- server_arch_not_found
+ -- no_subscribe_permissions
+ function base_channel_for_release_arch(
+ release_in in varchar2,
+ server_arch_in in varchar2,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ server_arch varchar2(256) := normalize_server_arch(server_arch_in);
+ server_arch_id number;
+ begin
+ -- Look up the server arch
+ begin
+ select id
+ into server_arch_id
+ from rhnServerArch
+ where label = server_arch;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('server_arch_not_found');
+ end;
+ return base_channel_rel_archid(release_in, server_arch_id,
+ org_id_in, user_id_in);
+ end base_channel_for_release_arch;
+
+ function base_channel_rel_archid(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ denied_channel_id number := null;
+ valid_org_id number := org_id_in;
+ valid_user_id number := user_id_in;
+ channel_subscribable number;
+ begin
+ if org_id_in = -1 and user_id_in is not null then
+ -- Get the org id from the user id
+ begin
+ select org_id
+ into valid_org_id
+ from web_contact
+ where id = user_id_in;
+ exception
+ when no_data_found then
+ -- User doesn't exist
+ -- XXX Only list public stuff for now
+ valid_user_id := null;
+ valid_org_id := -1;
+ end;
+ end if;
+
+ for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
+ loop
+ -- This row is a possible match
+ if valid_user_id is null then
+ -- User ID not specified, so no user to channel permissions to
+ -- check
+ return c.id;
+ end if;
+
+ -- Check user to channel permissions
+ select loose_user_role_check(c.id, user_id_in, 'subscribe')
+ into channel_subscribable
+ from dual;
+
+ if channel_subscribable = 1 then
+ return c.id;
+ end if;
+
+ -- Base channel exists, but is not subscribable; keep trying
+ denied_channel_id := c.id;
+ end loop base_channel_fetch;
+
+ if denied_channel_id is not null then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+ -- No base channel applies
+ return NULL;
+ end base_channel_rel_archid;
+
+ procedure bulk_guess_server_base_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ channel_id_in in number
+ ) is
+ cursor channels(server_id_in in number) is
+ select rsc.channel_id
+ from rhnServerChannel rsc,
+ rhnChannel rc
+ where server_id_in = rsc.server_id
+ and rsc.channel_id = rc.id
+ and rc.parent_channel is null;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ for channel in channels(server.element)
+ loop
+ if channel.channel_id = channel_id_in
+ then
+ insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
+ end if;
+ end loop channel;
+ end loop server;
+ bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
+ delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
+ end;
+
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
+ IS
+ cursor server_channels(server_id_in in number) is
+ select s.org_id, sc.channel_id, cfm.channel_family_id
+ from rhnServer s,
+ rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where s.id = server_id_in
+ and s.id = sc.server_id
+ and sc.channel_id = cfm.channel_id;
+ BEGIN
+ for channel in server_channels(server_id_in)
+ loop
+ unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
+ rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
+ end loop channel;
+ END clear_subscriptions;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server IN NUMBER := 0 )
+ IS
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ server_already_in_chan BOOLEAN;
+ cursor channel_family_is_proxy(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-proxy';
+ cursor channel_family_is_satellite(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-satellite';
+ -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
+ -- with the package-level one, we get a "cursor already open", so we need a
+ -- copy on our call stack instead. GROAN.
+ cursor local_chk_server_parent_memb (
+ server_id_in number,
+ channel_id_in number ) is
+ select c.id
+ from rhnChannel c,
+ rhnServerChannel sc
+ where 1=1
+ and c.parent_channel = channel_id_in
+ and c.id = sc.channel_id
+ and sc.server_id = server_id_in;
+ BEGIN
+ FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
+ LOOP
+ if unsubscribe_children_in = 1 then
+ unsubscribe_server(server_id_in => server_id_in,
+ channel_id_in => child.id,
+ immediate_in => immediate_in,
+ unsubscribe_children_in => unsubscribe_children_in,
+ deleting_server => deleting_server);
+ else
+ rhn_exception.raise_exception('channel_unsubscribe_child_exists');
+ end if;
+ END LOOP child;
+
+ server_already_in_chan := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ if deleting_server = 0 then
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ end if;
+
+ DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
+
+ if deleting_server = 0 then
+ queue_server(server_id_in, immediate_in);
+ end if;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_unsubscribe_no_family');
+ END IF;
+
+ for ignore in channel_family_is_satellite(channel_family_id_val) loop
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ delete from rhnSatelliteChannelFamily where server_id = server_id_in;
+ end loop;
+
+ for ignore in channel_family_is_proxy(channel_family_id_val) loop
+ delete from rhnProxyInfo where server_id = server_id_in;
+ end loop;
+
+ DELETE FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ END unsubscribe_server;
+
+ PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
+ END LOOP server;
+ END bulk_unsubscribe_server;
+
+ FUNCTION family_for_channel(channel_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN channel_family_id_val;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END family_for_channel;
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ cfp channel_family_perm_cursor%ROWTYPE;
+ current_members_val NUMBER;
+ max_members_val NUMBER;
+ found NUMBER;
+ BEGIN
+ IF NOT channel_family_perm_cursor%ISOPEN
+ THEN
+ OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
+ END IF;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+
+ WHILE channel_family_perm_cursor%FOUND
+ LOOP
+ found := 1;
+
+ current_members_val := cfp.current_members;
+ max_members_val := cfp.max_members;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+ END LOOP;
+
+ IF channel_family_perm_cursor%ISOPEN
+ THEN
+ CLOSE channel_family_perm_cursor;
+ END IF;
+
+ -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
+ -- either way, there are no available subscriptions
+
+ IF found IS NULL
+ THEN
+ RETURN 0;
+ END IF;
+
+ -- null max members? in that case, pass it on; NULL means infinite
+ IF max_members_val IS NULL
+ THEN
+ RETURN NULL;
+ END IF;
+
+ -- otherwise, return the delta
+ RETURN max_members_val - current_members_val;
+ END available_family_subscriptions;
+
+ -- *******************************************************************
+ -- FUNCTION: channel_family_current_members
+ -- Calculates and returns the actual count of systems consuming
+ -- physical channel subscriptions.
+ -- Called by: update_family_counts
+ -- rhn_entitlements.repoll_virt_guest_entitlements
+ -- *******************************************************************
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number
+ is
+ current_members_count number := 0;
+ begin
+ select count(sc.server_id)
+ into current_members_count
+ from rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnServer s
+ where s.org_id = org_id_in
+ and s.id = sc.server_id
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and exists (
+ select 1
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
+ and cfsp.server_id = s.id
+ );
+
+ return current_members_count;
+ end;
+
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ IS
+ BEGIN
+ update rhnPrivateChannelFamily
+ set current_members = (
+ channel_family_current_members(channel_family_id_in, org_id_in)
+ )
+ where org_id = org_id_in
+ and channel_family_id = channel_family_id_in;
+ END update_family_counts;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN rhn_channel.available_family_subscriptions(
+ channel_family_id_val, org_id_in);
+ END available_chan_subscriptions;
+
+ -- *******************************************************************
+ -- PROCEDURE: entitle_customer
+ -- Creates a chan fam bucket, or sets max_members for an existing bucket
+ -- Called by: rhn_ep.poll_customer_internal
+ -- Calls: set_family_maxmembers + update_family_counts if the row
+ -- already exists, else it creates it in rhnPrivateChannelFamily.
+ -- *******************************************************************
+ procedure entitle_customer(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor permissions is
+ select 1
+ from rhnPrivateChannelFamily pcf
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ begin
+ for perm in permissions loop
+ set_family_maxmembers(
+ customer_id_in,
+ channel_family_id_in,
+ quantity_in
+ );
+ rhn_channel.update_family_counts(
+ channel_family_id_in,
+ customer_id_in
+ );
+ return;
+ end loop;
+
+ insert into rhnPrivateChannelFamily pcf (
+ channel_family_id, org_id, max_members, current_members
+ ) values (
+ channel_family_id_in, customer_id_in, quantity_in, 0
+ );
+ end;
+
+ -- *******************************************************************
+ -- PROCEDURE: set_family_maxmembers
+ -- Prunes an existing channel family bucket by unsubscribing the
+ -- necessary servers and sets max_members.
+ -- Called by: rhn_channel.entitle_customer
+ -- Calls: unsubscribe_server_from_family
+ -- *******************************************************************
+ procedure set_family_maxmembers(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor servers is
+ select server_id from (
+ select rownum row_number, server_id, modified from (
+ select rcfsp.server_id,
+ rcfsp.modified
+ from rhnChannelFamilyServerPhysical rcfsp
+ where rcfsp.customer_id = customer_id_in
+ and rcfsp.channel_family_id = channel_family_id_in
+ order by modified
+ )
+ where rownum > quantity_in
+ );
+ begin
+ -- prune subscribed servers
+ for server in servers loop
+ rhn_channel.unsubscribe_server_from_family(server.server_id,
+ channel_family_id_in);
+ end loop;
+
+ update rhnPrivateChannelFamily pcf
+ set pcf.max_members = quantity_in
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ end;
+
+ procedure unsubscribe_server_from_family(server_id_in in number,
+ channel_family_id_in in number)
+ is
+ begin
+ delete
+ from rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and channel_id in (
+ select rcfm.channel_id
+ from rhnChannelFamilyMembers rcfm
+ where rcfm.channel_family_id = channel_family_id_in);
+ end;
+
+ function get_org_id(channel_id_in in number)
+ return number
+ is
+ org_id_out number;
+ begin
+ select org_id into org_id_out
+ from rhnChannel
+ where id = channel_id_in;
+
+ return org_id_out;
+ end get_org_id;
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
+ return number
+ is
+ cursor families is
+ select 1
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = org_id_in;
+ begin
+ -- the idea: if we get past this query,
+ -- the user has the role, else catch the exception and return 0
+ for family in families loop
+ return 1;
+ end loop;
+ return 0;
+ end;
+
+ function get_org_access(channel_id_in in number, org_id_in in number)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query,
+ -- the org has access to the channel, else catch the exception and return 0
+ select distinct 1 into throwaway
+ from rhnChannelFamilyMembers CFM,
+ rhnOrgChannelFamilyPermissions CFP
+ where cfp.org_id = org_id_in
+ and CFM.channel_family_id = CFP.channel_family_id
+ and CFM.channel_id = channel_id_in
+ and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if a user has a given role, or if such a role is inferrable
+ function user_role_check_debug(channel_id_in in number,
+ user_id_in in number,
+ role_in in varchar2,
+ reason_out out varchar2)
+ return number
+ is
+ org_id number;
+ begin
+ org_id := rhn_user.get_org_id(user_id_in);
+
+ if role_in = 'manage' and
+ NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
+ reason_out := 'channel_not_owned';
+ return 0;
+ end if;
+
+ if role_in = 'subscribe' and
+ rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
+ reason_out := 'channel_not_available';
+ return 0;
+ end if;
+
+ -- channel admins have all roles
+ if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
+ reason_out := 'channel_admin';
+ return 1;
+ end if;
+
+ -- the subscribe permission is inferred
+ -- UNLESS the not_globally_subscribable flag is set
+ if role_in = 'subscribe'
+ then
+ if rhn_channel.org_channel_setting(channel_id_in,
+ org_id,
+ 'not_globally_subscribable') = 0 then
+ reason_out := 'globally_subscribable';
+ return 1;
+ end if;
+ end if;
+
+ -- all other roles (manage right now) are explicitly granted
+ reason_out := 'direct_permission';
+ return rhn_channel.direct_user_role_check(channel_id_in,
+ user_id_in, role_in);
+ end;
+
+ -- same as above, but with no OUT param; useful in views, etc
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway varchar2(256);
+ begin
+ return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
+ end;
+
+ -- same as above, but returns 1 if user_id_in is null
+ -- This is useful in queries where user_id is not specified
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ begin
+ if user_id_in is null then
+ return 1;
+ end if;
+ return user_role_check(channel_id_in, user_id_in, role_in);
+ end loose_user_role_check;
+
+ -- directly checks the table, no inferred permissions
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnChannelPermissionRole CPR,
+ rhnChannelPermission CP
+ where CP.user_id = user_id_in
+ and CP.channel_id = channel_id_in
+ and CPR.label = role_in
+ and CP.role_id = CPR.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if an org has a certain setting
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnOrgChannelSettingsType OCST,
+ rhnOrgChannelSettings OCS
+ where OCS.org_id = org_id_in
+ and OCS.channel_id = channel_id_in
+ and OCST.label = setting_in
+ and OCS.setting_id = OCST.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ FUNCTION channel_priority(channel_id_in IN number)
+ RETURN number
+ IS
+ channel_name varchar2(64);
+ priority number;
+ end_of_life_val date;
+ org_id_val number;
+ BEGIN
+
+ select name, end_of_life, org_id
+ into channel_name, end_of_life_val, org_id_val
+ from rhnChannel
+ where id = channel_id_in;
+
+ if end_of_life_val is not null then
+ return -400;
+ end if;
+
+ if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
+ priority := 1000;
+ if channel_name not like '%Beta%' then
+ priority := priority + 1000;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 5%' then 600
+ when channel_name like '%v. 4%' then 500
+ when channel_name like '%v. 3%' then 400
+ when channel_name like '%v. 2%' then 300
+ when channel_name like '%v. 1%' then 200
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
+ when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
+ when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
+ when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
+ when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
+ when channel_name like '%Extras%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%)' then 5
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+ elsif channel_name like 'Red Hat Desktop%' then
+ priority := 900;
+
+ if channel_name not like '%Beta%' then
+ priority := priority + 50;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 4%' then 40
+ when channel_name like '%v. 3%' then 30
+ when channel_name like '%v. 2%' then 20
+ when channel_name like '%v. 1%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+
+ elsif org_id_val is not null then
+ priority := 600;
+ else
+ priority := 500;
+ end if;
+
+ return -priority;
+
+ end channel_priority;
+
+ -- right now this only does the accounting changes; the cascade
+ -- actually does the rhnServerChannel delete.
+ procedure delete_server_channels(server_id_in in number)
+ is
+ begin
+ update rhnPrivateChannelFamily
+ set current_members = current_members -1
+ where org_id in (
+ select org_id
+ from rhnServer
+ where id = server_id_in
+ )
+ and channel_family_id in (
+ select rcfm.channel_family_id
+ from rhnChannelFamilyMembers rcfm,
+ rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and rsc.channel_id = rcfm.channel_id
+ and not exists (
+ select 1
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnServerEntitlementView sev,
+ rhnVirtualInstance vi
+ where
+ -- system is a virtual instance
+ vi.virtual_system_id = server_id_in
+ and vi.host_system_id = sev.server_id
+ -- system's host has a virt ent
+ and sev.label in ('virtualization_host',
+ 'virtualization_host_platform')
+ and sev.server_group_type_id =
+ sgtvsl.server_group_type_id
+ -- the host's virt ent grants a cf virt sub level
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ -- the cf is in that virt sub level
+ and cfvsl.channel_family_id = rcfm.channel_family_id
+ )
+ );
+ end;
+
+ -- this could certainly be optimized to do updates if needs be
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
+ is
+ begin
+ delete from rhnChannelNewestPackage where channel_id = channel_id_in;
+ insert into rhnChannelNewestPackage
+ ( channel_id, name_id, evr_id, package_id, package_arch_id )
+ ( select channel_id,
+ name_id, evr_id,
+ package_id, package_arch_id
+ from rhnChannelNewestPackageView
+ where channel_id = channel_id_in
+ );
+ insert into rhnChannelNewestPackageAudit (channel_id, caller)
+ values (channel_id_in, caller_in);
+ update rhnChannel
+ set last_modified = greatest(sysdate, last_modified + 1/86400)
+ where id = channel_id_in;
+ end;
+
+ procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate )
+ is
+
+ channel_last_modified date;
+ last_modified_value date;
+
+ cursor snapshots is
+ select snapshot_id id
+ from rhnSnapshotChannel
+ where channel_id = channel_id_in;
+
+ begin
+
+ select last_modified
+ into channel_last_modified
+ from rhnChannel
+ where id = channel_id_in;
+
+ last_modified_value := date_to_use;
+
+ if last_modified_value <= channel_last_modified then
+ last_modified_value := last_modified_value + 1/86400;
+ end if;
+
+ update rhnChannel set last_modified = last_modified_value
+ where id = channel_id_in;
+
+ if invalidate_ss = 1 then
+ for snapshot in snapshots loop
+ update rhnSnapshot
+ set invalid = lookup_snapshot_invalid_reason('channel_modified')
+ where id = snapshot.id;
+ end loop;
+ end if;
+
+ end update_channel;
+
+ procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelPackage
+ where package_id = package_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we want to invalidate the snapshot assocated with the channel when we
+ -- do this b/c we know we've added or removed or packages
+ rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
+ end loop;
+ end update_channels_by_package;
+
+
+ procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelErrata
+ where errata_id = errata_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we won't invalidate snapshots, b/c just changing the errata associated with
+ -- a channel shouldn't invalidate snapshots
+ rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
+ end loop;
+ end update_channels_by_errata;
+
+END rhn_channel;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.75 2005/03/04 00:04:19 jslagle
+-- bz #147617
+-- Made Red Hat Desktop sort a little better.
+--
+-- Revision 1.74 2005/02/22 03:24:47 jslagle
+-- bz #147617
+-- Improve channel_priority function to order channels better.
+--
+-- Revision 1.73 2004/08/16 20:39:30 pjones
+-- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
+--
+-- Revision 1.72 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.71 2004/04/13 16:28:36 bretm
+-- bugzilla: 119871
+--
+-- keep track of rhnServer.channels_changed through the pl/sql fns
+--
+-- Revision 1.70 2004/03/26 18:11:32 rbb
+-- Bugzilla: 114057
+--
+-- Add a script to determine channel priority.
+--
+-- Revision 1.69 2004/02/17 20:16:52 pjones
+-- bugzilla: none -- add cvs tags into the package as long as we're touching
+-- it anyway
+--
+-- Revision 1.68 2004/02/17 20:05:38 pjones
+-- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
+-- with arches incompatible with the target channel
+--
+-- Revision 1.67 2004/02/06 02:36:10 misa
+-- Changed normalize_server_arch to allow for solaris arches
+--
+-- Revision 1.66 2003/11/13 16:58:34 cturner
+-- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
+--
+-- Revision 1.65 2003/10/23 20:26:24 bretm
+-- bugzilla: none
+--
+-- note the channel label when we unsubscribe, too
+--
+-- Revision 1.64 2003/10/15 14:47:17 bretm
+-- bugzilla: none
+--
+-- add the channel label to the server history summary line when we log a channel change
+--
+-- Revision 1.63 2003/09/24 19:25:56 pjones
+-- this wasn't the right fix, put it back
+--
+-- Revision 1.62 2003/09/24 17:42:19 pjones
+-- bugzilla: none
+--
+-- limit our server base channel guess to channels with available permissions
+--
+-- Revision 1.61 2003/09/22 21:00:40 cturner
+-- add method for easy acl check
+--
+-- Revision 1.60 2003/09/17 22:14:11 misa
+-- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
+--
+-- Revision 1.59 2003/08/21 13:41:17 cturner
+-- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
+--
+-- Revision 1.58 2003/07/24 16:46:22 cturner
+-- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
+--
+-- Revision 1.57 2003/07/24 16:44:16 misa
+-- bugzilla: none A function more usable on the rhnapp side
+--
+-- Revision 1.56 2003/07/23 22:36:51 cturner
+-- argh, max returns null even when now rows; use distinct. how revolting
+--
+-- Revision 1.55 2003/07/23 22:01:31 cturner
+-- oops, this one can return multiple rows; eliminate that in a lazy way
+--
+-- Revision 1.54 2003/07/23 21:59:19 cturner
+-- rework how rhnUserChannel works; move to plsql for speed and maintenance
+--
+-- Revision 1.53 2003/07/21 17:49:12 pjones
+-- bugzilla: none
+--
+-- add optional user for subscribe_server
+--
+-- Revision 1.52 2003/07/14 22:19:29 misa
+-- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
+--
+-- Revision 1.51 2003/06/26 22:09:04 pjones
+-- bugzilla: none
+--
+-- log subscribe and unsubscribe
+--
+-- Revision 1.50 2003/06/05 19:31:15 pjones
+-- bugzilla: 88278 -- make the cursor name smaller
+--
+-- Revision 1.49 2003/06/05 19:18:21 pjones
+-- bugzilla: 88278
+--
+-- unsubscribe_server() opens the package-level cursor when it invokes itself,
+-- so we're using a local copy instead.
+--
+-- Revision 1.48 2003/06/04 16:41:39 pjones
+-- bugzilla: none
+--
+-- make bulk_guess_server_base() silently ignore unguessables
+--
+-- Revision 1.47 2003/06/04 16:27:03 pjones
+-- bugzilla: 88822
+--
+-- eliminate the last outliers that remove things from channels without using
+-- unsubscribe_server, I think.
+--
+-- Revision 1.46 2003/06/03 20:49:37 pjones
+-- bugzilla: 88822
+-- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
+-- for the server in question
+--
+-- Revision 1.45 2003/06/02 20:41:45 pjones
+-- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
+-- problem. Basicly, if you're out of the channel for any reason, you're
+-- also out of rhnProxyInfo/rhnProxyInfo
+--
+-- Revision 1.44 2003/03/24 15:26:28 pjones
+-- bugzilla: 85812
+--
+-- bulk_server_base_change silently ignores servers that are satellites
+-- or proxies, as requested.
+--
+-- Revision 1.43 2003/02/26 20:28:17 pjones
+-- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
+-- the old codepath is:
+--
+-- ep ->
+-- rhn_ep.entitlement_run_me() ->
+-- rhn_ep.poll_customer() ->
+-- rhn_channel.entitle_customer()
+--
+-- which doesn't change current_members, even though it may remove servers
+-- from the family.
+--
+-- There's another bug here: currently, we don't try to order forced
+-- unsubscribes in any way; we just use
+-- rhn_channel.unsubscribe_server_from_family . If there are any child
+-- channel subscriptions, this will leave them subscribed. We really need
+-- to iterate across the channels again, and subscribe any channel for which
+-- there are no parent channel subscriptions.
+--
+-- Ugh.
+--
+-- Revision 1.42 2003/01/28 00:19:45 pjones
+-- fix clear_subscriptions; AFAICT, this is only hit on the
+-- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
+-- it infrequent enough that it could be our "bad count" culprit.
+--
+-- Revision 1.41 2003/01/14 19:51:45 pjones
+-- make setting current_members on rhnChannelFamilyPermissions work when
+-- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/204-rhn_entitlements.pks.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/204-rhn_entitlements.pks.sql
new file mode 100644
index 0000000..cc52ad2
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/204-rhn_entitlements.pks.sql
@@ -0,0 +1,225 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace
+package rhn_entitlements
+is
+ body_version varchar2(100) := '$Id$';
+
+ type ents_array is varray(10) of rhnServerGroupType.label%TYPE;
+
+ procedure remove_org_entitlements (
+ org_id_in number
+ );
+
+ function entitlement_grants_service (
+ entitlement_in in varchar2,
+ service_level_in in varchar2
+ ) return number;
+
+ function lookup_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number;
+
+ function create_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number;
+
+ function can_entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2
+ )
+ return number;
+
+ function can_switch_base (
+ server_id_in in integer,
+ type_label_in in varchar2
+ )
+ return number;
+
+ function find_compatible_sg (
+ server_id_in in number,
+ type_label_in in varchar2,
+ sgid_out out number
+ )
+ return boolean;
+
+ procedure entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ );
+
+ procedure remove_server_entitlement (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled',
+ repoll_virt_guests in number := 1
+ );
+
+ procedure unentitle_server (
+ server_id_in in number
+ );
+
+ procedure repoll_virt_guest_entitlements(
+ server_id_in in number
+ );
+
+ function get_server_entitlement (
+ server_id_in in number
+ ) return ents_array;
+
+ procedure modify_org_service (
+ org_id_in in number,
+ service_label_in in varchar2,
+ enable_in in char
+ );
+
+ procedure set_customer_enterprise (
+ customer_id_in in number
+ );
+
+ procedure set_customer_provisioning (
+ customer_id_in in number
+ );
+
+ procedure set_customer_nonlinux (
+ customer_id_in in number
+ );
+
+ procedure unset_customer_enterprise (
+ customer_id_in in number
+ );
+
+ procedure unset_customer_provisioning (
+ customer_id_in in number
+ );
+
+ procedure unset_customer_nonlinux (
+ customer_id_in in number
+ );
+
+ procedure assign_system_entitlement(
+ group_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number
+ );
+
+ procedure assign_channel_entitlement(
+ channel_family_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number
+ );
+
+ procedure activate_system_entitlement(
+ org_id_in in number,
+ group_label_in in varchar2,
+ quantity_in in number
+ );
+
+ procedure activate_channel_entitlement(
+ org_id_in in number,
+ channel_family_label_in in varchar2,
+ quantity_in in number
+ );
+
+ procedure set_group_count (
+ customer_id_in in number, -- customer_id
+ type_in in char, -- 'U' or 'S'
+ group_type_in in number, -- rhn[User|Server]GroupType.id
+ quantity_in in number -- quantity
+ );
+
+ procedure set_family_count (
+ customer_id_in in number, -- customer_id
+ channel_family_id_in in number, -- 246
+ quantity_in in number -- 3
+ );
+
+ -- this makes NO checks that the quantity is within max,
+ -- so we should NEVER run this unless we KNOW that we won't be
+ -- violating the max
+ procedure entitle_last_modified_servers (
+ customer_id_in in number, -- customer_id
+ type_label_in in varchar2, -- 'enterprise_entitled'
+ quantity_in in number -- 3
+ );
+
+ procedure prune_everything (
+ customer_id_in in number
+ );
+
+ procedure subscribe_newest_servers (
+ customer_id_in in number
+ );
+end rhn_entitlements;
+/
+show errors
+
+-- $Log$
+-- Revision 1.19 2004/05/26 19:45:48 pjones
+-- bugzilla: 123639
+-- 1) reformat "entitlement_grants_service"
+-- 2) make the .pks and .pkb be in the same order.
+-- 3) add "modify_org_service" (to be used instead of set_customer_SERVICELEVEL)
+-- 4) add monitoring specific data.
+--
+-- Revision 1.18 2004/02/19 20:17:49 pjones
+-- bugzilla: 115896 -- add sgt and oet data for nonlinux, add
+-- [un]set_customer_nonlinux
+--
+-- Revision 1.17 2004/01/13 23:37:08 pjones
+-- bugzilla: none -- mate provisioning and management slots.
+--
+-- Revision 1.16 2003/09/23 22:14:41 bretm
+-- bugzilla: 103655
+--
+-- need something in the db that knows provisioning boxes are management boxes too, etc.
+--
+-- Revision 1.15 2003/09/19 22:35:07 pjones
+-- bugzilla: none
+--
+-- provisioning and config management entitlement support
+--
+-- Revision 1.14 2003/09/02 22:22:54 pjones
+-- bugzilla: none
+--
+-- attempt to autoentitle upon entitlement changes
+--
+-- Revision 1.13 2003/06/05 21:43:40 pjones
+-- bugzilla: none
+--
+-- add rhn_entitlements.prune_everything(customer_id_in in number);
+--
+-- Revision 1.12 2003/05/22 16:01:14 pjones
+-- reformat
+-- remove update_[server|user]group_counts (unused)
+--
+-- Revision 1.11 2002/06/03 16:07:29 pjones
+-- make prune_group and prune_family update respective max_members
+-- correctly.
+--
+-- Revision 1.10 2002/05/29 19:10:31 pjones
+-- code to entitle the last N modified servers to a particular service
+-- level
+--
+-- Revision 1.9 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/205-rhn_entitlements.pkb.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/205-rhn_entitlements.pkb.sql
new file mode 100644
index 0000000..7caac8c
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/205-rhn_entitlements.pkb.sql
@@ -0,0 +1,1719 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace
+package body rhn_entitlements
+is
+ body_version varchar2(100) := '$Id$';
+
+
+ -- *******************************************************************
+ -- PROCEDURE: remove_org_entitlements
+ --
+ -- Removes both system entitlements and channel subscriptions
+ -- that are currently assigned to an org and re-assigns to the
+ -- master org (org_id = 1).
+ --
+ -- When we call this we expect everything to already be unentitled
+ -- which shoul be handled by delete_org.
+ --
+ -- Called by: delete_org
+ -- *******************************************************************
+ procedure remove_org_entitlements(
+ org_id_in in number
+ )
+ is
+
+ cursor system_ents is
+ select sg.id, sg.max_members, sg.group_type
+ from rhnServerGroup sg
+ where group_type is not null
+ and org_id = org_id_in;
+
+ cursor channel_subs is
+ select pcf.channel_family_id, pcf.max_members
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.org_id is null;
+
+ begin
+
+ for system_ent in system_ents loop
+ update rhnServerGroup
+ set max_members = max_members + system_ent.max_members
+ where org_id = 1
+ and group_type = system_ent.group_type;
+ end loop;
+
+ update rhnServerGroup
+ set max_members = 0
+ where org_id = org_id_in;
+
+ for channel_sub in channel_subs loop
+ update rhnPrivateChannelFamily
+ set max_members = max_members + channel_sub.max_members
+ where org_id = 1
+ and channel_family_id = channel_sub.channel_family_id;
+ end loop;
+
+ update rhnPrivateChannelFamily
+ set max_members = 0
+ where org_id = org_id_in;
+
+ end remove_org_entitlements;
+
+ function entitlement_grants_service (
+ entitlement_in in varchar2,
+ service_level_in in varchar2
+ ) return number is
+ begin
+ if service_level_in = 'provisioning' then
+ if entitlement_in = 'provisioning_entitled' then
+ return 1;
+ else
+ return 0;
+ end if;
+ elsif service_level_in = 'management' then
+ if entitlement_in = 'enterprise_entitled' then
+ return 1;
+ else
+ return 0;
+ end if;
+ elsif service_level_in = 'monitoring' then
+ if entitlement_in = 'monitoring_entitled' then
+ return 1;
+ end if;
+ elsif service_level_in = 'updates' then
+ return 1;
+ else
+ return 0;
+ end if;
+ end entitlement_grants_service;
+
+ function lookup_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number is
+ cursor server_groups is
+ select sg.id server_group_id
+ from rhnServerGroup sg,
+ rhnServerGroupType sgt
+ where sgt.label = type_label_in
+ and sgt.id = sg.group_type
+ and sg.org_id = org_id_in;
+ begin
+ for sg in server_groups loop
+ return sg.server_group_id;
+ end loop;
+ return rhn_entitlements.create_entitlement_group(
+ org_id_in,
+ type_label_in
+ );
+ end lookup_entitlement_group;
+
+ function create_entitlement_group (
+ org_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) return number is
+ sg_id_val number;
+ begin
+ select rhn_server_group_id_seq.nextval
+ into sg_id_val
+ from dual;
+
+ insert into rhnServerGroup (
+ id, name, description, max_members, current_members,
+ group_type, org_id
+ ) (
+ select sg_id_val, sgt.label, sgt.label,
+ 0, 0, sgt.id, org_id_in
+ from rhnServerGroupType sgt
+ where sgt.label = type_label_in
+ );
+
+ return sg_id_val;
+ end create_entitlement_group;
+
+ function can_entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2 )
+ return number is
+ cursor addon_servergroups (base_label_in in varchar2,
+ addon_label_in in varchar2) is
+ select
+ addon_id
+ from
+ rhnSGTypeBaseAddonCompat
+ where base_id = lookup_sg_type (base_label_in)
+ and addon_id = lookup_sg_type (addon_label_in);
+
+ previous_ent rhn_entitlements.ents_array;
+ is_base_in char := 'N';
+ is_base_current char := 'N';
+ i number := 0;
+ sgid number := 0;
+
+ begin
+
+ previous_ent := rhn_entitlements.ents_array();
+ previous_ent := rhn_entitlements.get_server_entitlement(server_id_in);
+
+ select distinct is_base
+ into is_base_in
+ from rhnServerGroupType
+ where label = type_label_in;
+
+ if previous_ent.count = 0 then
+ if (is_base_in = 'Y' and rhn_entitlements.find_compatible_sg (server_id_in, type_label_in, sgid)) then
+ -- rhn_server.insert_into_servergroup (server_id_in, sgid);
+ return 1;
+ else
+ -- rhn_exception.raise_exception ('invalid_base_entitlement');
+ return 0;
+ end if;
+
+ -- there are previous ents, first make sure we're not trying to entitle a base ent
+ elsif is_base_in = 'Y' then
+ -- rhn_exception.raise_exception ('invalid_addon_entitlement');
+ return 0;
+
+ -- it must be an addon, so proceed with the entitlement
+ else
+
+ -- find the servers base ent
+ is_base_current := 'N';
+ i := 0;
+ while is_base_current = 'N' and i <= previous_ent.count
+ loop
+ i := i + 1;
+ select is_base
+ into is_base_current
+ from rhnServerGroupType
+ where label = previous_ent(i);
+ end loop;
+
+ -- never found a base ent, that would be strange
+ if is_base_current = 'N' then
+ -- rhn_exception.raise_exception ('invalid_base_entitlement');
+ return 0;
+ end if;
+
+ -- this for loop verifies the validity of the addon path
+ for addon_servergroup in addon_servergroups (previous_ent(i), type_label_in) loop
+ -- find an appropriate sgid for the addon and entitle the server
+ if rhn_entitlements.find_compatible_sg (server_id_in, type_label_in, sgid) then
+ -- rhn_server.insert_into_servergroup (server_id_in, sgid);
+ return 1;
+ else
+ -- rhn_exception.raise_exception ('invalid_addon_entitlement');
+ return 0;
+ end if;
+ end loop;
+
+ end if;
+
+ return 0;
+
+ end can_entitle_server;
+
+ function can_switch_base (
+ server_id_in in integer,
+ type_label_in in varchar2
+ ) return number is
+
+ type_label_in_is_base char(1);
+ sgid number;
+
+ begin
+
+ begin
+ select is_base into type_label_in_is_base
+ from rhnServerGroupType
+ where label = type_label_in;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception ( 'invalid_entitlement' );
+ end;
+
+ if type_label_in_is_base = 'N' then
+ rhn_exception.raise_exception ( 'invalid_entitlement' );
+ elsif rhn_entitlements.find_compatible_sg ( server_id_in,
+ type_label_in, sgid ) then
+ return 1;
+ else
+ return 0;
+ end if;
+
+ end can_switch_base;
+
+
+ function find_compatible_sg (
+ server_id_in in number,
+ type_label_in in varchar2,
+ sgid_out out number
+ ) return boolean is
+
+ cursor servergroups is
+ select sg.id id
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServer s,
+ rhnServerServerGroupArchCompat ssgac
+ where s.id = server_id_in
+ and s.org_id = sg.org_id
+ and sgt.label = type_label_in
+ and sg.group_type = sgt.id
+ and ssgac.server_group_type = sgt.id
+ and ssgac.server_arch_id = s.server_arch_id
+ and not exists (
+ select 1
+ from rhnServerGroupMembers sgm
+ where sgm.server_group_id = sg.id
+ and sgm.server_id = s.id);
+
+
+ begin
+ for servergroup in servergroups loop
+ sgid_out := servergroup.id;
+ return true;
+ end loop;
+
+ --no servergroup found
+ sgid_out := 0;
+ return false;
+ end find_compatible_sg;
+
+ procedure entitle_server (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled'
+ ) is
+ sgid number := 0;
+ is_virt number := 0;
+
+ begin
+
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host', 'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ if is_virt = 0 and (type_label_in = 'virtualization_host' or
+ type_label_in = 'virtualization_host_platform') then
+
+ is_virt := 1;
+ end if;
+
+
+
+ if rhn_entitlements.can_entitle_server(server_id_in,
+ type_label_in) = 1 then
+ if rhn_entitlements.find_compatible_sg (server_id_in,
+ type_label_in, sgid) then
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'added system entitlement ',
+ case type_label_in
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platform' end );
+
+ rhn_server.insert_into_servergroup (server_id_in, sgid);
+
+ if is_virt = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ else
+ rhn_exception.raise_exception ('no_available_server_group');
+ end if;
+ else
+ rhn_exception.raise_exception ('invalid_entitlement');
+ end if;
+ end entitle_server;
+
+ procedure remove_server_entitlement (
+ server_id_in in number,
+ type_label_in in varchar2 := 'sw_mgr_entitled',
+ repoll_virt_guests in number := 1
+ ) is
+ group_id number;
+ type_is_base char;
+ is_virt number := 0;
+ begin
+ begin
+
+
+ -- would be nice if there were a virt attribute of entitlement types, not have to specify 2 different ones...
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host', 'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ select sg.id, sgt.is_base
+ into group_id, type_is_base
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnServer s
+ where s.id = server_id_in
+ and s.id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.org_id = s.org_id
+ and sgt.label = type_label_in
+ and sgt.id = sg.group_type;
+
+ if ( type_is_base = 'Y' ) then
+ -- unentitle_server should handle everything, don't really need to do anything else special here
+ unentitle_server ( server_id_in );
+ else
+
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'removed system entitlement ',
+ case type_label_in
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platforrm' end );
+
+ rhn_server.delete_from_servergroup(server_id_in, group_id);
+
+ -- special case: clean up related monitornig data
+ if type_label_in = 'monitoring_entitled' then
+ DELETE
+ FROM state_change
+ WHERE o_id IN (SELECT probe_id
+ FROM rhn_check_probe
+ WHERE host_id = server_id_in);
+ DELETE
+ FROM time_series
+ WHERE SUBSTR(o_id, INSTR(o_id, '-') + 1,
+ (INSTR(o_id, '-', INSTR(o_id, '-') + 1) - INSTR(o_id, '-')) - 1)
+ IN (SELECT probe_id
+ FROM rhn_check_probe
+ WHERE host_id = server_id_in);
+ DELETE
+ FROM rhn_probe
+ WHERE recid IN (SELECT probe_id
+ FROM rhn_check_probe
+ WHERE host_id = server_id_in);
+ end if;
+
+ if is_virt = 1 and repoll_virt_guests = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+ end if;
+
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('invalid_server_group_member');
+ end;
+
+ end remove_server_entitlement;
+
+
+ procedure unentitle_server (server_id_in in number) is
+
+ cursor servergroups is
+ select distinct sgt.label, sg.id server_group_id
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServer s,
+ rhnServerGroupMembers sgm
+ where s.id = server_id_in
+ and s.org_id = sg.org_id
+ and sg.group_type = sgt.id
+ and sgm.server_group_id = sg.id
+ and sgm.server_id = s.id;
+
+ is_virt number := 0;
+
+ begin
+
+ begin
+ select 1 into is_virt
+ from rhnServerEntitlementView
+ where server_id = server_id_in
+ and label in ('virtualization_host', 'virtualization_host_platform');
+ exception
+ when no_data_found then
+ is_virt := 0;
+ end;
+
+ for servergroup in servergroups loop
+
+ insert into rhnServerHistory ( id, server_id, summary, details )
+ values ( rhn_event_id_seq.nextval, server_id_in,
+ 'removed system entitlement ',
+ case servergroup.label
+ when 'enterprise_entitled' then 'Management'
+ when 'sw_mgr_entitled' then 'Update'
+ when 'provisioning_entitled' then 'Provisioning'
+ when 'monitoring_entitled' then 'Monitoring'
+ when 'virtualization_host' then 'Virtualization'
+ when 'virtualization_host_platform' then
+ 'Virtualization Platform' end );
+
+ rhn_server.delete_from_servergroup(server_id_in,
+ servergroup.server_group_id );
+ end loop;
+
+ if is_virt = 1 then
+ rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
+ end if;
+
+ end unentitle_server;
+
+
+ -- *******************************************************************
+ -- PROCEDURE: repoll_virt_guest_entitlements
+ --
+ -- Whenever we add/remove a virtualization_host* entitlement from
+ -- a host, we can call this procedure to update what type of slots
+ -- the guests are consuming.
+ --
+ -- If you're removing the entitlement, it's
+ -- possible the guests will become unentitled if you don't have enough
+ -- physical slots to cover them.
+ --
+ -- If you're adding the entitlement, you end up freeing up physical
+ -- slots for other systems.
+ --
+ -- *******************************************************************
+ procedure repoll_virt_guest_entitlements(server_id_in in number)
+ is
+
+ -- All channel families associated with the guests of server_id_in
+ cursor families is
+ select distinct cfs.channel_family_id
+ from
+ rhnChannelFamilyServers cfs,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = cfs.server_id;
+
+ -- All of server group types associated with the guests of
+ -- server_id_in
+ cursor group_types is
+ select distinct sg.group_type, sgt.label
+ from
+ rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.group_type = sgt.id;
+
+ -- Virtual servers from a certain family belonging to a speicifc
+ -- host that are consuming physical channel slots over the limit.
+ cursor virt_servers_cfam(family_id_in in number, quantity_in in number) is
+ select virtual_system_id
+ from (
+ select rownum, vi.virtual_system_id
+ from
+ rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sc.server_id
+ and sc.channel_id = cfm.channel_id
+ and cfm.channel_family_id = family_id_in
+ order by sc.modified desc
+ )
+ where rownum <= quantity_in;
+
+ -- Virtual servers from a certain family belonging to a speicifc
+ -- host that are consuming physical system slots over the limit.
+ cursor virt_servers_sgt(group_type_in in number, quantity_in in number) is
+ select virtual_system_id
+ from (
+ select rownum, vi.virtual_system_id
+ from
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm,
+ rhnVirtualInstance vi
+ where
+ vi.host_system_id = server_id_in
+ and vi.virtual_system_id = sgm.server_id
+ and sgm.server_group_id = sg.id
+ and sg.group_type = group_type_in
+ order by sgm.modified desc
+ )
+ where rownum <= quantity_in;
+
+ org_id_val number;
+ max_members_val number;
+ current_members_calc number;
+ sg_id number;
+
+ begin
+
+ select org_id
+ into org_id_val
+ from rhnServer
+ where id = server_id_in;
+
+ -- deal w/ channel entitlements first ...
+ for family in families loop
+ -- get the current (physical) members of the family
+ current_members_calc :=
+ rhn_channel.channel_family_current_members(family.channel_family_id,
+ org_id_val); -- fixed transposed args
+
+ -- get the max members of the family
+ select max_members
+ into max_members_val
+ from rhnPrivateChannelFamily
+ where channel_family_id = family.channel_family_id
+ and org_id = org_id_val;
+
+ if current_members_calc > max_members_val then
+ -- A virtualization_host* ent must have been removed, so we'll
+ -- unsubscribe guests from the host first.
+
+ -- hm, i don't think max_members - current_members_calc yielding a negative number
+ -- will work w/ rownum, swaping 'em in the body of this if...
+ for virt_server in virt_servers_cfam(family.channel_family_id,
+ current_members_calc - max_members_val) loop
+
+ rhn_channel.unsubscribe_server_from_family(
+ virt_server.virtual_system_id,
+ family.channel_family_id);
+ end loop;
+
+ -- if we're still over the limit, which would be odd,
+ -- just prune the group to max_members
+ --
+ -- er... wouldn't we actually have to refresh the values of
+ -- current_members_calc and max_members_val to actually ever
+ -- *skip this??
+ if current_members_calc > max_members_val then
+ -- argh, transposed again?!
+ set_family_count(org_id_val,
+ family.channel_family_id,
+ max_members_val);
+ end if;
+
+ end if;
+
+ -- update current_members for the family. This will set the value
+ -- to reflect adding/removing the entitlement.
+ --
+ -- what's the difference of doing this vs the unavoidable set_family_count above?
+ rhn_channel.update_family_counts(family.channel_family_id,
+ org_id_val);
+ end loop;
+
+ for a_group_type in group_types loop
+ -- get the current *physical* members of the system entitlement type for the org...
+ --
+ -- unlike channel families, it appears the standard rhnServerGroup.max_members represents
+ -- *physical* slots, vs physical+virt ... boy that's confusing...
+
+ select max_members, id
+ into max_members_val, sg_id
+ from rhnServerGroup
+ where group_type = a_group_type.group_type
+ and org_id = org_id_val;
+
+
+ select count(sep.server_id) into current_members_calc
+ from rhnServerEntitlementPhysical sep
+ where sep.server_group_id = sg_id
+ and sep.server_group_type_id = a_group_type.group_type;
+
+ if current_members_calc > max_members_val then
+ -- A virtualization_host* ent must have been removed, and we're over the limit, so unsubscribe guests
+ for virt_server in virt_servers_sgt(a_group_type.group_type,
+ current_members_calc - max_members_val) loop
+ rhn_entitlements.remove_server_entitlement(virt_server.virtual_system_id, a_group_type.label);
+
+ -- decrement current_members_calc, we'll use it to reset current_members for the group at the end...
+ current_members_calc := current_members_calc - 1;
+ end loop;
+
+ end if;
+
+ update rhnServerGroup set current_members = current_members_calc
+ where org_id = org_id_val
+ and group_type = a_group_type.group_type;
+
+ -- I think that's all the house-keeping we have to do...
+ end loop;
+
+ end repoll_virt_guest_entitlements;
+
+
+ function get_server_entitlement (
+ server_id_in in number
+ ) return ents_array is
+
+ cursor server_groups is
+ select sgt.label
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm
+ where 1=1
+ and sgm.server_id = server_id_in
+ and sg.id = sgm.server_group_id
+ and sgt.id = sg.group_type
+ and sgt.label in (
+ 'sw_mgr_entitled','enterprise_entitled',
+ 'provisioning_entitled', 'nonlinux_entitled',
+ 'monitoring_entitled', 'virtualization_host',
+ 'virtualization_host_platform'
+ );
+
+ ent_array ents_array;
+
+ begin
+
+ ent_array := ents_array();
+
+ for sg in server_groups loop
+ ent_array.extend;
+ ent_array(ent_array.count) := sg.label;
+ end loop;
+
+ return ent_array;
+
+ end get_server_entitlement;
+
+
+ -- this desperately needs to be table driven.
+ procedure modify_org_service (
+ org_id_in in number,
+ service_label_in in varchar2,
+ enable_in in char
+ ) is
+ type roles_v is varray(10) of rhnUserGroupType.label%TYPE;
+ roles_to_process roles_v;
+ cursor roles(role_label_in in varchar2) is
+ select label, id
+ from rhnUserGroupType
+ where label = role_label_in;
+ cursor org_roles(role_label_in in varchar2) is
+ select 1
+ from rhnUserGroup ug,
+ rhnUserGroupType ugt
+ where ugt.label = role_label_in
+ and ug.org_id = org_id_in
+ and ugt.id = ug.group_type;
+
+ type ents_v is varray(10) of rhnOrgEntitlementType.label%TYPE;
+ ents_to_process ents_v;
+ cursor ents(ent_label_in in varchar2) is
+ select label, id
+ from rhnOrgEntitlementType
+ where label = ent_label_in;
+ cursor org_ents(ent_label_in in varchar2) is
+ select 1
+ from rhnOrgEntitlements oe,
+ rhnOrgEntitlementType oet
+ where oet.label = ent_label_in
+ and oe.org_id = org_id_in
+ and oet.id = oe.entitlement_id;
+ create_row char(1);
+ begin
+ ents_to_process := ents_v();
+ roles_to_process := roles_v();
+ -- a bit kludgy, but only for 3.4 really. Certainly no
+ -- worse than the old code...
+ if service_label_in = 'enterprise' or
+ service_label_in = 'management' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'org_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'system_group_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'activation_key_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'org_applicant';
+ elsif service_label_in = 'provisioning' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_provisioning';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'system_group_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'activation_key_admin';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ -- another nasty special case...
+ if enable_in = 'Y' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
+ end if;
+ elsif service_label_in = 'monitoring' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_monitor';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'monitoring_admin';
+ elsif service_label_in = 'virtualization' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_virtualization';
+
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ elsif service_label_in = 'virtualization_platform' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_virtualization_platform';
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ elsif service_label_in = 'nonlinux' then
+ ents_to_process.extend;
+ ents_to_process(ents_to_process.count) := 'rhn_nonlinux';
+ roles_to_process.extend;
+ roles_to_process(roles_to_process.count) := 'config_admin';
+ end if;
+
+ if enable_in = 'Y' then
+ for i in 1..ents_to_process.count loop
+ for ent in ents(ents_to_process(i)) loop
+ create_row := 'Y';
+ for oe in org_ents(ent.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnOrgEntitlements(org_id, entitlement_id)
+ values (org_id_in, ent.id);
+ end if;
+ end loop;
+ end loop;
+ for i in 1..roles_to_process.count loop
+ for role in roles(roles_to_process(i)) loop
+ create_row := 'Y';
+ for o_r in org_roles(role.label) loop
+ create_row := 'N';
+ end loop;
+ if create_row = 'Y' then
+ insert into rhnUserGroup(
+ id, name, description, current_members,
+ group_type, org_id
+ ) (
+ select rhn_user_group_id_seq.nextval,
+ ugt.name || 's',
+ ugt.name || 's for Org ' ||
+ o.name || ' ('|| o.id ||')',
+ 0, ugt.id, o.id
+ from rhnUserGroupType ugt,
+ web_customer o
+ where o.id = org_id_in
+ and ugt.id = role.id
+ );
+ end if;
+ end loop;
+ end loop;
+ else
+ for i in 1..ents_to_process.count loop
+ for ent in ents(ents_to_process(i)) loop
+ delete from rhnOrgEntitlements
+ where org_id = org_id_in
+ and entitlement_id = ent.id;
+ end loop;
+ end loop;
+ end if;
+ end modify_org_service;
+
+ procedure set_customer_enterprise (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'enterprise', 'Y');
+ end set_customer_enterprise;
+
+ procedure set_customer_provisioning (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'provisioning', 'Y');
+ end set_customer_provisioning;
+
+ procedure set_customer_monitoring (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'monitoring', 'Y');
+ end set_customer_monitoring;
+
+ procedure set_customer_nonlinux (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'nonlinux', 'Y');
+ end set_customer_nonlinux;
+
+ procedure unset_customer_enterprise (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'enterprise', 'N');
+ end unset_customer_enterprise;
+
+ procedure unset_customer_provisioning (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'provisioning', 'N');
+ end unset_customer_provisioning;
+
+ procedure unset_customer_monitoring (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'monitoring', 'N');
+ end unset_customer_monitoring;
+
+ procedure unset_customer_nonlinux (
+ customer_id_in in number
+ ) is
+ begin
+ modify_org_service(customer_id_in, 'nonlinux', 'N');
+ end unset_customer_nonlinux;
+
+ -- *******************************************************************
+ -- PROCEDURE: prune_group
+ -- Unsubscribes servers consuming physical slots that over the org's
+ -- limit.
+ -- Called by: set_group_count, prune_everything, repoll_virt_guest_entitlements
+ -- *******************************************************************
+ procedure prune_group (
+ group_id_in in number,
+ type_in in char,
+ quantity_in in number
+ ) is
+ cursor usergroups is
+ select user_id, user_group_id, ugt.label
+ from rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where 1=1
+ and ugm.user_group_id = group_id_in
+ and ugm.user_id in (
+ select user_id
+ from (
+ select rownum row_number,
+ user_id,
+ time
+ from (
+ select user_id,
+ modified time
+ from rhnUserGroupMembers
+ where user_group_id = group_id_in
+ order by time asc
+ )
+ )
+ where row_number > quantity_in
+ )
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id;
+ cursor servergroups is
+ select server_id, server_group_id, sgt.id group_type_id, sgt.label
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg,
+ rhnServerGroupMembers sgm
+ where 1=1
+ and sgm.server_group_id = group_id_in
+ and sgm.server_id in (
+ select server_id
+ from (
+ select rownum row_number,
+ server_id,
+ time
+ from (
+ select sep.server_id,
+ sep.modified time
+ from
+ rhnServerEntitlementPhysical sep
+ where
+ sep.server_group_id = group_id_in
+ order by time asc
+ )
+ )
+ where row_number > quantity_in
+ )
+ and sgm.server_group_id = sg.id
+ and sg.group_type = sgt.id;
+ type_is_base char;
+ begin
+ if type_in = 'U' then
+ update rhnUserGroup
+ set max_members = quantity_in
+ where id = group_id_in;
+
+ for ug in usergroups loop
+ rhn_user.remove_from_usergroup(ug.user_id, ug.user_group_id);
+ end loop;
+ elsif type_in = 'S' then
+ update rhnServerGroup
+ set max_members = quantity_in
+ where id = group_id_in;
+
+ for sg in servergroups loop
+ remove_server_entitlement(sg.server_id, sg.label);
+
+ select is_base
+ into type_is_base
+ from rhnServerGroupType sgt
+ where sgt.id = sg.group_type_id;
+
+ -- if we're removing a base ent, then be sure to
+ -- remove the server's channel subscriptions.
+ if ( type_is_base = 'Y' ) then
+ rhn_channel.clear_subscriptions(sg.server_id);
+ end if;
+
+ end loop;
+ end if;
+ end prune_group;
+
+ -- *******************************************************************
+ -- PROCEDURE: assign_system_entitlement
+ --
+ -- Moves system entitlements from from_org_id_in to to_org_id_in.
+ -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
+ -- does not have enough entitlements to cover the move.
+ -- Takes care of unentitling systems if necessary by calling
+ -- set_group_count
+ -- *******************************************************************
+ procedure assign_system_entitlement(
+ group_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ to_org_prev_ent_count number;
+ new_ent_count number;
+ new_quantity number;
+ group_type number;
+ begin
+
+ begin
+ select max_members
+ into prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.org_id = from_org_id_in
+ and sg.group_type = sgt.id
+ and sgt.label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end;
+
+ begin
+ select max_members
+ into to_org_prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.org_id = to_org_id_in
+ and sg.group_type = sgt.id
+ and sgt.label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ to_org_prev_ent_count := 0;
+ end;
+
+ begin
+ select id
+ into group_type
+ from rhnServerGroupType
+ where label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_server_group');
+ end;
+
+ new_ent_count := prev_ent_count - quantity_in;
+
+ if prev_ent_count > new_ent_count then
+ new_quantity := to_org_prev_ent_count + quantity_in;
+ end if;
+
+ if new_ent_count < 0 then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end if;
+
+
+ rhn_entitlements.set_group_count(from_org_id_in,
+ 'S',
+ group_type,
+ new_ent_count);
+
+ rhn_entitlements.set_group_count(to_org_id_in,
+ 'S',
+ group_type,
+ new_quantity);
+
+ -- Create or delete the entries in rhnOrgEntitlementType
+ if group_label_in = 'enterprise_entitled' then
+ if new_quantity > 0 then
+ set_customer_enterprise(to_org_id_in);
+ else
+ unset_customer_enterprise(to_org_id_in);
+ end if;
+ end if;
+
+ if group_label_in = 'provisioning_entitled' then
+ if new_quantity > 0 then
+ set_customer_provisioning(to_org_id_in);
+ else
+ unset_customer_provisioning(to_org_id_in);
+ end if;
+ end if;
+
+ if group_label_in = 'monitoring_entitled' then
+ if new_quantity > 0 then
+ set_customer_monitoring(to_org_id_in);
+ else
+ unset_customer_monitoring(to_org_id_in);
+ end if;
+ end if;
+
+ end assign_system_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: assign_channel_entitlement
+ --
+ -- Moves channel entitlements from from_org_id_in to to_org_id_in.
+ -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
+ -- does not have enough entitlements to cover the move.
+ -- Takes care of unentitling systems if necessary by calling
+ -- set_family_count
+ -- *******************************************************************
+ procedure assign_channel_entitlement(
+ channel_family_label_in in varchar2,
+ from_org_id_in in number,
+ to_org_id_in in number,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ new_ent_count number;
+ to_org_prev_ent_count number;
+ new_quantity number;
+ cfam_id number;
+ begin
+
+ begin
+ select max_members
+ into prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = from_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end;
+
+ begin
+ select max_members
+ into to_org_prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = to_org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ to_org_prev_ent_count := 0;
+ end;
+
+
+ begin
+ select id
+ into cfam_id
+ from rhnChannelFamily
+ where label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_channel_family');
+ end;
+
+ new_ent_count := prev_ent_count - quantity_in;
+
+ if prev_ent_count > new_ent_count then
+ new_quantity := to_org_prev_ent_count + quantity_in;
+ end if;
+
+
+ if new_ent_count < 0 then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ end if;
+
+ rhn_entitlements.set_family_count(from_org_id_in,
+ cfam_id,
+ new_ent_count);
+
+ rhn_entitlements.set_family_count(to_org_id_in,
+ cfam_id,
+ new_quantity);
+
+ end assign_channel_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: activate_system_entitlement
+ --
+ -- Sets the values in rhnServerGroup for a given rhnServerGroupType.
+ --
+ -- Calls: set_group_count to update, prune, or create the group.
+ -- Called by: the code that activates a satellite cert.
+ --
+ -- Raises not_enough_entitlements_in_base_org if all entitlements
+ -- in the org are used so the free entitlements would not cover
+ -- the difference when descreasing the number of entitlements.
+ -- *******************************************************************
+ procedure activate_system_entitlement(
+ org_id_in in number,
+ group_label_in in varchar2,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ prev_ent_count_sum number;
+ group_type number;
+ begin
+
+ -- Fetch the current entitlement count for the org
+ -- into prev_ent_count
+ begin
+ select current_members
+ into prev_ent_count
+ from rhnServerGroupType sgt,
+ rhnServerGroup sg
+ where sg.group_type = sgt.id
+ and sgt.label = group_label_in
+ and sg.org_id = org_id_in;
+ exception
+ when NO_DATA_FOUND then
+ prev_ent_count := 0;
+ end;
+
+ begin
+ select id
+ into group_type
+ from rhnServerGroupType
+ where label = group_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_server_group');
+ end;
+
+ -- If we're setting the total entitlemnt count to a lower value,
+ -- and that value is less than the allocated count in this org,
+ -- we need to raise an exception.
+ if quantity_in < prev_ent_count then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ else
+ rhn_entitlements.set_group_count(org_id_in,
+ 'S',
+ group_type,
+ quantity_in);
+ end if;
+
+
+ end activate_system_entitlement;
+
+ -- *******************************************************************
+ -- PROCEDURE: activate_channel_entitlement
+ --
+ -- Calls: set_family_count to update, prune, or create the family
+ -- permission bucket.
+ -- Called by: the code that activates a satellite cert.
+ --
+ -- Raises not_enough_entitlements_in_base_org if there are not enough
+ -- entitlements in the org to cover the difference when you are
+ -- descreasing the number of entitlements.
+ --
+ -- The backend code in Python is expected to do whatever arithmetics
+ -- is needed.
+ -- *******************************************************************
+ procedure activate_channel_entitlement(
+ org_id_in in number,
+ channel_family_label_in in varchar2,
+ quantity_in in number
+ )
+ is
+ prev_ent_count number;
+ prev_ent_count_sum number;
+ cfam_id number;
+ begin
+
+ -- Fetch the current entitlement count for the org
+ -- into prev_ent_count
+ begin
+ select current_members
+ into prev_ent_count
+ from rhnChannelFamily cf,
+ rhnPrivateChannelFamily pcf
+ where pcf.org_id = org_id_in
+ and pcf.channel_family_id = cf.id
+ and cf.label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ prev_ent_count := 0;
+ end;
+
+ begin
+ select id
+ into cfam_id
+ from rhnChannelFamily
+ where label = channel_family_label_in;
+ exception
+ when NO_DATA_FOUND then
+ rhn_exception.raise_exception(
+ 'invalid_channel_family');
+ end;
+
+ -- If we're setting the total entitlemnt count to a lower value,
+ -- and that value is less than the count in that one org,
+ -- we need to raise an exception.
+ if quantity_in < prev_ent_count then
+ rhn_exception.raise_exception(
+ 'not_enough_entitlements_in_base_org');
+ else
+ rhn_entitlements.set_family_count(org_id_in,
+ cfam_id,
+ quantity_in);
+ end if;
+
+ end activate_channel_entitlement;
+
+
+ procedure set_group_count (
+ customer_id_in in number,
+ type_in in char,
+ group_type_in in number,
+ quantity_in in number
+ ) is
+ group_id number;
+ quantity number;
+ begin
+ quantity := quantity_in;
+ if quantity is not null and quantity < 0 then
+ quantity := 0;
+ end if;
+
+ if type_in = 'U' then
+ select rug.id
+ into group_id
+ from rhnUserGroup rug
+ where 1=1
+ and rug.org_id = customer_id_in
+ and rug.group_type = group_type_in;
+ elsif type_in = 'S' then
+ select rsg.id
+ into group_id
+ from rhnServerGroup rsg
+ where 1=1
+ and rsg.org_id = customer_id_in
+ and rsg.group_type = group_type_in;
+ end if;
+
+ rhn_entitlements.prune_group(
+ group_id,
+ type_in,
+ quantity
+ );
+ exception
+ when no_data_found then
+ if type_in = 'U' then
+ insert into rhnUserGroup (
+ id, name, description, max_members, current_members,
+ group_type, org_id, created, modified
+ ) (
+ select rhn_user_group_id_seq.nextval, name, name,
+ quantity, 0, id, customer_id_in,
+ sysdate, sysdate
+ from rhnUserGroupType
+ where id = group_type_in
+ );
+ elsif type_in = 'S' then
+ insert into rhnServerGroup (
+ id, name, description, max_members, current_members,
+ group_type, org_id, created, modified
+ ) (
+ select rhn_server_group_id_seq.nextval, name, name,
+ quantity, 0, id, customer_id_in,
+ sysdate, sysdate
+ from rhnServerGroupType
+ where id = group_type_in
+ );
+ end if;
+ end set_group_count;
+
+ -- *******************************************************************
+ -- PROCEDURE: prune_family
+ -- Unsubscribes servers consuming physical slots from the channel family
+ -- that are over the org's limit.
+ -- Called by: set_family_count, prune_everything
+ -- *******************************************************************
+ procedure prune_family (
+ customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number
+ ) is
+ cursor serverchannels is
+ select sc.server_id,
+ sc.channel_id
+ from rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where 1=1
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and server_id in (
+ select server_id
+ from (
+ select server_id,
+ time,
+ rownum row_number
+ from (
+ select rs.id server_id,
+ rcfm.modified time
+ from
+ rhnServerChannel rsc,
+ rhnChannelFamilyMembers rcfm,
+ rhnServer rs
+ where 1=1
+ and rs.org_id = customer_id_in
+ and rs.id = rsc.server_id
+ and rsc.channel_id = rcfm.channel_id
+ and rcfm.channel_family_id =
+ channel_family_id_in
+ -- we only want to grab servers consuming
+ -- physical slots.
+ and exists (
+ select 1
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.server_id = rs.id
+ and cfsp.channel_family_id =
+ channel_family_id_in
+ )
+ order by time asc
+ )
+ )
+ where row_number > quantity_in
+ );
+ begin
+ -- if we get a null customer_id, this is completely bogus.
+ if customer_id_in is null then
+ return;
+ end if;
+
+ update rhnPrivateChannelFamily
+ set max_members = quantity_in
+ where 1=1
+ and org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+
+ for sc in serverchannels loop
+ rhn_channel.unsubscribe_server(sc.server_id, sc.channel_id, 1, 1);
+ end loop;
+ end prune_family;
+
+ procedure set_family_count (
+ customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number
+ ) is
+ cursor privperms is
+ select 1
+ from rhnPrivateChannelFamily
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+ cursor pubperms is
+ select o.id org_id
+ from web_customer o,
+ rhnPublicChannelFamily pcf
+ where pcf.channel_family_id = channel_family_id_in;
+ quantity number;
+ done number := 0;
+ begin
+ quantity := quantity_in;
+ if quantity is not null and quantity < 0 then
+ quantity := 0;
+ end if;
+
+ if customer_id_in is not null then
+ for perm in privperms loop
+ rhn_entitlements.prune_family(
+ customer_id_in,
+ channel_family_id_in,
+ quantity
+ );
+ update rhnPrivateChannelFamily
+ set max_members = quantity
+ where org_id = customer_id_in
+ and channel_family_id = channel_family_id_in;
+ return;
+ end loop;
+
+ insert into rhnPrivateChannelFamily (
+ channel_family_id, org_id, max_members, current_members
+ ) values (
+ channel_family_id_in, customer_id_in, quantity, 0
+ );
+ return;
+ end if;
+
+ for perm in pubperms loop
+ if quantity = 0 then
+ rhn_entitlements.prune_family(
+ perm.org_id,
+ channel_family_id_in,
+ quantity
+ );
+ if done = 0 then
+ delete from rhnPublicChannelFamily
+ where channel_family_id = channel_family_id_in;
+ end if;
+ end if;
+ done := 1;
+ end loop;
+ -- if done's not 1, then we don't have any entitlements
+ if done != 1 then
+ insert into rhnPublicChannelFamily (
+ channel_family_id
+ ) values (
+ channel_family_id_in
+ );
+ end if;
+ end set_family_count;
+
+ -- this expects quantity_in to be the number of available slots, not the
+ -- max_members of the server group. If you give it too many, it'll fail
+ -- and raise servergroup_max_members.
+ -- We should NEVER run this unless we're SURE that we won't
+ -- be violating the max.
+ procedure entitle_last_modified_servers (
+ customer_id_in in number,
+ type_label_in in varchar2,
+ quantity_in in number
+ ) is
+ -- find the servers that aren't currently in slots
+ cursor servers(cid_in in number, quant_in in number) is
+ select server_id
+ from (
+ select rownum row_number,
+ server_id
+ from (
+ select rs.id server_iD
+ from rhnServer rs
+ where 1=1
+ and rs.org_id = cid_in
+ and not exists (
+ select 1
+ from rhnServerGroup sg,
+ rhnServerGroupMembers rsgm
+ where rsgm.server_id = rs.id
+ and rsgm.server_group_id = sg.id
+ and sg.group_type is not null
+ )
+ and not exists (
+ select 1
+ from rhnVirtualInstance vi
+ where vi.virtual_system_id =
+ rs.id
+ ) order by modified desc
+ )
+ )
+ where row_number <= quant_in;
+ begin
+ for server in servers(customer_id_in, quantity_in) loop
+ rhn_entitlements.entitle_server(server.server_id, type_label_in);
+ end loop;
+ end entitle_last_modified_servers;
+
+ procedure prune_everything (
+ customer_id_in in number
+ ) is
+ cursor everything is
+ -- all our server groups
+ select sg.id id,
+ 'S' type,
+ sg.max_members quantity
+ from rhnServerGroup sg
+ where sg.org_id = customer_id_in
+ union
+ -- all our user groups
+ select ug.id id,
+ 'U' type,
+ ug.max_members quantity
+ from rhnUserGroup ug
+ where ug.org_id = customer_id_in
+ union (
+ -- all the channel families we have perms to
+ select cfp.channel_family_id id,
+ 'C' type,
+ cfp.max_members quantity
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = customer_id_in
+ union
+ -- plus all the ones we're using that we have no perms for
+ select cfm.channel_family_id id,
+ 'C' type,
+ 0 quantity
+ from rhnChannelFamily cf,
+ rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnServer s
+ where s.org_id = customer_id_in
+ and s.id = sc.server_id
+ and sc.channel_id = cfm.channel_id
+ and cfm.channel_family_id = cf.id
+ and cf.org_id is not null
+ and cf.org_id != customer_id_in
+ and not exists (
+ select 1
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = customer_id_in
+ and cfp.channel_family_id = cfm.channel_family_id
+ )
+ );
+ begin
+ for one in everything loop
+ if one.type in ('U','S') then
+ prune_group(one.id, one.type, one.quantity);
+ else
+ prune_family(customer_id_in, one.id, one.quantity);
+ end if;
+ end loop;
+ end prune_everything;
+
+ procedure subscribe_newest_servers (
+ customer_id_in in number
+ ) is
+ -- find servers without base channels
+ cursor servers(cid_in in number) is
+ select s.id
+ from rhnServer s
+ where 1=1
+ and s.org_id = cid_in
+ and not exists (
+ select 1
+ from rhnChannel c,
+ rhnServerChannel sc
+ where sc.server_id = s.id
+ and sc.channel_id = c.id
+ and c.parent_channel is null
+ )
+ and not exists (
+ select 1
+ from rhnVirtualInstance vi
+ where vi.virtual_system_id = s.id
+ )
+ order by s.modified desc;
+ channel_id number;
+ begin
+ for server in servers(customer_id_in) loop
+ channel_id := rhn_channel.guess_server_base(server.id);
+ if channel_id is not null then
+ begin
+ rhn_channel.subscribe_server(server.id, channel_id);
+ commit;
+ -- exception is really channel_family_no_subscriptions
+ exception
+ when others then
+ null;
+ end;
+ end if;
+ end loop;
+ end subscribe_newest_servers;
+end rhn_entitlements;
+/
+show errors
+
+--
+-- $Log$
+-- Revision 1.56 2004/07/21 21:27:36 nhansen
+-- bug 128196: use rhn_monitor instead of rhn_monitoring as the rhnOrgEntitlementType
+--
+-- Revision 1.55 2004/07/20 15:38:57 pjones
+-- bugzilla: 128196 -- make entitling "monitoring" work.
+--
+-- Revision 1.54 2004/07/14 19:13:13 pjones
+-- bugzilla: 126461 -- entitlement changes for new user roles
+--
+-- Revision 1.53 2004/07/02 19:18:20 pjones
+-- bugzilla: 125937 -- use rhn_user to remove user roles
+--
+-- Revision 1.52 2004/05/26 19:45:48 pjones
+-- bugzilla: 123639
+-- 1) reformat "entitlement_grants_service"
+-- 2) make the .pks and .pkb be in the same order.
+-- 3) add "modify_org_service" (to be used instead of set_customer_SERVICELEVEL)
+-- 4) add monitoring specific data.
+--
+-- Revision 1.51 2004/04/19 18:18:51 pjones
+-- bugzilla: none -- misa's using set_family_count() to set null org entitlements
+--
+-- Revision 1.50 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.49 2004/03/26 16:53:42 pjones
+-- bugzilla: none -- make rhn_nonlinux give config_admin too on sat.
+--
+-- Revision 1.48 2004/03/25 22:29:56 pjones
+-- bugzilla: none -- only create config_admin in set_customer_prov if we're
+-- on a satellite
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/206-rhn_org.pks.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/206-rhn_org.pks.sql
new file mode 100644
index 0000000..fc2d020
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/206-rhn_org.pks.sql
@@ -0,0 +1,55 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE rhn_org
+IS
+ version varchar2(100) := '$Id$';
+
+ CURSOR server_group_by_label(org_id_in NUMBER, group_label_in VARCHAR2) IS
+ SELECT SG.*
+ FROM rhnServerGroupType SGT,
+ rhnServerGroup SG
+ WHERE SG.group_type = SGT.id
+ AND SGT.label = group_label_in
+ AND SG.org_id = org_id_in;
+
+ FUNCTION find_server_group_by_type(org_id_in NUMBER,
+ group_label_in VARCHAR2)
+ RETURN NUMBER;
+
+ procedure delete_org(org_id_in in number);
+ procedure delete_user(user_id_in in number, deleting_org in number := 0);
+
+END rhn_org;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.7 2004/07/13 22:46:04 pjones
+-- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
+--
+-- Revision 1.6 2004/02/10 15:05:01 pjones
+-- bugzilla: none -- add version tag here
+--
+-- Revision 1.5 2003/02/18 16:35:45 pjones
+-- delete_user
+--
+-- Revision 1.4 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/207-rhn_org.pkb.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/207-rhn_org.pkb.sql
new file mode 100644
index 0000000..a6ee578
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/207-rhn_org.pkb.sql
@@ -0,0 +1,304 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_org
+IS
+ body_version varchar2(100) := '$Id$';
+
+ FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
+ RETURN NUMBER
+ IS
+ server_group server_group_by_label%ROWTYPE;
+ BEGIN
+ OPEN server_group_by_label(org_id_in, group_label_in);
+ FETCH server_group_by_label INTO server_group;
+ CLOSE server_group_by_label;
+
+ RETURN server_group.id;
+ END find_server_group_by_type;
+
+ procedure delete_org (
+ org_id_in in number
+ )
+ is
+
+ cursor users is
+ select id
+ from web_contact
+ where org_id = org_id_in;
+
+ cursor servers(org_id_in in number) is
+ select id
+ from rhnServer
+ where org_id = org_id_in;
+
+ cursor config_channels is
+ select id
+ from rhnConfigChannel
+ where org_id = org_id_in;
+
+ begin
+
+ if org_id_in = 1 then
+ rhn_exception.raise_exception('cannot_delete_base_org');
+ end if;
+
+ -- Delete all users.
+ for u in users loop
+ rhn_org.delete_user(u.id, 1);
+ end loop;
+
+ -- Delete all servers.
+ for s in servers(org_id_in) loop
+ delete_server(s.id);
+ end loop;
+
+ -- Delete all config channels.
+ for c in config_channels loop
+ rhn_config.delete_channel(c.id);
+ end loop;
+
+ -- Give the org's entitlements back to the main org.
+ rhn_entitlements.remove_org_entitlements(org_id_in);
+
+ -- Clean up tables where we don't have a cascading delete.
+ delete from rhnChannel where org_id = org_id_in;
+ delete from rhnDailySummaryQueue where org_id = org_id_in;
+ delete from rhnOrgQuota where org_id = org_id_in;
+ delete from rhnOrgInfo where org_id = org_id_in;
+ delete from rhnFileList where org_id = org_id_in;
+ delete from rhnServerGroup where org_id = org_id_in;
+ delete from rhn_check_suites where customer_id = org_id_in;
+ delete from rhn_command_target where customer_id = org_id_in;
+ delete from rhn_contact_groups where customer_id = org_id_in;
+ delete from rhn_notification_formats where customer_id = org_id_in;
+ delete from rhn_probe where customer_id = org_id_in;
+ delete from rhn_redirects where customer_id = org_id_in;
+ delete from rhn_sat_cluster where customer_id = org_id_in;
+ delete from rhn_schedules where customer_id = org_id_in;
+
+ -- Delete the org.
+ delete from web_customer where id = org_id_in;
+
+ end delete_org;
+
+ procedure delete_user(user_id_in in number, deleting_org in number := 0) is
+ cursor is_admin is
+ select 1
+ from rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin';
+ cursor servergroups_needing_admins is
+ select usgp.server_group_id server_group_id
+ from rhnUserServerGroupPerms usgp
+ where 1=1
+ and usgp.user_id = user_id_in
+ and not exists (
+ select 1
+ from rhnUserServerGroupPerms sq_usgp
+ where 1=1
+ and sq_usgp.server_group_id = usgp.server_group_id
+ and sq_usgp.user_id != user_id_in
+ );
+ cursor messages is
+ select message_id id
+ from rhnUserMessage
+ where user_id = user_id_in;
+ users number;
+ our_org_id number;
+ other_users number;
+ other_org_admin number;
+ other_user_id number;
+ begin
+ select wc.org_id
+ into our_org_id
+ from web_contact wc
+ where id = user_id_in;
+
+ -- find any other users
+ begin
+ select id, 1
+ into other_user_id, other_users
+ from web_contact
+ where 1=1
+ and org_id = our_org_id
+ and id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ other_users := 0;
+ end;
+
+ -- now do org admin stuff
+ if other_users != 0 then
+ for ignore in is_admin loop
+ begin
+ select new_ugm.user_id
+ into other_org_admin
+ from rhnUserGroupMembers new_ugm,
+ rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin'
+ and ug.id = new_ugm.user_group_id
+ and new_ugm.user_id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ -- If we're deleting the org, we don't want to raise
+ -- the exception.
+ if deleting_org = 0 then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end if;
+ end;
+
+ for sg in servergroups_needing_admins loop
+ rhn_user.add_servergroup_perm(other_org_admin,
+ sg.server_group_id);
+ end loop;
+ end loop;
+ end if;
+
+ -- and now things for every user
+ for message in messages loop
+ delete
+ from rhnUserMessage
+ where user_id = user_id_in
+ and message_id = message.id;
+ begin
+ select 1
+ into users
+ from rhnUserMessage
+ where message_id = message.id
+ and rownum = 1;
+ delete
+ from rhnMessage
+ where id = message.id;
+ exception
+ when no_data_found then
+ null;
+ end;
+ end loop;
+ delete from rhn_command_queue_sessions where contact_id = user_id_in;
+ delete from rhn_contact_methods where contact_id = user_id_in;
+ delete from rhn_redirects where contact_id = user_id_in;
+ delete from rhnUserServerPerms where user_id = user_id_in;
+ if other_users != 0 then
+ update rhnRegToken
+ set user_id = nvl(other_org_admin, other_user_id)
+ where org_id = our_org_id
+ and user_id = user_id_in;
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ -- Just Delete the user
+ else
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ end if;
+ return;
+ end delete_user;
+
+END rhn_org;
+/
+SHOW ERRORS
+
+-- $Log$
+-- Revision 1.22 2004/10/29 04:50:49 pjones
+-- bugzilla: 135179 -- fix org admin swapping during user deletion
+--
+-- Revision 1.21 2004/07/13 22:46:04 pjones
+-- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
+--
+-- Revision 1.20 2004/07/02 22:24:38 pjones
+-- bugzilla: none -- typo fix
+--
+-- Revision 1.19 2004/07/02 19:19:02 pjones
+-- bugzilla: 125937 -- use rhn_user to grant roles to users
+--
+-- Revision 1.18 2004/05/28 22:21:36 pjones
+-- bugzilla: none -- update for monitoring schema
+--
+-- Revision 1.17 2004/04/05 16:31:07 pjones
+-- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
+-- has a cascade problem
+--
+-- Revision 1.16 2004/03/15 17:10:28 pjones
+-- bugzilla: 118244 -- delete servers explicitly while deleting lone users
+--
+-- Revision 1.15 2004/02/09 17:14:54 pjones
+-- bugzilla: none -- fix log garbage
+--
+-- Revision 1.14 2004/01/22 19:44:42 pjones
+-- bugzilla: 106562 -- fix exceptions on delete_user()
+--
+-- Revision 1.13 2004/01/20 17:00:48 pjones
+-- bugzilla: none -- try to make delete_user() succeed when there are
+-- server groups that have been snapshotted
+--
+-- Revision 1.12 2004/01/14 20:22:03 pjones
+-- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
+--
+-- Revision 1.11 2003/03/20 17:08:16 pjones
+-- avoid the server group members trigger that updates last_modified; it'll
+-- cause a mutating table error
+--
+-- Revision 1.10 2003/03/17 16:31:25 pjones
+-- use "on delete set null" where applicable
+--
+-- Revision 1.9 2003/03/15 00:31:07 pjones
+-- bugzilla: none
+--
+-- tested wrong table for perms on a server group
+--
+-- Revision 1.8 2003/03/15 00:23:36 pjones
+-- bugzilla: 83631
+--
+-- working delete_user
+--
+-- Revision 1.7 2003/03/03 23:39:36 pjones
+-- different delete_user; this one might actually work.
+--
+-- Takes about 18 seconds, which seems kindof slow, but isn't
+-- intolerable I don't think...
+--
+-- Revision 1.6 2003/03/02 18:07:00 pjones
+-- make it use marty's test instead of is_satellite(); in the sat env,
+-- marty's test _is_ is_satellite()
+--
+-- Revision 1.5 2003/02/18 16:35:45 pjones
+-- delete_user
+--
+-- Revision 1.4 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pkb.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pkb.sql
new file mode 100644
index 0000000..5969a5c
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pkb.sql
@@ -0,0 +1,308 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace
+package body rhn_user
+is
+ body_version varchar2(100) := '$Id$';
+
+ function check_role(user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnUserGroupType UGT,
+ rhnUserGroup UG,
+ rhnUserGroupMembers UGM
+ where UGM.user_id = user_id_in
+ and UGM.user_group_id = UG.id
+ and UG.group_type = UGT.id
+ and UGT.label = role_in;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end check_role;
+
+ function check_role_implied(user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- if the user directly has the role, they win
+ if rhn_user.check_role(user_id_in, role_in) = 1
+ then
+ return 1;
+ end if;
+
+ -- config_admin and channel_admin are automatically implied for org admins
+ if role_in = 'config_admin' and rhn_user.check_role(user_id_in, 'org_admin') = 1
+ then
+ return 1;
+ end if;
+
+ if role_in = 'channel_admin' and rhn_user.check_role(user_id_in, 'org_admin') = 1
+ then
+ return 1;
+ end if;
+
+ return 0;
+ end check_role_implied;
+
+ function get_org_id(user_id_in in number)
+ return number
+ is
+ org_id_out number;
+ begin
+ select org_id into org_id_out
+ from web_contact
+ where id = user_id_in;
+
+ return org_id_out;
+ end get_org_id;
+
+ -- paid users often don't have verified email addresses, so
+ -- try to find an address that is useful to us.
+ function find_mailable_address(user_id_in in number)
+ return varchar2 is
+ PRAGMA AUTONOMOUS_TRANSACTION;
+ -- this would be so much prettier if we just had an order built
+ -- into rhnEmailAddressState
+ cursor addrs is
+ select ea.state_id, ea.address
+ from rhnEmailAddressState eas,
+ rhnEmailAddress ea
+ where ea.user_id = user_id_in
+ and eas.label = 'verified'
+ and ea.state_id = eas.id
+ union all
+ select ea.state_id, ea.address
+ from rhnEmailAddressState eas,
+ rhnEmailAddress ea
+ where ea.user_id = user_id_in
+ and eas.label = 'unverified'
+ and ea.state_id = eas.id
+ union all
+ select ea.state_id, ea.address
+ from rhnEmailAddressState eas,
+ rhnEmailAddress ea
+ where ea.user_id = user_id_in
+ and eas.label = 'pending'
+ and ea.state_id = eas.id
+ union all
+ select ea.state_id, ea.address
+ from rhnEmailAddressState eas,
+ rhnEmailAddress ea
+ where ea.user_id = user_id_in
+ and eas.label = 'pending_warned'
+ and ea.state_id = eas.id
+ union all
+ select ea.state_id, ea.address
+ from rhnEmailAddressState eas,
+ rhnEmailAddress ea
+ where ea.user_id = user_id_in
+ and eas.label = 'needs_verifying'
+ and ea.state_id = eas.id
+ union all
+ select -1 state_id,
+ email address
+ from web_user_personal_info
+ where web_user_id = user_id_in;
+ retval rhnEmailAddress.address%TYPE;
+ begin
+ for addr in addrs loop
+ retval := addr.address;
+ if addr.address is null then
+ update web_user_contact_permission
+ set email = 'N'
+ where web_user_id = user_id_in;
+ commit;
+ return null;
+ end if;
+ if addr.state_id = -1 then
+ insert into rhnEmailAddress (
+ id, address,
+ user_id, state_id
+ ) (
+ select rhn_eaddress_id_seq.nextval, addr.address,
+ user_id_in, eas.id
+ from rhnEmailAddressState eas
+ where eas.label = 'unverified'
+ );
+ end if;
+ commit;
+ return retval;
+ end loop;
+ return null;
+ end;
+
+ procedure add_servergroup_perm(
+ user_id_in in number,
+ server_group_id_in in number
+ ) is
+ cursor orgs_match is
+ select 1
+ from rhnServerGroup sg,
+ web_contact u
+ where u.id = user_id_in
+ and sg.id = server_group_id_in
+ and sg.org_id = u.org_id;
+ begin
+ for okay in orgs_match loop
+ insert into rhnUserServerGroupPerms(user_id, server_group_id)
+ values (user_id_in, server_group_id_in);
+ rhn_cache.update_perms_for_user(user_id_in);
+ return;
+ end loop;
+ rhn_exception.raise_exception('usgp_different_orgs');
+ exception when dup_val_on_index then
+ rhn_exception.raise_exception('usgp_already_allowed');
+ end add_servergroup_perm;
+
+ procedure remove_servergroup_perm(
+ user_id_in in number,
+ server_group_id_in in number
+ ) is
+ cursor perms is
+ select 1
+ from rhnUserServerGroupPerms
+ where user_id = user_id_in
+ and server_group_id = server_group_id_in;
+ begin
+ for perm in perms loop
+ delete from rhnUserServerGroupPerms
+ where user_id = user_id_in
+ and server_group_id = server_group_id_in;
+ rhn_cache.update_perms_for_user(user_id_in);
+ return;
+ end loop;
+ rhn_exception.raise_exception('usgp_not_allowed');
+ end remove_servergroup_perm;
+
+ procedure add_to_usergroup(
+ user_id_in in number,
+ user_group_id_in in number
+ ) is
+ cursor perm_granting_usergroups is
+ select user_group_id_in
+ from rhnUserGroup ug,
+ rhnUserGroupType ugt
+ where ugt.label in ('org_admin') -- and server_group_admin ?
+ and ug.id = user_group_id_in
+ and ug.group_type = ugt.id;
+ begin
+ insert into rhnUserGroupMembers(user_id, user_group_id)
+ values (user_id_in, user_group_id_in);
+
+ for ug in perm_granting_usergroups loop
+ rhn_cache.update_perms_for_user(user_id_in);
+ return;
+ end loop;
+ end add_to_usergroup;
+
+ procedure add_users_to_usergroups(
+ user_id_in in number
+ ) is
+ cursor ugms is
+ select element user_id,
+ element_two user_group_id
+ from rhnSet
+ where user_id = user_id_in
+ and label = 'user_group_list';
+ begin
+ for ugm in ugms loop
+ rhn_user.add_to_usergroup(ugm.user_id, ugm.user_group_id);
+ end loop;
+ end add_users_to_usergroups;
+
+ procedure remove_from_usergroup(
+ user_id_in in number,
+ user_group_id_in in number
+ ) is
+ cursor perm_granting_usergroups is
+ select label
+ from rhnUserGroupType ugt,
+ rhnUserGroupMembers ugm,
+ rhnUserGroup ug
+ where 1=1
+ and ug.id = user_group_id_in
+ and ugm.user_group_id = user_group_id_in
+ and ug.group_type = ugt.id
+ and ugm.user_id = user_id_in;
+ begin
+ -- we only do anything if you're really in the group, because
+ -- testing is significantly cheaper than rebuilding the user's
+ -- cache for no reason.
+ for ug in perm_granting_usergroups loop
+ delete from rhnUserGroupMembers
+ where user_id = user_id_in
+ and user_group_id = user_group_id_in;
+ if ug.label in ('org_admin') then
+ rhn_cache.update_perms_for_user(user_id_in);
+ end if;
+ end loop;
+ end remove_from_usergroup;
+
+ procedure remove_users_from_servergroups(
+ user_id_in in number
+ ) is
+ cursor ugms is
+ select element user_id,
+ element_two user_group_id
+ from rhnSet
+ where user_id = user_id_in
+ and label = 'user_group_list';
+ begin
+ for ugm in ugms loop
+ rhn_user.remove_from_usergroup(ugm.user_id, ugm.user_group_id);
+ end loop;
+ end remove_users_from_servergroups;
+end rhn_user;
+/
+SHOW ERRORS
+
+-- select rhn_user.get_org_id(502474) from dual;
+-- 1271287
+-- select rhn_user.check_role(502474, 'org_admin') from dual;
+-- 1
+-- select rhn_user.check_role(502474, 'org_admin_nope') from dual;
+-- 0, but should later raise an exception
+
+--
+-- $Log$
+-- Revision 1.8 2004/07/12 19:35:51 pjones
+-- bugzilla: 125937 -- we _always_ delete, but only rebuild cache on org_admin.
+--
+-- Revision 1.7 2004/07/02 22:29:36 pjones
+-- bugzilla: none -- typos and spelling errors.
+--
+-- Revision 1.6 2004/07/02 19:16:54 pjones
+-- bugzilla: 125937 -- tools to manipulate rhnServerGroupMembers and
+-- rhnUserGroupMembers
+--
+-- Revision 1.5 2004/03/31 21:09:47 pjones
+-- bugzilla: none -- if the user truly doesn't have any email address, compensate.
+--
+-- Revision 1.4 2004/02/12 20:53:30 pjones
+-- bugzilla: 108212 -- s/get_email_address/find_mailable_address/ and make it
+-- do the same as web's version
+--
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pks.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pks.sql
new file mode 100644
index 0000000..7deee08
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/208-rhn_user.pks.sql
@@ -0,0 +1,64 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create or replace
+package rhn_user
+is
+ version varchar2(100) := '$Id$';
+
+ function check_role(user_id_in in number, role_in in varchar2) return number;
+ PRAGMA RESTRICT_REFERENCES(check_role, WNDS, RNPS, WNPS);
+
+ function check_role_implied(user_id_in in number, role_in in varchar2) return number;
+ PRAGMA RESTRICT_REFERENCES(check_role_implied, WNDS, RNPS, WNPS);
+
+ function get_org_id(user_id_in in number) return number;
+ PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
+
+ function find_mailable_address(user_id_in in number) return varchar2;
+
+ procedure add_servergroup_perm(
+ user_id_in in number,
+ server_group_id_in in number
+ );
+
+ procedure remove_servergroup_perm(
+ user_id_in in number,
+ server_group_id_in in number
+ );
+
+ procedure add_to_usergroup(
+ user_id_in in number,
+ user_group_id_in in number
+ );
+
+ procedure add_users_to_usergroups(
+ user_id_in in number
+ );
+
+ procedure remove_from_usergroup(
+ user_id_in in number,
+ user_group_id_in in number
+ );
+
+ procedure remove_users_from_servergroups(
+ user_id_in in number
+ );
+end rhn_user;
+/
+SHOW ERRORS
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/500-rhnPrivateErrataMail.sql b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/500-rhnPrivateErrataMail.sql
new file mode 100644
index 0000000..51b67f1
--- /dev/null
+++ b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2/500-rhnPrivateErrataMail.sql
@@ -0,0 +1,155 @@
+-- This view is used for extracting data needed by the errata mailer
+-- for private errata mails
+--
+-- $Id$
+
+create or replace view
+rhnPrivateErrataMail
+as
+with rhnSPmaxEVR as (
+ select sq2_sp.server_id, sq2_sp.name_id, max(sq2_pe.evr) max_evr
+ from rhnServerPackage sq2_sp,
+ rhnPackageEVR sq2_pe
+ where sq2_sp.evr_id = sq2_pe.id
+ group by sq2_sp.server_id, sq2_sp.name_id)
+select
+ w.login,
+ w.login_uc,
+ wpi.email,
+ w.id user_id,
+ s.id server_id,
+ -- use sg here so we can start with org and work to errata from there
+ w.org_id org_id,
+ s.name server_name,
+ sa.name server_arch,
+ s.release server_release,
+ ce.errata_id errata_id,
+ e.advisory
+from
+ rhnServer s,
+ web_user_personal_info wpi,
+ rhnUserInfo ui,
+ rhnErrata e,
+ rhnServerArch sa,
+ rhnChannelErrata ce,
+ web_contact w,
+ rhnServerChannel sc,
+ rhnServerGroupMembers sgm,
+ rhnServerGroup sg
+where 1=1
+ -- we plan on starting with org_id, and server group is the
+ -- best place to find that that's near servers
+ and sg.id = sgm.server_group_id
+ and sgm.server_id = sc.server_id
+ -- then find the contacts, because permission checking is next
+ and sg.org_id = w.org_id
+ -- filter out users who don't want mail about this server
+ -- they get an entry if they _don't_ want mail
+ and not exists (
+ select usprefs.server_id
+ from rhnUserServerPrefs usprefs
+ where 1=1
+ and w.id = usprefs.user_id
+ and sc.server_id = usprefs.server_id
+ and usprefs.name = 'receive_notifications'
+ )
+ -- filter out users who don't want/can't get email
+ and w.id = wpi.web_user_id
+ and wpi.email is not null
+ and w.id = ui.user_id
+ and ui.email_notify = 1
+ -- check permissions. For this query being an org admin is the
+ -- most common thing, so we test for that first
+ and exists (
+ select 1
+ from
+ rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where 1=1
+ and ugt.label = 'org_admin'
+ and ugt.id = ug.group_type
+ and ug.id = ugm.user_group_id
+ and ugm.user_id = w.id
+ union all
+ select 1
+ from
+ rhnServerGroupMembers sq_sgm,
+ rhnUserServerGroupPerms usg
+ where sc.server_id = sq_sgm.server_id
+ and sq_sgm.server_group_id = usg.server_group_id
+ and usg.user_id = w.id
+ )
+ -- filter out servers that aren't in useful channels
+ and sc.channel_id = ce.channel_id
+ -- find the server, so we can do s.arch comparisons
+ and sc.server_id = s.id
+ and exists (
+ select 1
+ from
+ rhnPackageEVR p_evr,
+ rhnPackageEVR sp_evr,
+ rhnServerPackage sp,
+ rhnChannelPackage cp,
+ rhnPackage p,
+ rhnErrataPackage ep,
+ rhnServerPackageArchCompat spac
+ where 1=1
+ -- packages from channels this server is subscribed to
+ and sc.channel_id = cp.channel_id
+ and cp.package_id = p.id
+ -- part of an errata
+ and ce.errata_id = ep.errata_id
+ and ep.package_id = p.id
+ -- and that errata maps back to the server channel
+ and sc.channel_id = ce.channel_id
+ and ce.errata_id = ep.errata_id
+ -- also installed on this server
+ and sc.server_id = sp.server_id
+ and sp.name_id = p.name_id
+ and sp.evr_id = sp_evr.id
+ -- different evr
+ and p.evr_id = p_evr.id
+ and sp.evr_id != p.evr_id
+ -- and newer evr
+ and sp_evr.evr < p_evr.evr
+ and sp_evr.evr = (
+ select max_evr from rhnSPmaxEVR rsme
+ where sp.server_id = rsme.server_id
+ and sp.name_id = rsme.name_id
+ )
+ -- compat arch
+ and p.package_arch_id = spac.package_arch_id
+ and s.server_arch_id = spac.server_arch_id
+ )
+ -- below here isn't needed except for output
+ and s.server_arch_id = sa.id
+ and ce.errata_id = e.id
+ and not exists ( select 1
+ from rhnWebContactDisabled wcd
+ where wcd.id = w.id )
+/
+
+
+--select count(*) from rhnMailErrataView
+--where org_id = 1 and errata_id = 916;
+
+-- $Log$
+-- Revision 1.2 2003/02/21 20:56:00 pjones
+-- change the comments to match the code ;)
+--
+-- Revision 1.1 2003/02/21 20:45:00 pjones
+-- private errata mail
+--
+-- Revision 1.4 2003/02/12 18:49:11 pjones
+-- note about old errata
+--
+-- Revision 1.3 2002/11/14 17:20:34 pjones
+-- arch -> *_arch_id and archCompat changes
+--
+-- Revision 1.2 2002/11/11 20:49:46 pjones
+-- that line's a typo
+--
+-- Revision 1.1 2002/09/24 22:42:17 pjones
+-- free vs paid
+--
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/001-rhnServerArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/001-rhnServerArch_data-solaris-sun4v.sql
deleted file mode 100644
index 03024f7..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/001-rhnServerArch_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-insert into rhnServerArch (id, label, name, arch_type_id) (
- select rhn_server_arch_id_seq.nextval,
- 'sparc-sun4v-solaris',
- 'Sparc Solaris',
- lookup_arch_type('sysv-solaris')
- from dual
- where not exists (
- select label, name, arch_type_id
- from rhnServerArch
- where label = 'sparc-sun4v-solaris' and
- name = 'Sparc Solaris' and
- arch_type_id = lookup_arch_type('sysv-solaris'))
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/002-rhnPackageArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/002-rhnPackageArch_data-solaris-sun4v.sql
deleted file mode 100644
index 14a70ac..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/002-rhnPackageArch_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-insert into rhnPackageArch (id, label, name, arch_type_id) (
- select rhn_package_arch_id_seq.nextval,
- 'sparc.sun4v-solaris',
- 'Sparc Solaris sun4v',
- lookup_arch_type('sysv-solaris')
- from dual
- where not exists (
- select id, label, name, arch_type_id
- from rhnPackageArch
- where label = 'sparc.sun4v-solaris' and
- name = 'Sparc Solaris sun4v'and
- arch_type_id = lookup_arch_type('sysv-solaris'))
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql
deleted file mode 100644
index d5cf7f1..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/003-rhnChannelPackageArchCompat_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-insert into rhnChannelPackageArchCompat (channel_arch_id, package_arch_id) (
- select lookup_channel_arch('channel-sparc-sun-solaris'),
- lookup_package_arch('sparc.sun4v-solaris')
- from dual
- where not exists (
- select channel_arch_id, package_arch_id
- from rhnChannelPackageArchCompat
- where channel_arch_id = lookup_channel_arch('channel-sparc-sun-solaris') and
- package_arch_id = lookup_package_arch('sparc.sun4v-solaris')
- )
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/004-rhnCpuArch_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/004-rhnCpuArch_data-solaris-sun4v.sql
deleted file mode 100644
index 2ceadc0..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/004-rhnCpuArch_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-insert into rhnCpuArch (id, label, name) (
- select rhn_cpu_arch_id_seq.nextval,
- 'sun4v',
- 'sun4v'
- from dual
- where not exists (
- select label, name
- from rhnCpuArch
- where label = 'sun4v' and
- name = 'sun4v')
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql
deleted file mode 100644
index f990c26..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/005-rhnServerChannelArchCompat_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-insert into rhnServerChannelArchCompat (server_arch_id, channel_arch_id) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_channel_arch('channel-sparc-sun-solaris')
- from dual
- where not exists (
- select server_arch_id, channel_arch_id
- from rhnServerChannelArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- channel_arch_id = lookup_channel_arch('channel-sparc-sun-solaris')
- )
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql
deleted file mode 100644
index 289f28c..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/006-rhnServerPackageArchCompat_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,33 +0,0 @@
-update rhnServerPackageArchCompat
-set preference = 710
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris-patch-cluster');
-
-update rhnServerPackageArchCompat
-set preference = 610
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris-patch');
-
-update rhnServerPackageArchCompat
-set preference = 510
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('noarch-solaris');
-
-update rhnServerPackageArchCompat
-set preference = 410
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris-patch-cluster');
-
-update rhnServerPackageArchCompat
-set preference = 310
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris-patch');
-
-update rhnServerPackageArchCompat
-set preference = 210
-where server_arch_id = LOOKUP_SERVER_ARCH('sparc-sun4m-solaris')
- and package_arch_id = LOOKUP_PACKAGE_ARCH('sparc-solaris');
-
-insert into rhnServerPackageArchCompat
-(server_arch_id, package_arch_id, preference) values
-(LOOKUP_SERVER_ARCH('sparc-sun4m-solaris'), LOOKUP_PACKAGE_ARCH('sparc.sun4v-solaris'), 100);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql
deleted file mode 100644
index d78834a..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/007-rhnServerPackageArchCompat_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,94 +0,0 @@
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'), lookup_package_arch('sparc.sun4v-solaris'), 10
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('sparc.sun4v-solaris') and
- preference = 10)
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('sparc-solaris'),
- 100
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('sparc-solaris') and
- preference = 100
- )
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('sparc-solaris-patch'),
- 210
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('sparc-solaris-patch') and
- preference = 210
- )
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('sparc-solaris-patch-cluster'),
- 310
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('sparc-solaris-patch-cluster') and
- preference = 310
- )
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('noarch-solaris'),
- 410
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('noarch-solaris') and
- preference = 410
- )
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('noarch-solaris-patch'),
- 510
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('noarch-solaris-patch') and
- preference = 510
- )
-);
-
-insert into rhnServerPackageArchCompat (server_arch_id, package_arch_id, preference) (
- select lookup_server_arch('sparc-sun4v-solaris'),
- lookup_package_arch('noarch-solaris-patch-cluster'),
- 610
- from dual
- where not exists (
- select server_arch_id, package_arch_id, preference
- from rhnServerPackageArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- package_arch_id = lookup_package_arch('noarch-solaris-patch-cluster') and
- preference = 610
- )
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql
deleted file mode 100644
index aa5447f..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/008-rhnServerServerGroupArchCompat_data-solaris-sun4v.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-insert into rhnServerServerGroupArchCompat (server_arch_id, server_group_type) (
- select lookup_server_arch('sparc-sun4v-solaris'), lookup_sg_type('enterprise_entitled')
- from dual
- where not exists (
- select server_arch_id,
- server_group_type
- from rhnServerServerGroupArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- server_group_type = lookup_sg_type('enterprise_entitled')
- )
-);
-
-insert into rhnServerServerGroupArchCompat (server_arch_id, server_group_type) (
- select lookup_server_arch('sparc-sun4v-solaris'), lookup_sg_type('provisioning_entitled')
- from dual
- where not exists (
- select server_arch_id,
- server_group_type
- from rhnServerServerGroupArchCompat
- where server_arch_id = lookup_server_arch('sparc-sun4v-solaris') and
- server_group_type = lookup_sg_type('provisioning_entitled')
- )
-);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql
deleted file mode 100644
index 24e8cd4..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/009-rhnServerPackageArchCompat_data-solaris-sun4u.sql
+++ /dev/null
@@ -1,11 +0,0 @@
-insert into rhnServerPackageArchCompat
-(server_arch_id, package_arch_id, preference) values
-(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris'), 410);
-
-insert into rhnServerPackageArchCompat
-(server_arch_id, package_arch_id, preference) values
-(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris-patch'), 510);
-
-insert into rhnServerPackageArchCompat
-(server_arch_id, package_arch_id, preference) values
-(LOOKUP_SERVER_ARCH('sparc-sun4u-solaris'), LOOKUP_PACKAGE_ARCH('noarch-solaris-patch-cluster'), 610);
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/010-rhnKSInstallType_data-fedora_9.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/010-rhnKSInstallType_data-fedora_9.sql
deleted file mode 100644
index 1f95d1f..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/010-rhnKSInstallType_data-fedora_9.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-insert into rhnKSInstallType (id, label, name)
- values (rhn_ksinstalltype_id_seq.nextval,
- 'fedora_9','Fedora 9'
- );
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/011-rhnKickstartCommandName_data-fedora_9.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/011-rhnKickstartCommandName_data-fedora_9.sql
deleted file mode 100644
index 696db8e..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/011-rhnKickstartCommandName_data-fedora_9.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-update rhnKickstartCommandName
-set required = 'N'
-where name = 'langsupport';
-
-update rhnKickstartCommandName
-set required = 'N'
-where name = 'mouse';
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/012-rhnTemplateString_data-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/012-rhnTemplateString_data-strings.sql
deleted file mode 100644
index ec30e28..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/012-rhnTemplateString_data-strings.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-
-update rhnTemplateString
-set description = 'Footer for Spacewalk e-mail'
-where label = 'email_footer';
-
-update rhnTemplateString
-set value = '
-Account Information:
- Your Spacewalk login: <login />
- Your Spacewalk email address: <email-address />',
-description = 'Account info lines for Spacewalk e-mail'
-where label = 'email_account_info';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/014-remove-db_change-tables.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/014-remove-db_change-tables.sql
deleted file mode 100644
index bf030a0..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/014-remove-db_change-tables.sql
+++ /dev/null
@@ -1,14 +0,0 @@
-
-drop table db_change_history cascade constraints;
-drop table db_change_history_output cascade constraints;
-drop table db_change_ignore_errs cascade constraints;
-drop table db_change_lock cascade constraints;
-drop table db_change_resource_changes cascade constraints;
-drop table db_change_resource_names cascade constraints;
-drop table db_change_resource_types cascade constraints;
-drop table db_change_resources cascade constraints;
-drop table db_change_script cascade constraints;
-drop table db_change_script_expanded cascade constraints;
-drop table db_change_script_parsed cascade constraints;
-drop table db_change_script_source cascade constraints;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-1-rhnActionType-name.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-1-rhnActionType-name.sql
deleted file mode 100644
index 19ea516..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-1-rhnActionType-name.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter table rhnActionType
-modify name varchar2(100);
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-2-rhnActionType-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-2-rhnActionType-strings.sql
deleted file mode 100644
index d379fc2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/020-2-rhnActionType-strings.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-
-update rhnActionType
-set name = 'Spacewalk Daemon Configuration'
-where label = 'rhnsd.configure';
-
-update rhnActionType
-set name = 'Allows for rhn-applet use with an Spacewalk'
-where label = 'rhn_applet.use_satellite';
-
-update rhnActionType
-set name = 'Subscribes a server to the Spacewalk Tools channel associated with its base channel.'
-where label = 'kickstart_host.add_tools_channel';
-
-update rhnActionType
-set name = 'Subscribes a virtualization guest to the Spacewalk Tools channel associated with its base channel.'
-where label = 'kickstart_guest.add_tools_channel';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/021-rhnFAQClass-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/021-rhnFAQClass-strings.sql
deleted file mode 100644
index 89e69f3..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/021-rhnFAQClass-strings.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update RHNFAQCLASS
-set name = 'Using Spacewalk'
-where label = 'using_rhn';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/022-rhnFAQ-purge.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/022-rhnFAQ-purge.sql
deleted file mode 100644
index 8da8dd2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/022-rhnFAQ-purge.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-delete from RHNFAQ;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/023-rhnFAQ_satdata.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/023-rhnFAQ_satdata.sql
deleted file mode 100644
index b48f345..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/023-rhnFAQ_satdata.sql
+++ /dev/null
@@ -1,760 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
--- $Id$
---
--- EXCLUDE: production
-
--- data for rhnFAQ in the satellite case
-
-SET SQLBLANKLINES ON
-SET SCAN OFF
-
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-64, 'pvt: This message is being forwarded to customerservice(a)redhat.com', 'This message has been forwarded to customerservice(a)redhat.com. That group handles all billing and purchasing related questions.'
-, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/12/2003 10:18:24 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 22, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-65, 'I''m having trouble registering my Red Hat Enterprise Linux product. Why?', 'Enterprise entitlements are required for use with Red Hat Enterprise Linux.
-
-A customer who registers an Enterprise Linux system with Spacewalk without having any Enterprise Linux entitlements will receive an error message similar to:
-
-"No public channels available for ("2.1AS'', ''i686'')"
-
-In order to register your system, you first need to activate your Spacewalk Enterprise Linux entitlements at:
-
-http://www.redhat.com/support
-
-Use the product ID that came with your Red Hat Enterprise Linux product.
-'
-, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 13, 7);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-66, 'pvt: I bought service with Spacewalk, but it won''t let me use Priority FTP access. Why not?vp'
-, 'Instant ISO access is not the same as Priority FTP access; they are separate entities. Customers who purchase Spacewalk service have Instant ISO access only. Priority FTP access is available only to legacy users, and is in the process of being phased out.
-'
-, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 09:34:56 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 6, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-67, 'How do I register a system for Spacewalk service on Red Hat Linux?', 'To register a system for Spacewalk service on Red Hat Linux please run "rhn_register". Refer to the Spacewalk User Guide (also available through the Help link at the Spacewalk website) for additional instructions.
-
-Note: for Red Hat Linux 8.0 and later, please run "up2date --register" instead of "rhn_register".
-'
-, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:09:30 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 19, 3);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-25, 'The Spacewalk website and up2date do not agree on what errata is needed for my system.'
-, 'You can refresh the profile package list by running "up2date -p" on the machine itself. Alternatively, you can schedule this from the website by clicking on the system in the System List, choosing the Packages tab, and then clicking on the "Update Package List" button at the bottom of the page.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/14/2003 09:24:01 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 10, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-26, 'I had to re-install my system. How do I re-register and get my entitlement back?'
-, 'You''ll need to re-register the client system if you haven''t already, and then move an entitlement to the new profile.
-
-* Log into our website at: https://rhn.redhat.com.
-* Click on "Systems" in the top navigation bar, then the name of the old system in the System List.
-* Click "delete system" on the top-right corner of the page.
-* As root at the command line, delete the file /etc/sysconfig/rhn/systemid from your system.
-* Run "rhn_register" (Red Hat Linux 7.x) or "up2date --register" (Red Hat Linux 8.0 and newer) on your system.
-* Once the system is registered, log in at https://rhn.redhat.com.
-* Click "Systems" in the top navigation bar, then "System Entitlements" on the left.
-* Select the appropriate entitlement level for the new system and click "Update Entitlements."'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:42:55 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 411, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-27, 'How can I request a new feature or improvement for the Spacewalk?', 'For technical requests, you can make a "Request for Enhancement" (RFE) at http://bugzilla.redhat.com/bugzilla. The product is "Spacewalk" and the various components are prefaced by "Spacewalk/". Please put "[RFE]" at the beginning of the summary line of your request.
-
-If you would like to provide non-technical feedback to Spacewalk, please go to https://rhn.redhat.com/help/contact.pxt and follow the directions for "feedback".
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:56:14 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 74, 9);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-28, 'Where do I report a bug in the Spacewalk website or update agent?', 'Bugs can be reported at http://bugzilla.redhat.com/bugzilla -- the product is "Spacewalk", and the various components are prefixed with "Spacewalk/".
-
-Please be sure to read the FAQ and review all of the open bugs before submitting your bug.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/15/2003 10:47:49 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 45, 9);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-30, 'What is the difference between i386, i586, and i686 packages?', 'i386 is a generic designation for all processors backwardly compatible with the Intel 80386; i586 is for all processors backwardly compatible with the Intel Pentium; and i686 is for Intel processors backwardly compatible with the Pentium Pro chip (Pentium II, III, IV, etc). Only the kernel has i586 and i686 versions, and glibc has an i686 version. up2date should automatically determine which versions of the kernel and glibc packages are appropriate for your systems.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/15/2003 10:33:49 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 8, 11);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-1, 'What is Spacewalk?', 'Spacewalk is a systems support and management environment for Red Hat Linux systems and networks. For more information, please see the Spacewalk product information page:
-http://www.redhat.com/software/rhn/products/
-
-For individual systems and small networks, see http://www.redhat.com/software/rhn
-
-For enterprise deployments, see http://www.redhat.com/software/rhen
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 05:00:08 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 26, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-3, 'Does Spacewalk only work on Linux? Which versions?', 'Yes. Spacewalk currently only supports versions of Red Hat Linux and Red Hat Enterprise Linux that are still active (have not yet reached End of Life status). For a list of currently maintained Red Hat versions, please go to http://www.redhat.com/apps/support/errata/
-
-Please note that Red Hat''s Enterprise Network Monitoring Module does support different platforms. For more information, please go to http://www.redhat.com/software/rhen/system_mgmt/
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 4, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-5, 'I can''t find the Spacewalk Registration Client. What is it and where do I find it?'
-, 'The Spacewalk Registration Client steps you through the process of creating a user account if you do not already have one and registering your system by creating a System Profile. It can be started by using one of the following methods:
-
-* On the GNOME desktop, go to the Main Menu Button (on the Panel) => Programs => System => Spacewalk.
-* On the KDE desktop, go to the Main Menu Button (on the Panel) => System => Spacewalk
-* At a shell prompt, type the command "rhn_register".
-
-In Red Hat Linux 8.0 and newer, rhn_register exists as a mode of the up2date client, so:
-
-* On the GNOME and KDE desktops, go to the Main Menu Button (on the Panel) => System Tools => Spacewalk. (If the system is unregistered, it will automatically launch in registration mode.)
-* At a shell prompt (for example, an xterm or gnome-terminal), type the command "up2date --register".
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/19/2003 01:31:52 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 126, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-7, 'I forgot my username and password. How do I access my account?', 'From the front page, click on the "Lost Password?" link, enter your username and email address, and then click the "Send Password" button.
-
-If you have neither your username nor your password, enter your email address in the second field provided, and then click the "Send Account List" button.
-
-If the email address matches the email address on file for your account, your information will be sent to you. If this does not work for you, please call our customer service desk at 1-866-2-RedHat.
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:14:22 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 16, 2);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-8, 'What are the service levels for Spacewalk?', 'Spacewalk currently offers three levels of service: Spacewalk Demo Service, Spacewalk Update Service and Spacewalk Management Service. For more details, go to http://www.redhat.com/software/rhn/offerings
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/08/2003 03:43:45 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 50, 4);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-69, 'pvt: You are sending packets to my machine! (Firewall log attached)', 'As you can see, the packets you are seeing are response packets coming from our host and port 443 to your machine.
-
-These packets have the SYN/ACK flags set up. These types of packets are sent only in response to a connection request from your computer.
-
-TCP uses a three-way handshake protocol to establish a connection:
-* the client sends a SYN packet to the server requesting a connection
-* the server acknowledges the request and sends back a SYN/ACK packet
-* the client responds back with an ACK packet and the connection is established
-
-Your firewall rules are not allowing the server responses to pass through. The rhnsd daemon is initiating these requests. You have 2 choices:
-
-* fix the firewall rules so you allow the reply packets to pass through and therefore allow your host to connect outside; or
-* disable the rhnsd daemon: service rhnsd stop
-'
-, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 3, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-125, 'pvt: no RHL support at rhn-help', 'This address is intended for support questions related only to Red Hat
-Network. General Red Hat Linux support is not available from this address.
-
-If you have not already done so, you can activate your product and receive advanced support at:
-
-https://www.redhat.com/apps/support/
-
-Even if you are not registered with Red Hat Support, you are welcome to browse
-our documentation and online resources available at:
-
-https://www.redhat.com/docs/
-
-You may also get access to Tips, FAQs, and online HOWTOs to guide you through
-Linux-related tasks if you start looking from our Support Resources Home Page
-available at:
-
-https://www.redhat.com/apps/support/resources/
-
-The Red Hat mailing lists are also good venues for finding answers to your
-questions. For more information on the Red Hat mailing lists, please see:
-
-http://www.redhat.com/mailing-lists/
-
-If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
-
-http://bugzilla.redhat.com/bugzilla
-'
-, 1, TO_Date( '12/11/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 288, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-126, 'How do I change my Spacewalk password?', 'To change your password:
-
-* Log in to the Spacewalk website with your existing username and password.
-* If you are not at Your Spacewalk page, click its link in the top navigation bar.
-* Click "Your Account" in the left navigation bar.
-* Type your new password in both the Password and Password Confirmation fields.
-* Click the "Update" button.
-'
-, 0, TO_Date( '12/12/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 9, 2);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-13, 'What is "rhnsd" and why is it running on my system?', '"rhnsd" is the Spacewalk Daemon. Every other hour, it sends a request to Spacewalk asking for any notifications or updates and works in coordination with Spacewalk to schedule automated tasks. It sends information to Spacewalk only requested by you. If you add a new system using the Spacewalk web interface, the next time the Spacewalk Daemon probes Spacewalk it receives a request to return the information you requested as part of your System Profile, such as what package versions are installed on your system.
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/08/2003 10:52:29 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 9, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-15, 'My systems are not checking in. What does that mean?', 'When the Spacewalk client connects to Spacewalk to see if there are any updates available, or if any actions have been scheduled, this is considered a checkin.
-
-If you are seeing a message indicating that checkins are not happening, it means that the Spacewalk client on your system is not successfully reaching Spacewalk for some reason. Things to check:
-* Make certain that your client is configured correctly.
-* Make sure that your system can communicate with Spacewalk via SSL (port 443). You may test this by running the following command from a shell prompt: telnet xmlrpc.rhn.redhat.com 443
-* Make sure that the rhnsd daemon is activated and running. You may ensure this by running the following commands:
-chkconfig --level 345 rhnsd on
-service rhnsd start
-
-If these settings are correct and your system still is not checking in, the ''Repairing a corrupt rpm database'' faq at http://rhn.redhat.com/help/faq/technical_questions.pxt#227 , or get in touch with our technical support team.
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 05:04:29 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 151, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-17, 'Can I use Spacewalk to upgrade my Red Hat Linux kernel?', 'Yes. You must use Red Hat Update Agent version 2.5.4 or higher. If you choose the kernel packages and allow Spacewalk to install them to your system, it will modify your LILO or GRUB configuration file so that your system boots the new kernel the next time it is rebooted.
-'
-, 0, TO_Date( '03/07/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 11, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-41, 'pvt: Updates to newer versions recommended by third-party security advisories.'
-, 'We have released fixes for all known vulnerabilities you are mentioning. Red Hat does not usually update to a new code base for the core applications and libraries if we have other options available. In the cases you have mentioned we choose to backport the security fixes to the code base we initially shipped to our customers. We do this in order to minimize the impact on the stability and the QA resources that both we and the customers invest in qualifying a particular release for a particular task.
-
-The latest versions of those packages provided by Red Hat are not vulnerable to the issues you mention.
-'
-, 1, TO_Date( '10/01/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/13/2003 11:31:22 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 10, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-62, 'Is Red Hat Technical Support available in other languages besides English?', 'At this time, Spacewalk technical support is English only.
-'
-, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/27/2003 10:32:41 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 26, 4);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-63, 'How do I download RPMs for a system without using up2date?', 'It is possible for Spacewalk users to download updated packages directly from the Spacewalk website without using up2date.
-
-To download them:
-
-* Log in to the Spacewalk web site.
-* Click "Software" in the top navigation bar.
-* Click the appropriate channel name.
-* On the Channel Details page, click the "Packages" tab.
-* Select the RPMs you want and click the "Download" button. You will be presented with a confirmation screen.
-* Click "Download Selected Packages Now!"
-* You will then be asked for the location to save the tar archive containing all the packages you selected.
-* To extract the packages once the download is complete, run: tar -xvf rhn-packages.tar
-'
-, 0, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:12 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 9, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-31, 'The update agent wants to install an older version of a package. Why?', 'This is probably because of the epoch number of the package. RPM checks three things when it tries to determine whether a package is newer: epoch, version, and release, in that order. A higher epoch number trumps both version and release. To see the epoch number on an installed package, use the command:
-
-rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}:%{EPOCH}\n" packagename
-
-The epoch is the number after the colon. On the Spacewalk website, you can also see the epoch for the package on the Installed Packages list for the system, (again, the number after the colon).
-
-Epoch numbers are used to preserve RPM''s concept of "newer" when package versions are changed inconveniently. The classic example of the need for an epoch is perl, which changed from version 5.00503 to 5.6, thereby breaking rpm''s segmented version comparison (i.e the integer 6 < 503, rather than 5.6 > 5.00503).
-
-To keep the update agent from trying to update your package, add it to the package skip list (pkgSkipList) in your up2date configuration:
-
-up2date --configure --nox
-
-However, the package will still show up on your list of applicable errata.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/06/2003 10:26:15 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 7, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-32, 'pvt: Red Hat Linux support', 'This address is intended for support questions related only to Spacewalk. General Red Hat Linux support is not available from this address. If you are registered with Red Hat Support, you may address your questions at:
-http://www.redhat.com/support
-
-If you have not already done so, you can activate your product and receive advanced support at:
-
-https://www.redhat.com/apps/support/
-
-Even if you are not registered with Red Hat Support, you are welcome to browse
-our documentation and online resources available at:
-
-https://www.redhat.com/docs/
-
-You may also get access to Tips, FAQs, and online HOWTOs to guide you through
-Linux-related tasks if you start looking from our Support Resources Home Page
-available at:
-
-https://www.redhat.com/apps/support/resources/
-
-The Red Hat mailing lists are also good venues for finding answers to your
-questions. For more information on the Red Hat mailing lists, please see:
-
-http://www.redhat.com/mailing-lists/
-
-If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
-
-http://bugzilla.redhat.com/bugzilla
-'
-, 1, TO_Date( '06/22/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/19/2003 01:13:04 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 768, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-33, 'How do I delete System Profiles?', 'In order to delete System Profiles from Spacewalk, you need to log in to the Spacewalk website at https://rhn.redhat.com. Once logged in, click on the "Systems" link in the top navigation bar, which will take you to a list of the profiles you have registered with Spacewalk. (If you instead see System Groups, click "View Systems" near the top of the page.)
-
-Click on the name of the profile you wish to delete from the service. This will bring up its System Details page. Click the "delete system" button at the top-right corner of the page. Then confirm that you wish to delete the profile.
-
-The profile will be removed after confirmation.
-'
-, 0, TO_Date( '06/24/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/12/2003 10:57:15 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 89, 7);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-36, 'pvt: Educational Channel', 'The educational channel and Red Hat educational initiative is currently undergoing some changes (all for the positive). Please stay tuned and periodically check the following websites for more information:
-
-www.redhat.com
-www.redhat.com/index2.html
-www.redhat.com/software/rhn
-'
-, 1, TO_Date( '08/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:13 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 14, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-35, 'An errata install fails with dependency errors, but dependencies are satisfied. Why?'
-, 'Sometimes the application of an errata from the Spacewalk web site will fail because the errata applies to packages that are set to be skipped in the local skip list for a system''s up2date client. The error message in the history log will incorrectly cite a dependency problem.
-
-To fix this problem, run:
-
-up2date --configure
-
-...as root from the client system, and remove the relevant packages from the skip list. Rescheduling the errata should then work as expected.
-'
-, 0, TO_Date( '08/20/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/13/2003 10:24:11 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 23, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-249, 'Where can I see a copy of the SLA (Service Level Agreement) for Spacewalk Technical Support?'
-, 'This can be viewed online at the following site:
-
-http://www.redhat.com/services/techsupport/production/RHN_basic.html'
-, 0, TO_Date( '03/31/2003 11:55:25 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/09/2003 11:00:32 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 6, 4);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-288, 'My system''s IP address and hostname have changed, but Spacewalk doesn''t reflect this. What should I do?'
-, 'Spacewalk stores a profile for each registered system. In addition to properties set by the user during registration, this profile may contain various kinds of information about the system''s hardware, including processor type, networking addresses, and storage devices. This information can be found in the Spacewalk website:
-
-1. Once logged in, click on Systems in the top navigation bar.
-2. Click on the name of a system in one of the lists. (This may require leaving a System Groups view.)
-3. In the System Details page, click the Hardware subtab. All of the hardware information Spacewalk has collected about your system will appear on the resulting page.
-4. To update this information, click the Schedule Hardware Refresh button. The hardware profile will be updated at the system''s next connection to Spacewalk.'
-, 0, TO_Date( '04/22/2003 04:00:05 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/23/2003 09:45:57 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-290, 'Why does up2date tell me "Your system is fully updated" when the Spacewalk website lists updates for my system?'
-, 'This error is likely caused by one of two problems: Either the system''s package profile on Spacewalk is out of date or up2date''s package exceptions list is preventing the updates from occurring.
-
-Since updating the package profile is simplest, try this first. Log into the Spacewalk website, click "Systems" in the top navigation bar, and then click the name of the system. In the System Details page, click the "Packages" tab and then click the "Update Package List" button. The profile will be updated when the system next connects to Spacewalk. This should either remove the updates listed for your system or allow you to conduct the updates if they remain.
-
-If this still does not resolve the error, check your package exceptions list, which enables you to identify packages to be exempt from updates. To ensure your settings are not preventing the updates, launch the Update Agent Configuration Tool by running the command:
-
-up2date-config
-
-In the tool, click the "Package Exceptions" tab and look for the packages listed as requiring updating.
-To check the package skip list in the up2date configuration file, open the file /etc/sysconfig/rhn/up2date and look for the package entries under the pkgSkipList setting. To override the package exceptions and force an update of the entire system, run the command:
-
-up2date -uf
-
-If the packages aren''t updated, the Spacewalk website will continue to list them as outdated, regardless of their inclusion in the system''s package exceptions list.'
-, 0, TO_Date( '04/22/2003 06:32:03 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/25/2003 08:04:45 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-291, 'Why does Apache fail to restart after I update my Spacewalk Management Satellite Server?', 'Apache RPMs do not restart the httpd service upon installation. Therefore, after conducting a full update of an Spacewalk Management Satellite Server (such as with the command up2date -uf), Apache fails. The error will look something like:
-
-[Mon Feb 10 11:50:12 2003] [notice] SIGHUP received. Attempting to restart
-Syntax error on line 214 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_log_config.so into server: /etc/httpd/modules/mod_log_config.so: undefined symbol: ap_escape_logitem
-
-To resolve this, restart the httpd service.'
-, 0, TO_Date( '04/22/2003 08:27:51 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/23/2003 09:48:30 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 7);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-308, 'How do I resolve dropped connections during ISO downloads?', 'Red Hat recommends using the Curl open source tool for downloading ISO images. This tool enables you to resume downloads that have been interrupted. If you use Spacewalk and don''t currently have Curl, you may install it by running the command "up2date curl" from a shell prompt.
-
-Once Curl is installed, at a shell prompt, cut and paste the URL for the ISO into the Curl command as follows:
-
-[user@localhost home]$ curl -C - -O ''very_long_url''
-
-The URL, which can be derived from the Easy ISOs page of the Spacewalk website, is very long because it contains session authentication information. Be sure to include the single quotation marks around it. The ''-C -'' option allows you to continue the download if it is interrupted, such as by a lost connection. The ''-O'' (the letter ''O'', not a zero) option will save the file with the same name as on the Spacewalk Servers.'
-, 0, TO_Date( '04/30/2003 07:02:36 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/02/2003 11:41:21 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-310, 'Why does the registration process prompt me for an organization ID if I don''t need one to register?'
-, 'The organization ID is legacy from the days in which Spacewalk allowed users to request addition to an existing organization, which then required an Organization Administrator to approve the new user.
-
-Now, the Spacewalk website allows Organization Administrators to create user accounts directly. Unfortunately, older versions of the registration tools (both rhn_register and up2date) still contain organization ID and password fields. You may disregard them.'
-, 0, TO_Date( '05/02/2003 08:51:09 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/03/2003 09:07:56 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 3);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-221, 'How do I get more legal information?', 'Please go to http://www.redhat.com/software/rhn/legal'
-, 0, TO_Date( '03/27/2003 06:47:21 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 8);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-224, 'What is an ISO?', 'An ISO is an image file of the contents of a CD.
-
-For example, by downloading the Red Hat Linux ISOs to your system, you can then burn a CD that will be identical to the Red Hat Linux CDs that are available in retail stores.'
-, 0, TO_Date( '03/28/2003 11:22:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:07:32 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 11);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-225, 'What is Errata?', 'An Errata is a message about new updates for your system, usually accompanied by updated packages.
-
-Spacewalk is a tool to update your system with these errata packages.'
-, 0, TO_Date( '03/28/2003 11:25:25 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/16/2003 09:08:17 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 11);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-227, 'How do I repair a corrupt RPM database?', 'Occasionally, the RPM database on a Red Hat Linux machine will become corrupt. This usually happens when an RPM transaction is interrupted at a critical time. Symptoms of this problem include one of the following programs not responding or freezing:
-
-* up2date
-* The Spacewalk alert notification tool (applet in the Gnome or KDE panel)
-* rhn_check
-* rpm
-
-This problem can also cause a system to stop checking in with Spacewalk.
-
-To fix this problem, run the following commands as root:
-
-* kill all RPM processes (rhn_check, up2date, rpm, rhn-applet):
- $ ps -axwww | grep rhn_check
-In the list of processes, the first number on each line is the PID. For all PIDs listed except for the one associated with grep:
- $ kill -9 <PID>
-Repeat the above steps for each of the programs listed.
-
-* remove any RPM lock files (/var/lib/rpm/__db*):
- $ rm -rf /var/lib/rpm/__db*
-
-* rebuild the rpm database:
- $ rpm --rebuilddb
-
-If the above steps do not work, please contact technical support for more assistance.'
-, 0, TO_Date( '03/28/2003 11:34:34 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/07/2003 11:31:57 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 2, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-231, 'How do I move my Spacewalk entitlement to another machine?', 'All of the systems that you want to entitle, or un-entitle, must be registered with Spacewalk. Please see the FAQ question relating to registering new systems.
-
-First Step - unentitle old system
-
-1) Sign in with Spacewalk
-2) Click on "Systems"
-3) Click on "Systems Entitlements"
-4) Change entitlement of old system to "none"
-5) Click "Update Entitlements"
-
-Next Step - entitle new system
-
-From same screen, change the entitlement on the new system to the entitlement you would like to have. Click "Update Entitlements".'
-, 0, TO_Date( '03/28/2003 12:07:10 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/14/2003 09:33:40 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 2, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-230, 'I just upgraded my system. How do I re-register it with Spacewalk?', 'If you are running a version of Red Hat Linux 7.3 (or prior release), do the following:
-
-1) Log in as root
-2) Type "rhn_register"
-
-If you are running a version of Red Hat Linux 8.0 (or later release), do the following:
-
-1) Log in as root
-2) Type "up2date --register"'
-, 0, TO_Date( '03/28/2003 12:01:49 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 10:47:23 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 2, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-232, 'How do I get copies of the latest release notes for Spacewalk?', 'Click on the Help button in the upper right hand corner. Then click on Release Notes listed on the navigation bar on the left.'
-, 0, TO_Date( '03/28/2003 12:16:19 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-70, 'pvt: Updating kernel and config files', 'Because of the wide range of changes and setups involved in the scenarios you describe we have chosen the conservative path in the default configuration.
-
-We recommend that you upgrade the kernel on the boxes while you can observe the process (ie, running "up2date --force kernel" from the command line). The same goes for the packages which have config files DBmodified - please check the results of the upgrade process to make sure you will not have an interruption of service due to changed config files.
-
-Once you have been through this process a few times and get a better feel for how Spacewalk handles your particular setup, you can decide to let Spacewalk perform these updates for you automatically.
-'
-, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/14/2003 10:30:31 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 26, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-73, 'pvt: I can''t get into ftp.redhat.com. Why?', '
-Due to the popularity of Red Hat Linux 8.0, our ftp servers are currently heavily loaded, and are at their capacity. We apologize for any inconvenience this may cause.
-
-If you are not able to log into the ftp.redhat.com ftp site, it is probably because the servers are serving the maximum number of users currently. You can try later, or better yet, try one of the many Red Hat mirror sites. They are listed at:
-
-https://www.redhat.com/download/mirror.html
- '
-, 1, TO_Date( '10/02/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/24/2003 09:35:36 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 3, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-82, 'Red Hat''s "GPG Key" - what is it and how do I install it?', 'The first time you run the graphical version of the Red Hat Update Agent, it prompts you to install the Red Hat GPG key. This key is required to authenticate the packages downloaded from Spacewalk. If you run the command line version the first time you start Red Hat Update Agent, you need to install the Red Hat GPG key manually; follow the instructions that up2date displays.'
-, 0, TO_Date( '10/17/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/06/2003 11:15:40 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 10, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-124, 'pvt: no RHL support at rhn-feedback', 'This address is intended for feedback related only to Red Hat
-Network. General Red Hat Linux support is not available from this address.
-If you are registered with Red Hat Support, you may address your questions
-at:
-http://www.redhat.com/support
-
-Even if you are not registered with Red Hat Support, you are welcome to browse
-our documentation and online resources available at:
-
-https://www.redhat.com/docs/
-
-You may also get access to Tips, FAQs, and online HOWTOs to guide you through
-Linux-related tasks if you start looking from our Support Resources Home Page
-available at:
-
-https://www.redhat.com/apps/support/resources/
-
-The Red Hat mailing lists are also good venues for finding answers to your
-questions. For more information on the Red Hat mailing lists, please see:
-
-http://www.redhat.com/mailing-lists/
-
-If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
-
-http://bugzilla.redhat.com/bugzilla'
-, 1, TO_Date( '12/11/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 10, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-191, 'pvt: I want to unsubscribe from the maillist !', 'To stop receiving mails from Spacewalk , please see below:
-
-Use your Spacewalk account to login, then go to "Your Spacewalk"==>"Your preferences" .
-
-The Your Preferences page allows you to configure Spacewalk options, including:
-
- Errata Email Notification — Determine whether you want to receive email every time an Errata Alert is applicable to one or more systems in your Spacewalk account.
-
- Spacewalk List Page Size — Maximum number of items that will appear in a list on a single page. If more items are in the list, clicking the Next button will display the next group of items. This preference applies to system lists, Errata lists, package lists, and so on.
-
- Time Zone — Set your time zone so that scheduled actions are scheduled according to the time in your time zone.
-
- Red Hat Contact Options — Identify what ways (email, phone, fax, or mail) Red Hat may contact you.
-
-After making changes to any of these options, click the Save Preferences button on the bottom right-hand corner.
-'
-, 1, TO_Date( '02/19/2003 08:20:46 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/27/2003 11:53:51 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 89, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-209, 'I can''t log in with my username or password. What should I do?', 'First, please check to see if you are using the correct username and password (see answers to questions in this section). If you are using the correct username and password, please call customer service at 1-866-2-RedHat or contact them at customerservice(a)redhat.com'
-, 0, TO_Date( '03/27/2003 03:57:30 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 2);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-228, 'pvt: How can I subscribe for Red Hat 9 now?', 'Red Hat Linux 9 ISOs will be available to paid subscribers starting March 31, 2003--a week before they will be available on redhat.com, in stores, or on Red Hat FTP. A paid subscription also gets you access to Spacewalk technical support, errata updates, priority access during peak times, and immediate email notification. It''s the quickest way to get Red Hat Linux 9.
-
-Note: Spacewalk does not include printed documentation or Red Hat Linux Installation Support. If that''s what you''re looking for, you can purchase Red Hat Linux 9 at redhat.com or at retail stores, available April 7, 2003. Red Hat Linux 9 or Red Hat Linux 9 Professional includes source code and documentation CDs, printed documentation manuals, installation support, and 1- or 2- month Update Subscription to Spacewalk.
-
-For more informations please visit this page:
-http://www.redhat.com/mktg/rh9iso/
-'
-, 1, TO_Date( '03/25/2003 03:09:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/06/2003 09:07:11 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 9, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-208, 'I am new to Spacewalk. How do I create an account?', 'Go to http://rhn.redhat.com and click on the link that says "Create Account". From here, please follow the directions.'
-, 0, TO_Date( '03/27/2003 03:55:40 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 3);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-210, 'How do I login to Spacewalk?', 'Go to http://rhn.redhat.com
-
-From this page, enter in your username and password in the box. If you do not have your username and password, please see the FAQ relating to this.'
-, 0, TO_Date( '03/27/2003 03:59:43 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 3);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-212, 'How do I contact Spacewalk?', 'To contact Spacewalk, please go to: http://www.redhat.com/software/rhn/contact'
-, 0, TO_Date( '03/27/2003 04:02:07 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-215, 'How do I know when I need to update my system?', 'Once your system is registered on Spacewalk, a small icon will appear on your tool bar (Red Hat Linux 7.3 and higher). The icon will display either an exclamation point with red background (meaning that there is an update waiting to be downloaded) or a check mark with blue background (meaning that there are no updates waiting). If your icon portrays a question mark, it means that Spacewalk is not able to see your system.
-
-By double clicking on the icon, this will activate Spacewalk update tool.'
-, 0, TO_Date( '03/27/2003 04:27:48 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-217, 'Can I use Spacewalk to upgrade to a newer version of Red Hat Linux?', 'No. While Spacewalk always supports the latest version of Red Hat Linux, Spacewalk cannot be used today to upgrade your system from one version of Red Hat Linux to the next. You will need to do a CD based install. However, if you are a paid subscriber to Spacewalk (Update or Management), you have access to the new Red Hat Linux ISOs the moment they are made available. For more information, see http://www.redhat.com/software/rhn/offerings
-'
-, 0, TO_Date( '03/27/2003 04:39:01 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 5);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-219, 'What are the terms and conditions of Spacewalk?', 'To see a copy of the Spacewalk Terms and Conditions, please go to http://www.redhat.com/licenses/rhn.html'
-, 0, TO_Date( '03/27/2003 06:03:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:11 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 0, 8);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-23, 'How do I remove a pending action?', 'A pending action will be removed when there are no longer any systems scheduled for it. For Demo or Update entitlements this will always be done on a per system basis:
-
-* Log into the Spacewalk website.
-* Click "Schedule" on the top navigation bar, then "Pending Actions" in the left navigation bar.
-* Click on the numeral in the "In Progress" column of the row for the action you want to remove.
-* Click on the desired system name.
-* Click on the "Events" tab in the System Details navigation.
-* Click on the "Pending" subtab.
-* Select the event you wish to cancel, and click "Cancel Events"
-* Click the "Cancel Selected Events" on the confirmation page.
-
-For systems with Management entitlements, simply remove the systems from the action:
-
-* Click "Schedule" on the top navigation bar, then "Pending Actions" in the left navigation bar.
-* Click on the numeral in the "In Progress" column of the row for the action you want to remove.
-* Select the systems for removal from the action and then click on the "Unschedule Action" button.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/18/2003 09:53:59 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 14, 7);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-24, 'Why do scheduled kernel errata fail to install?', 'By default, the kernel packages are marked to be skipped by the update agent. You can change this configuration by running:
-
-up2date --configure --nox
-
-...and changing or clearing the "pkgSkipList" parameter. You should then be able to schedule your kernel update.
-'
-, 0, TO_Date( '06/14/2002 12:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/30/2003 04:21:47 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 11, 6);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-131, 'pvt: openssl packages', 'The latest releases of the OpenSSL packages from Red Hat include fixes for all known security vulnerabilities, including the various types of worms that float around.
-
-Please remember that just upgrading the packages is not sufficient. You will have to restart at least your Apache server in order for the new libraries to be loaded by the running Apache process.
-
-More details about the applicable OpenSSL errata can be found at:
-
-https://rhn.redhat.com/errata/RHSA-2002-160.html
-and
-https://rhn.redhat.com/network/errata/errata_details.pxt?eid=1143
-'
-, 1, TO_Date( '12/19/2002 07:33:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 4, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-148, 'pvt: delayed response', 'Due to significant interest & volume in Spacewalk services, we have been unable to respond to your question in a timely manner. We apologize for the delay and any inconvenience this delay may have caused you. In response to your question, below is a response to your question. If this solution does not resolve your issue, please resubmit with additional information.
-'
-, 1, TO_Date( '02/05/2003 12:41:33 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/03/2003 11:24:13 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 39, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-168, 'pvt: New To Linux', 'This address is intended for support questions from paid subscribers and is related only to Spacewalk. General Red Hat Linux support is not available from this address. If you are registered with Red Hat Support, you may address your questions at:
-http://www.redhat.com/support
-
-If you have not already done so, you can activate your product and receive advanced support at:
-
-https://www.redhat.com/apps/support/
-
-Even if you are not registered with Red Hat Support, you are welcome to browse
-our documentation and online resources available at:
-
-https://www.redhat.com/docs/
-
-You may also get access to Tips, FAQs, and online HOWTOs to guide you through
-Linux-related tasks if you start looking from our Support Resources Home Page
-available at:
-
-https://www.redhat.com/apps/support/resources/
-
-The Red Hat mailing lists are also good venues for finding answers to your
-questions. For more information on the Red Hat mailing lists, please see:
-
-http://www.redhat.com/mailing-lists/
-
-If you would like to report a bug or a problem with a component of the Red Hat Linux distribution, we encourage you to visit our bug tracking system and file a bug report at:
-
-http://bugzilla.redhat.com/bugzilla
-'
-, 1, TO_Date( '02/13/2003 04:23:15 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 6, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-169, 'How do I change my email address?', 'To change your email:
-
-* Log in to the Spacewalk website with your existing username and password.
-* If you are not at Your Spacewalk page, click its link in the top navigation bar.
-* Click "Your Account" in the left navigation bar.
-* Click "Change Email"
-* Type your new email in field.
-* Click the "Send Verification" or "Update" button.'
-, 0, TO_Date( '02/13/2003 10:03:56 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/13/2003 09:15:55 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 16, 2);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-170, 'pvt: How to entitle system in my Spacewalk', '* Once the system is registered, log in at https://rhn.redhat.com.
-* Click "Systems" in the top navigation bar, then "System Entitlements" on the left.
-* Select the appropriate entitlement level for the new system and click "Update Entitlements."'
-, 1, TO_Date( '02/13/2003 10:36:28 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '05/15/2003 09:36:58 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 54, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-188, 'pvt: system on a closed net , but still want to update', 'Spacewalk Management Satellite Server provides for local management of system profiles, thus allowing for completely disconnected operation from external networks.
-More information, please follow this link:
-https://rhn.redhat.com/info/purchase_info.pxt
-'
-, 1, TO_Date( '02/18/2003 09:35:22 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/07/2003 11:03:00 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 8, 1);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-189, 'What are the differences between Update, Management, and Demo Accounts?', 'Update service level subscriptions to Spacewalk allow individuals to register one or more systems, manage these systems independently, receive priority access to Spacewalk, and download Easy ISOs (full versions of Red Hat Linux). Update subscriptions are $60 per system and renew annually. Customers may receive also limited time (less than one year) Update subscriptions with the Red Hat Linux distribution products.
-
-Management service level subscriptions to Spacewalk allow organizations to manage multiple systems, individually or in groups of systems. Management subscriptions efficiently combine the power and flexibility of fine-grained control with the scalability to support thousands of systems.
-
-Demo refers to our complimentary service level. Any user may receive one Demo account with Spacewalk to receive notifications and system updates. Demo users are asked to take a short survey every 60 days in order to provide Red Hat with valued customer input and to validate that the account is still active. Please note that there can be only one demo account per email address.
-
-Note: A Demo account does not provide guaranteed access to errata or bandwidth allocation during peak times, as these resources are reserved for paying subscribers. For this reason, Red Hat strongly recommends purchasing at least an Update service level if you are using your Linux system for home or business production use.
-
-For more information, please follow this link:
-http://www.redhat.com/software/rhn/offerings'
-, 0, TO_Date( '02/18/2003 10:53:18 PM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '04/21/2003 12:08:01 PM', 'MM/DD/YYYY HH:MI:SS AM')
-, 48, 4);
-INSERT INTO RHNFAQ ( ID, SUBJECT, DETAILS, PRIVATE, CREATED, MODIFIED, USAGE_COUNT,
-CLASS_ID ) VALUES (
-190, 'pvt:How can i delete my account in Spacewalk?', 'Sorry,you can not delete your account in Spacewalk now. But your account will be disabled if you do not accept the survey per 60 days.'
-, 1, TO_Date( '02/19/2003 04:22:18 AM', 'MM/DD/YYYY HH:MI:SS AM'), TO_Date( '03/31/2003 09:26:10 AM', 'MM/DD/YYYY HH:MI:SS AM')
-, 25, 1);
-COMMIT;
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/024-rhnKSTreeType-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/024-rhnKSTreeType-strings.sql
deleted file mode 100644
index a36838b..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/024-rhnKSTreeType-strings.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhnKSTreeType
-set name = 'Spacewalk managed kickstart tree'
-where label = 'rhn-managed';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/025-rhnKickstartSessionState-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/025-rhnKickstartSessionState-strings.sql
deleted file mode 100644
index e47ee5f..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/025-rhnKickstartSessionState-strings.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-
-update rhnKickstartSessionState
-set description = 'The system has downloaded the kickstart configuraton file from Spacewalk.'
-where label = 'configuration_accessed';
-
-update rhnKickstartSessionState
-set description = 'The system has successfully registered with Spacewalk after kickstarting.'
-where label = 'registered';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/026-rhnOrgEntitlementType-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/026-rhnOrgEntitlementType-strings.sql
deleted file mode 100644
index 6680e33..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/026-rhnOrgEntitlementType-strings.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-
-update rhnOrgEntitlementType
-set name = 'Spacewalk Monitoring'
-where label = 'rhn_monitor';
-
-update rhnOrgEntitlementType
-set name = 'Spacewalk Provisioning'
-where label = 'rhn_provisioning';
-
-update rhnOrgEntitlementType
-set name = 'Spacewalk Non-Linux'
-where label = 'rhn_nonlinux';
-
-update rhnOrgEntitlementType
-set name = 'Spacewalk Virtualization'
-where label = 'rhn_virtualization';
-
-update rhnOrgEntitlementType
-set name = 'Spacewalk Virtualization Platform'
-where label = 'rhn_virtualization_platform';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/027-rhnServerGroupType-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/027-rhnServerGroupType-strings.sql
deleted file mode 100644
index 69013cb..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/027-rhnServerGroupType-strings.sql
+++ /dev/null
@@ -1,17 +0,0 @@
-
-update rhnServerGroupType
-set name = 'Spacewalk Update Entitled Servers'
-where label = 'sw_mgr_entitled';
-
-update rhnServerGroupType
-set name = 'Spacewalk Management Entitled Servers'
-where label = 'enterprise_entitled';
-
-update rhnServerGroupType
-set name = 'Spacewalk Provisioning Entitled Servers'
-where label = 'provisioning_entitled';
-
-update rhnServerGroupType
-set name = 'Spacewalk Monitoring Entitled Servers'
-where label = 'monitoring_entitled';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/028-rhnTemplateString_data-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/028-rhnTemplateString_data-strings.sql
deleted file mode 100644
index f86b3e4..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/028-rhnTemplateString_data-strings.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhnTemplateString
-set value = '-' || '-the Spacewalk Team'
-where label = 'email_footer';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/029-rhnUserGroupType_data-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/029-rhnUserGroupType_data-strings.sql
deleted file mode 100644
index 9f67685..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/029-rhnUserGroupType_data-strings.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-
-update rhnUserGroupType
-set name = 'Spacewalk Support Administrator'
-where label = 'rhn_support';
-
-update rhnUserGroupType
-set name = 'Spacewalk Superuser'
-where label = 'rhn_superuser';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/030-rhn_config_macro_data-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/030-rhn_config_macro_data-strings.sql
deleted file mode 100644
index dc3a5c7..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/030-rhn_config_macro_data-strings.sql
+++ /dev/null
@@ -1,36 +0,0 @@
-
-update rhn_config_macro
-set description = 'Spacewalk administrator email'
-where environment = 'LICENSE'
- and name = 'RHN_ADMIN_EMAIL';
-
-update rhn_config_macro
-set description = 'Spacewalk database name '
-where environment = 'LICENSE'
- and name = 'RHN_DB_NAME';
-
-update rhn_config_macro
-set description = 'Spacewalk database password'
-where environment = 'LICENSE'
- and name = 'RHN_DB_PASSWD';
-
-update rhn_config_macro
-set description = 'Spacewalk Database table owner'
-where environment = 'LICENSE'
- and name = 'RHN_DB_TABLE_OWNER';
-
-update rhn_config_macro
-set description = 'Spacewalk database username'
-where environment = 'LICENSE'
- and name = 'RHN_DB_USERNAME';
-
-update rhn_config_macro
-set description = 'Spacewalk hostname (FQDN)'
-where environment = 'LICENSE'
- and name = 'RHN_SAT_HOSTNAME';
-
-update rhn_config_macro
-set description = 'Spacewalk webserver port (80 for http, 443 for https)'
-where environment = 'LICENSE'
- and name = 'RHN_SAT_WEB_PORT';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/031-rhn_notification_formats_data-strings.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/031-rhn_notification_formats_data-strings.sql
deleted file mode 100644
index 03d2ad9..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/031-rhn_notification_formats_data-strings.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-
-update rhn_notification_formats
-set body_format = replace(body_format, 'RHN', 'Spacewalk')
-where description in ( 'New Default (2.15)', 'New Default (2.18)' )
- and customer_id is null;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/032-rhn_command.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/032-rhn_command.sql
deleted file mode 100644
index f4b0e57..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/032-rhn_command.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter table rhn_command
-modify command_class default '/opt/home/nocpulse/libexec/plugin';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/033-rhn_command_queue_commands_data.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/033-rhn_command_queue_commands_data.sql
deleted file mode 100644
index e7b8dff..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/033-rhn_command_queue_commands_data.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhn_command_queue_commands
-set command_line = '/opt/home/nocpulse/bin/scheduleEvents'
-where recid = 1;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/034-rhn_config_parameter_data.sql.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/034-rhn_config_parameter_data.sql.sql
deleted file mode 100644
index 766c82a..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/034-rhn_config_parameter_data.sql.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhn_config_parameter
-set value = '/opt' || value
-where value like '/home/nocpulse/%';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/035-check_email_uniqueness-drop.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/035-check_email_uniqueness-drop.sql
deleted file mode 100644
index 2f1ef22..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/035-check_email_uniqueness-drop.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-drop function check_email_uniqueness;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/040-rhnPackage-index-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/040-rhnPackage-index-nevra.sql
deleted file mode 100644
index 7f39e67..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/040-rhnPackage-index-nevra.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-
-drop index rhn_package_n_e_pa_o_uq;
-drop index rhn_package_md5_nid_eid_oid_uq;
-
-create unique index rhn_package_md5_oid_uq
- on rhnPackage(md5sum, org_id)
- tablespace [[2m_tbs]]
- storage( pctincrease 1 freelists 16 )
- initrans 32;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/041-rhnPackageProvider-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/041-rhnPackageProvider-nevra.sql
deleted file mode 100644
index b9cd641..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/041-rhnPackageProvider-nevra.sql
+++ /dev/null
@@ -1,61 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnPackageProvider
-(
- id number
- constraint rhn_pkg_provider_id_nn not null,
- name varchar2(64)
- constraint rhn_pkg_provider_key_nn not null,
- created date default(sysdate)
- constraint rhn_pkg_provider_created_nn not null,
- modified date default(sysdate)
- constraint rhn_pkg_provider_modified_nn not null
-)
- storage ( freelists 16 )
- initrans 32;
-
-create sequence rhn_package_provider_id_seq start with 100;
-
--- these must be in this order.
-create index rhn_pkg_provider_id_n_idx
- on rhnPackageProvider(id,name)
- tablespace [[2m_tbs]]
- storage ( freelists 16 )
- initrans 32;
-alter table rhnPackageProvider add constraint rhn_pkg_provider_id_pk primary key (id);
-alter table rhnPackageProvider add constraint rhn_pkg_provider_name_uq unique ( name );
-
-
-
-create or replace trigger
-rhn_pkg_provider_mod_trig
-before insert or update on rhnPackageProvider
-for each row
-begin
- :new.modified := sysdate;
-end;
-/
-
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 21:50:21 jsherrill
--- new package gpg tracking
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/042-rhnPackageKeyType-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/042-rhnPackageKeyType-nevra.sql
deleted file mode 100644
index a88fe9b..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/042-rhnPackageKeyType-nevra.sql
+++ /dev/null
@@ -1,61 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnPackageKeyType
-(
- id number
- constraint rhn_pkg_key_type_id_nn not null,
- label varchar2(64)
- constraint rhn_pkg_key_type_label_nn not null,
- created date default(sysdate)
- constraint rhn_pkg_key_type_created_nn not null,
- modified date default(sysdate)
- constraint rhn_pkg_key_type_modified_nn not null
-)
- storage ( freelists 16 )
- initrans 32;
-
-create sequence rhn_package_key_type_id_seq start with 100;
-
--- these must be in this order.
-create index rhn_pkg_key_type_id_n_idx
- on rhnPackageKeyType(id,label)
- tablespace [[2m_tbs]]
- storage ( freelists 16 )
- initrans 32;
-alter table rhnPackageKeyType add constraint rhn_pkg_key_type_id_pk primary key (id);
-alter table rhnPackageKeyType add constraint rhn_pkg_key_type_label_uq unique ( label );
-
-
-
-create or replace trigger
-rhn_pkg_key_type_mod_trig
-before insert or update on rhnPackageKeyType
-for each row
-begin
- :new.modified := sysdate;
-end;
-/
-
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 21:50:21 jsherrill
--- new package key tracking
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/043-rhnPackageKey-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/043-rhnPackageKey-nevra.sql
deleted file mode 100644
index 43ca329..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/043-rhnPackageKey-nevra.sql
+++ /dev/null
@@ -1,68 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnPackageKey
-(
- id number
- constraint rhn_pkey_id_nn not null,
- key_id varchar2(64)
- constraint rhn_pkey_key_nn not null,
- key_type_id number
- constraint rhn_pkey_type_id_nn not null
- constraint rhn_pkey_type_id_prid_fk
- references rhnPackageKeyType(id),
- provider_id number
- constraint rhn_pkey_prid_fk
- references rhnPackageProvider(id),
- created date default(sysdate)
- constraint rhn_pkey_created_nn not null,
- modified date default(sysdate)
- constraint rhn_pkey_modified_nn not null
-)
- storage ( freelists 16 )
- initrans 32;
-
-create sequence rhn_pkey_id_seq start with 100;
-
--- these must be in this order.
-create index rhn_pkey_id_k_pid_idx
- on rhnPackageKey(id,key_id,provider_id,key_type_id)
- tablespace [[2m_tbs]]
- storage ( freelists 16 )
- initrans 32;
-alter table rhnPackageKey add constraint rhn_pkey_id_pk primary key (id);
-alter table rhnPackageKey add constraint rhn_pkey_keyid_uq unique ( key_id );
-
-
-
-create or replace trigger
-rhn_pkg_gpg_mod_trig
-before insert or update on rhnPackageKey
-for each row
-begin
- :new.modified := sysdate;
-end;
-/
-
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 21:50:21 jsherrill
--- new package key tracking
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/044-rhnPackageKeyAssociation-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/044-rhnPackageKeyAssociation-nevra.sql
deleted file mode 100644
index 7f90f32..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/044-rhnPackageKeyAssociation-nevra.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---/
-
-create table
-rhnPackageKeyAssociation
-(
- package_id number
- constraint rhn_pkeya_pid_nn not null
- constraint rhn_pkeya_pid_fk
- references rhnPackage(id) on delete cascade,
- key_id number
- constraint rhn_pkeya_kid_nn not null
- constraint rhn_pkeya_kid_fk
- references rhnPackageKey(id),
- created date default (sysdate)
- constraint rhn_pkeya_created_nn not null,
- modified date default (sysdate)
- constraint rhn_pkeya_modified_nn not null
-)
- storage ( freelists 16 )
- initrans 32;
-
-create unique index rhn_pkeya_pk_uq
- on rhnPackageKeyAssociation(package_id,key_id)
- tablespace [[64k_tbs]]
- storage ( freelists 16 )
- initrans 32;
-
--- Revision 1.1 2008/07/01 02:00:55 jlsherrill
--- initial add
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/045-lookup_package_key_type-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/045-lookup_package_key_type-nevra.sql
deleted file mode 100644
index c121f61..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/045-lookup_package_key_type-nevra.sql
+++ /dev/null
@@ -1,38 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace function
-lookup_package_key_type(label_in in varchar2)
-return number
-deterministic
-is
- package_key_type_id number;
-begin
- select id into package_key_type_id from rhnPackageKeyType where label = label_in;
- return package_key_type_id;
-exception
- when no_data_found then
- rhn_exception.raise_exception('package_key_type_not_found');
-end;
-/
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 23:16:18 jsherrill
--- adding
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/046-lookup_package_provider-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/046-lookup_package_provider-nevra.sql
deleted file mode 100644
index 5163872..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/046-lookup_package_provider-nevra.sql
+++ /dev/null
@@ -1,38 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace function
-lookup_package_provider(name_in in varchar2)
-return number
-deterministic
-is
- package_provider_id number;
-begin
- select id into package_provider_id from rhnPackageProvider where name = name_in;
- return package_provider_id;
-exception
- when no_data_found then
- rhn_exception.raise_exception('package_provider_not_found');
-end;
-/
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 23:16:18 jsherrill
--- adding
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/047-rhnPackageKeyType_data-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/047-rhnPackageKeyType_data-nevra.sql
deleted file mode 100644
index df51e83..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/047-rhnPackageKeyType_data-nevra.sql
+++ /dev/null
@@ -1,34 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
--- $Id$
-
-insert into rhnPackageKeyType (id, label) values
-(rhn_package_key_type_id_seq.nextval, 'gpg' );
-insert into rhnPackageKeyType (id, label) values
-(rhn_package_key_type_id_seq.nextval, 'pgp' );
-insert into rhnPackageKeyType (id, label) values
-(rhn_package_key_type_id_seq.nextval, 'rsa' );
-insert into rhnPackageKeyType (id, label) values
-(rhn_package_key_type_id_seq.nextval, 'dsa' );
-
-
-
-commit;
-
--- $Log$
--- Revision 1.1 2008/07/02 23:42:28 jsherrill
--- Sequence; data to populate stuff
---
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/048-rhnPackageProvider_data-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/048-rhnPackageProvider_data-nevra.sql
deleted file mode 100644
index 4cb9b49..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/048-rhnPackageProvider_data-nevra.sql
+++ /dev/null
@@ -1,39 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
--- $Id$
-
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'Red Hat Inc.' );
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'Fedora' );
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'CentOS' );
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'Scientific Linux' );
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'Suse' );
-insert into rhnPackageProvider (id, name) values
-(rhn_package_provider_id_seq.nextval, 'Oracle Inc.' );
-
-
-
-
-commit;
-
--- $Log$
--- Revision 1.1 2008/07/02 23:42:28 jsherrill
--- Sequence; data to populate stuff
---
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/049-rhnPackageKey_data-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/049-rhnPackageKey_data-nevra.sql
deleted file mode 100644
index 326954a..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/049-rhnPackageKey_data-nevra.sql
+++ /dev/null
@@ -1,59 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
--- $Id$
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '5326810137017186', lookup_package_key_type('gpg'), lookup_package_provider('Red Hat Inc.'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '219180cddb42a60e', lookup_package_key_type('gpg'), lookup_package_provider('Red Hat Inc.'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, 'b44269d04f2a6fd2', lookup_package_key_type('gpg'), lookup_package_provider('Fedora'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, 'a8a447dce8562897', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '2802e89216ff0e46', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, 'a53d0bab443e1821', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '7049e44d025e513b', lookup_package_key_type('gpg'), lookup_package_provider('CentOS'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '25dbef78a7048f8d', lookup_package_key_type('gpg'), lookup_package_provider('Scientific Linux'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '66ced3de1e5e0159', lookup_package_key_type('gpg'), lookup_package_provider('Oracle Inc.'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, '2e2bcdbcb38a8516', lookup_package_key_type('gpg'), lookup_package_provider('Oracle Inc.'));
-
-insert into rhnPackageKey (id, key_id, key_type_id, provider_id) values
-(rhn_pkey_id_seq.nextval, 'a84edae89c800aca', lookup_package_key_type('gpg'), lookup_package_provider('Suse'));
-
-
-
-
-commit;
-
--- $Log$
--- Revision 1.1 2008/07/02 23:42:28 jsherrill
--- Sequence; data to populate stuff
---
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/050-rhnException_data-nevra.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/050-rhnException_data-nevra.sql
deleted file mode 100644
index 2ff078a..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/050-rhnException_data-nevra.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-insert into rhnException values (-20292, 'package_provider_not_found', 'The specified package provider could not be found.');
-
-insert into rhnException values (-20293, 'package_key_type_not_found', 'The specified package key type could not be found.');
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/051-lookup_package_key_type-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/051-lookup_package_key_type-non-deterministic.sql
deleted file mode 100644
index f2868c2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/051-lookup_package_key_type-non-deterministic.sql
+++ /dev/null
@@ -1,37 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace function
-lookup_package_key_type(label_in in varchar2)
-return number
-is
- package_key_type_id number;
-begin
- select id into package_key_type_id from rhnPackageKeyType where label = label_in;
- return package_key_type_id;
-exception
- when no_data_found then
- rhn_exception.raise_exception('package_key_type_not_found');
-end;
-/
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 23:16:18 jsherrill
--- adding
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/052-lookup_package_provider-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/052-lookup_package_provider-non-deterministic.sql
deleted file mode 100644
index 475d338..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/052-lookup_package_provider-non-deterministic.sql
+++ /dev/null
@@ -1,37 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace function
-lookup_package_provider(name_in in varchar2)
-return number
-is
- package_provider_id number;
-begin
- select id into package_provider_id from rhnPackageProvider where name = name_in;
- return package_provider_id;
-exception
- when no_data_found then
- rhn_exception.raise_exception('package_provider_not_found');
-end;
-/
-show errors
-
--- $Log$
--- Revision 1.1 2008/07/01 23:16:18 jsherrill
--- adding
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-1-rhnPackageSignature-drop.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-1-rhnPackageSignature-drop.sql
deleted file mode 100644
index 1988eb0..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-1-rhnPackageSignature-drop.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-drop table rhnPackageSignature;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-2-rhn_package_sig_id_seq-drop.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-2-rhn_package_sig_id_seq-drop.sql
deleted file mode 100644
index 5de4c79..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/053-2-rhn_package_sig_id_seq-drop.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-drop sequence rhn_package_sig_id_seq;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-1-rhnPackageSigType-drop.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-1-rhnPackageSigType-drop.sql
deleted file mode 100644
index 2253866..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-1-rhnPackageSigType-drop.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-drop table rhnPackageSigType;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql
deleted file mode 100644
index 6bf2fb2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/054-2-rhn_package_sig_type_id_seq-drop.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-drop sequence rhn_package_sig_type_id_seq;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-0-rhnPackageChangeLog-sequence.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-0-rhnPackageChangeLog-sequence.sql
deleted file mode 100644
index 2c942a9..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-0-rhnPackageChangeLog-sequence.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-create sequence rhn_pkg_cl_id_seq;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-1-rhnPackageChangeLog-id.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-1-rhnPackageChangeLog-id.sql
deleted file mode 100644
index c49ed94..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-1-rhnPackageChangeLog-id.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter table rhnPackageChangelog
-add id number;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-2-rhnPackageChangeLog-id-data.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-2-rhnPackageChangeLog-id-data.sql
deleted file mode 100644
index d3e50c8..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-2-rhnPackageChangeLog-id-data.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhnPackageChangelog
-set id = rhn_pkg_cl_id_seq.nextval
-where id is null;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-3-rhnPackageChangeLog-id-not-null.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-3-rhnPackageChangeLog-id-not-null.sql
deleted file mode 100644
index 7f3db05..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/055-3-rhnPackageChangeLog-id-not-null.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-
-alter table rhnPackageChangelog
-modify id
- constraint rhn_pkg_cl_id_nn not null
- constraint rhn_pkg_cl_id_pk primary key
- using index tablespace [[64k_tbs]];
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/056-create_new_org-no-password.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/056-create_new_org-no-password.sql
deleted file mode 100644
index 1cc42e5..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/056-create_new_org-no-password.sql
+++ /dev/null
@@ -1,146 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id: create_new_org.sql 118829 2007-08-03 00:04:50Z mmccune $
---
---
-
-create or replace procedure
-create_new_org
-(
- name_in in varchar2,
- password_in in varchar2,
- org_id_out out number
-) is
- ug_type number;
- group_val number;
- new_org_id number;
-begin
-
- select web_customer_id_seq.nextval into new_org_id from dual;
-
- insert into web_customer (
- id, name,
- oracle_customer_id, oracle_customer_number,
- customer_type
- ) values (
- new_org_id, name_in,
- new_org_id, new_org_id, 'B'
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'org_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Organization Administrators',
- 'Organization Administrators for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) VALues (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'system_group_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'System Group Administrators',
- 'System Group Administrators for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'activation_key_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Activation Key Administrators',
- 'Activation Key Administrators for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- -- config admin is special; it gets created in
- -- rhn_entitlements.set_customer_provisioning instead.
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'channel_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Channel Administrators',
- 'Channel Administrators for Org ' || name_in,
- NULL, ug_type, new_org_id
- );
-
- -- there aren't any users yet, so we don't need to update
- -- rhnUserServerPerms
- insert into rhnServerGroup
- ( id, name, description, max_members, group_type, org_id )
- select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
- 0, sgt.id, new_org_id
- from rhnServerGroupType sgt
- where sgt.label = 'sw_mgr_entitled';
-
- org_id_out := new_org_id;
-
-end create_new_org;
-/
-show errors;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/057-create_first_org-no-password.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/057-create_first_org-no-password.sql
deleted file mode 100644
index 6f162b4..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/057-create_first_org-no-password.sql
+++ /dev/null
@@ -1,172 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
--- EXCLUDE: production
---
--- This creates an org with ID of 1, and errors if there already is one
---
-
-
-
-create or replace procedure
-create_first_org
-(
- name_in in varchar2,
- password_in in varchar2
-) is
- ug_type number;
- group_val number;
-begin
- insert into web_customer (
- id, name,
- oracle_customer_id, oracle_customer_number,
- customer_type
- ) values (
- 1, name_in,
- 1, 1, 'B'
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'org_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Organization Administrators',
- 'Organization Administrators for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'org_applicant';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) VALues (
- group_val, 'Organization Applicants',
- 'Organization Applicants for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'system_group_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'System Group Administrators',
- 'System Group Administrators for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'activation_key_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Activation Key Administrators',
- 'Activation Key Administrators for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- -- config admin is special; it gets created in
- -- rhn_entitlements.set_customer_provisioning instead.
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'channel_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Channel Administrators',
- 'Channel Administrators for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
- select rhn_user_group_id_seq.nextval into group_val from dual;
-
- select id
- into ug_type
- from rhnUserGroupType
- where label = 'satellite_admin';
-
- insert into rhnUserGroup (
- id, name,
- description,
- max_members, group_type, org_id
- ) values (
- group_val, 'Satellite Administrators',
- 'Satellite Administrators for Org ' || name_in || ' (1)',
- NULL, ug_type, 1
- );
-
-
- -- if they need more than 16GB, they'll call us and we'll whip
- -- out a "can be null" patch, which we should do for next
- -- version anyway. (I thought we did that for this version?)
- insert into rhnOrgQuota(
- org_id, total
- ) values (
- 1, 1024*1024*1024*16
- );
-
-
- -- there aren't any users yet, so we don't need to update
- -- rhnUserServerPerms
- insert into rhnServerGroup
- ( id, name, description, max_members, group_type, org_id )
- select rhn_server_group_id_seq.nextval, sgt.name, sgt.name,
- 0, sgt.id, 1
- from rhnServerGroupType sgt
- where sgt.label = 'sw_mgr_entitled';
-
-end create_first_org;
-/
-show errors;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/058-web_customer-drop-password.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/058-web_customer-drop-password.sql
deleted file mode 100644
index b50d169..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/058-web_customer-drop-password.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter table web_customer
-drop column password;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/060-rhn_channel-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/060-rhn_channel-deterministic.sql
deleted file mode 100644
index f10baea..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/060-rhn_channel-deterministic.sql
+++ /dev/null
@@ -1,1368 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_channel
-IS
- body_version varchar2(100) := '$Id$';
-
- -- Cursor that fetches all the possible base channels for a
- -- (server_arch_id, release, org_id) combination
- cursor base_channel_cursor(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number
- ) return rhnChannel%ROWTYPE is
- select distinct c.*
- from rhnDistChannelMap dcm,
- rhnServerChannelArchCompat scac,
- rhnChannel c,
- rhnChannelPermissions cp
- where cp.org_id = org_id_in
- and cp.channel_id = c.id
- and c.parent_channel is null
- and c.id = dcm.channel_id
- and c.channel_arch_id = dcm.channel_arch_id
- and dcm.release = release_in
- and scac.server_arch_id = server_arch_id_in
- and scac.channel_arch_id = c.channel_arch_id;
-
- FUNCTION get_license_path(channel_id_in IN NUMBER)
- RETURN VARCHAR2
- IS
- license_val VARCHAR2(1000);
- BEGIN
- SELECT CFL.license_path INTO license_val
- FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
- WHERE CFM.channel_id = channel_id_in
- AND CFM.channel_family_id = CFL.channel_family_id;
-
- RETURN license_val;
-
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END get_license_path;
-
-
- PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
- IS
- channel_family_id_val NUMBER;
- BEGIN
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- IF rhn_channel.get_license_path(channel_id_in) IS NULL
- THEN
- rhn_exception.raise_exception('channel_consent_no_license');
- END IF;
-
- INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
- VALUES (channel_family_id_val, user_id_in, server_id_in);
- END license_consent;
-
- PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
- IS
- channel_parent_val rhnChannel.parent_channel%TYPE;
- parent_subscribed BOOLEAN;
- server_has_base_chan BOOLEAN;
- server_already_in_chan BOOLEAN;
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- consenting_user NUMBER;
- allowed number := 0;
- current_members_val number;
- BEGIN
- if user_id_in is not null then
- allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
- else
- allowed := 1;
- end if;
-
- if allowed = 0 then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
-
-
- SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
-
- IF channel_parent_val IS NOT NULL
- THEN
- -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
- parent_subscribed := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
- LOOP
- parent_subscribed := TRUE;
- END LOOP check_subscription;
-
- IF NOT parent_subscribed
- THEN
- RETURN;
- END IF;
- ELSE
- -- base channel
- server_has_base_chan := FALSE;
- FOR base IN server_base_subscriptions(server_id_in)
- LOOP
- server_has_base_chan := TRUE;
- END LOOP base;
-
- IF server_has_base_chan
- THEN
- rhn_exception.raise_exception('channel_server_one_base');
- END IF;
- END IF;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- SELECT org_id INTO server_org_id_val
- FROM rhnServer
- WHERE id = server_id_in;
-
- select current_members
- into current_members_val
- from rhnPrivateChannelFamily
- where org_id = server_org_id_val and channel_family_id = channel_family_id_val
- for update of current_members;
-
- available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
-
- IF available_subscriptions IS NULL OR
- available_subscriptions > 0 or
- can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
- THEN
-
- IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
- THEN
- BEGIN
-
- SELECT user_id INTO consenting_user
- FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_consent');
- END;
- END IF;
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- queue_server(server_id_in, immediate_in);
- ELSE
- rhn_exception.raise_exception('channel_family_no_subscriptions');
- END IF;
-
- END subscribe_server;
-
- function can_server_consume_virt_channl(
- server_id_in in number,
- family_id_in in number )
- return number
- is
-
- cursor server_virt_families is
- select vi.virtual_system_id, cfvsl.channel_family_id
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnVirtualInstance vi
- where
- vi.virtual_system_id = server_id_in
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- and cfvsl.channel_family_id = family_id_in
- and exists (
- select 1
- from rhnServerEntitlementView sev
- where vi.host_system_id = sev.server_id
- and sev.server_group_type_id = sgtvsl.server_group_type_id );
- begin
-
- for server_virt_family in server_virt_families loop
- return 1;
- end loop;
-
- return 0;
-
- end;
-
-
- PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END LOOP server;
- END bulk_subscribe_server;
-
- PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- IF rhn_server.can_change_base_channel(server.element) = 1
- THEN
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END IF;
- END LOOP server;
- END bulk_server_base_change;
-
- procedure bulk_server_basechange_from(
- set_label_in in varchar2,
- set_uid_in in number,
- old_channel_id_in in number,
- new_channel_id_in in number
- ) is
- cursor servers is
- select sc.server_id id
- from rhnChannel nc,
- rhnServerChannelArchCompat scac,
- rhnServer s,
- rhnChannel oc,
- rhnServerChannel sc,
- rhnSet st
- where 1=1
- -- first, find the servers we're looking for.
- and st.label = set_label_in
- and st.user_id = set_uid_in
- and st.element = sc.server_id
- -- now, filter out anything that's not in the
- -- old base channel.
- and sc.channel_id = old_channel_id_in
- and sc.channel_id = oc.id
- and oc.parent_channel is null
- -- now, see if it's compatible with the new base channel
- and nc.id = new_channel_id_in
- and nc.parent_channel is null
- and sc.server_id = s.id
- and s.server_arch_id = scac.server_arch_id
- and scac.channel_arch_id = nc.channel_arch_id;
- begin
- for s in servers loop
- insert into rhnSet (
- user_id, label, element
- ) values (
- set_uid_in,
- set_label_in || 'basechange',
- s.id
- );
- end loop channel;
- bulk_server_base_change(new_channel_id_in,
- set_label_in || 'basechange',
- set_uid_in);
- delete from rhnSet
- where label = set_label_in||'basechange'
- and user_id = set_uid_in;
- end bulk_server_basechange_from;
-
- procedure bulk_guess_server_base(
- set_label_in in varchar2,
- set_uid_in in number
- ) is
- channel_id number;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- -- anything that doesn't work, we just ignore
- begin
- if rhn_server.can_change_base_channel(server.element) = 1
- then
- channel_id := guess_server_base(TO_NUMBER(server.element));
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
- end if;
- exception when others then
- null;
- end;
- end loop server;
- end;
-
- function guess_server_base(
- server_id_in in number
- ) RETURN number is
- cursor server_cursor is
- select s.server_arch_id, s.release, s.org_id
- from rhnServer s
- where s.id = server_id_in;
- begin
- for s in server_cursor loop
- for channel in base_channel_cursor(s.release,
- s.server_arch_id, s.org_id)
- loop
- return channel.id;
- end loop base_channel_cursor;
- end loop server_cursor;
- -- Server not found, or no base channel applies to it
- return null;
- end;
-
- -- Private function
- function normalize_server_arch(server_arch_in in varchar2)
- return varchar2
- deterministic
- is
- suffix VARCHAR2(128) := '-redhat-linux';
- suffix_len NUMBER := length(suffix);
- begin
- if server_arch_in is NULL then
- return NULL;
- end if;
- if instr(server_arch_in, '-') > 0
- then
- -- Suffix already present
- return server_arch_in;
- end if;
- return server_arch_in || suffix;
- end normalize_server_arch;
-
- --
- --
- -- Raises:
- -- server_arch_not_found
- -- no_subscribe_permissions
- function base_channel_for_release_arch(
- release_in in varchar2,
- server_arch_in in varchar2,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- server_arch varchar2(256) := normalize_server_arch(server_arch_in);
- server_arch_id number;
- begin
- -- Look up the server arch
- begin
- select id
- into server_arch_id
- from rhnServerArch
- where label = server_arch;
- exception
- when no_data_found then
- rhn_exception.raise_exception('server_arch_not_found');
- end;
- return base_channel_rel_archid(release_in, server_arch_id,
- org_id_in, user_id_in);
- end base_channel_for_release_arch;
-
- function base_channel_rel_archid(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- denied_channel_id number := null;
- valid_org_id number := org_id_in;
- valid_user_id number := user_id_in;
- channel_subscribable number;
- begin
- if org_id_in = -1 and user_id_in is not null then
- -- Get the org id from the user id
- begin
- select org_id
- into valid_org_id
- from web_contact
- where id = user_id_in;
- exception
- when no_data_found then
- -- User doesn't exist
- -- XXX Only list public stuff for now
- valid_user_id := null;
- valid_org_id := -1;
- end;
- end if;
-
- for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
- loop
- -- This row is a possible match
- if valid_user_id is null then
- -- User ID not specified, so no user to channel permissions to
- -- check
- return c.id;
- end if;
-
- -- Check user to channel permissions
- select loose_user_role_check(c.id, user_id_in, 'subscribe')
- into channel_subscribable
- from dual;
-
- if channel_subscribable = 1 then
- return c.id;
- end if;
-
- -- Base channel exists, but is not subscribable; keep trying
- denied_channel_id := c.id;
- end loop base_channel_fetch;
-
- if denied_channel_id is not null then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
- -- No base channel applies
- return NULL;
- end base_channel_rel_archid;
-
- procedure bulk_guess_server_base_from(
- set_label_in in varchar2,
- set_uid_in in number,
- channel_id_in in number
- ) is
- cursor channels(server_id_in in number) is
- select rsc.channel_id
- from rhnServerChannel rsc,
- rhnChannel rc
- where server_id_in = rsc.server_id
- and rsc.channel_id = rc.id
- and rc.parent_channel is null;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- for channel in channels(server.element)
- loop
- if channel.channel_id = channel_id_in
- then
- insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
- end if;
- end loop channel;
- end loop server;
- bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
- delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
- end;
-
-
- PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
- IS
- cursor server_channels(server_id_in in number) is
- select s.org_id, sc.channel_id, cfm.channel_family_id
- from rhnServer s,
- rhnServerChannel sc,
- rhnChannelFamilyMembers cfm
- where s.id = server_id_in
- and s.id = sc.server_id
- and sc.channel_id = cfm.channel_id;
- BEGIN
- for channel in server_channels(server_id_in)
- loop
- unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
- rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
- end loop channel;
- END clear_subscriptions;
-
- PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
- deleting_server IN NUMBER := 0 )
- IS
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- server_already_in_chan BOOLEAN;
- cursor channel_family_is_proxy(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-proxy';
- cursor channel_family_is_satellite(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-satellite';
- -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
- -- with the package-level one, we get a "cursor already open", so we need a
- -- copy on our call stack instead. GROAN.
- cursor local_chk_server_parent_memb (
- server_id_in number,
- channel_id_in number ) is
- select c.id
- from rhnChannel c,
- rhnServerChannel sc
- where 1=1
- and c.parent_channel = channel_id_in
- and c.id = sc.channel_id
- and sc.server_id = server_id_in;
- BEGIN
- FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
- LOOP
- if unsubscribe_children_in = 1 then
- unsubscribe_server(server_id_in => server_id_in,
- channel_id_in => child.id,
- immediate_in => immediate_in,
- unsubscribe_children_in => unsubscribe_children_in,
- deleting_server => deleting_server);
- else
- rhn_exception.raise_exception('channel_unsubscribe_child_exists');
- end if;
- END LOOP child;
-
- server_already_in_chan := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF NOT server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- if deleting_server = 0 then
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
-
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- end if;
-
- DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
-
- if deleting_server = 0 then
- queue_server(server_id_in, immediate_in);
- end if;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_unsubscribe_no_family');
- END IF;
-
- for ignore in channel_family_is_satellite(channel_family_id_val) loop
- delete from rhnSatelliteInfo where server_id = server_id_in;
- delete from rhnSatelliteChannelFamily where server_id = server_id_in;
- end loop;
-
- for ignore in channel_family_is_proxy(channel_family_id_val) loop
- delete from rhnProxyInfo where server_id = server_id_in;
- end loop;
-
- DELETE FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- SELECT org_id INTO server_org_id_val
- FROM rhnServer
- WHERE id = server_id_in;
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- END unsubscribe_server;
-
- PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
- END LOOP server;
- END bulk_unsubscribe_server;
-
- FUNCTION family_for_channel(channel_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN channel_family_id_val;
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END family_for_channel;
-
- FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- cfp channel_family_perm_cursor%ROWTYPE;
- current_members_val NUMBER;
- max_members_val NUMBER;
- found NUMBER;
- BEGIN
- IF NOT channel_family_perm_cursor%ISOPEN
- THEN
- OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
- END IF;
-
- FETCH channel_family_perm_cursor INTO cfp;
-
- WHILE channel_family_perm_cursor%FOUND
- LOOP
- found := 1;
-
- current_members_val := cfp.current_members;
- max_members_val := cfp.max_members;
-
- FETCH channel_family_perm_cursor INTO cfp;
- END LOOP;
-
- IF channel_family_perm_cursor%ISOPEN
- THEN
- CLOSE channel_family_perm_cursor;
- END IF;
-
- -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
- -- either way, there are no available subscriptions
-
- IF found IS NULL
- THEN
- RETURN 0;
- END IF;
-
- -- null max members? in that case, pass it on; NULL means infinite
- IF max_members_val IS NULL
- THEN
- RETURN NULL;
- END IF;
-
- -- otherwise, return the delta
- RETURN max_members_val - current_members_val;
- END available_family_subscriptions;
-
- -- *******************************************************************
- -- FUNCTION: channel_family_current_members
- -- Calculates and returns the actual count of systems consuming
- -- physical channel subscriptions.
- -- Called by: update_family_counts
- -- rhn_entitlements.repoll_virt_guest_entitlements
- -- *******************************************************************
- function channel_family_current_members(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- return number
- is
- current_members_count number := 0;
- begin
- select count(sc.server_id)
- into current_members_count
- from rhnChannelFamilyMembers cfm,
- rhnServerChannel sc,
- rhnServer s
- where s.org_id = org_id_in
- and s.id = sc.server_id
- and cfm.channel_family_id = channel_family_id_in
- and cfm.channel_id = sc.channel_id
- and exists (
- select 1
- from rhnChannelFamilyServerPhysical cfsp
- where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
- and cfsp.server_id = s.id
- );
-
- return current_members_count;
- end;
-
- PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- IS
- BEGIN
- update rhnPrivateChannelFamily
- set current_members = (
- channel_family_current_members(channel_family_id_in, org_id_in)
- )
- where org_id = org_id_in
- and channel_family_id = channel_family_id_in;
- END update_family_counts;
-
- FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
- org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN rhn_channel.available_family_subscriptions(
- channel_family_id_val, org_id_in);
- END available_chan_subscriptions;
-
- -- *******************************************************************
- -- PROCEDURE: entitle_customer
- -- Creates a chan fam bucket, or sets max_members for an existing bucket
- -- Called by: rhn_ep.poll_customer_internal
- -- Calls: set_family_maxmembers + update_family_counts if the row
- -- already exists, else it creates it in rhnPrivateChannelFamily.
- -- *******************************************************************
- procedure entitle_customer(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor permissions is
- select 1
- from rhnPrivateChannelFamily pcf
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- begin
- for perm in permissions loop
- set_family_maxmembers(
- customer_id_in,
- channel_family_id_in,
- quantity_in
- );
- rhn_channel.update_family_counts(
- channel_family_id_in,
- customer_id_in
- );
- return;
- end loop;
-
- insert into rhnPrivateChannelFamily pcf (
- channel_family_id, org_id, max_members, current_members
- ) values (
- channel_family_id_in, customer_id_in, quantity_in, 0
- );
- end;
-
- -- *******************************************************************
- -- PROCEDURE: set_family_maxmembers
- -- Prunes an existing channel family bucket by unsubscribing the
- -- necessary servers and sets max_members.
- -- Called by: rhn_channel.entitle_customer
- -- Calls: unsubscribe_server_from_family
- -- *******************************************************************
- procedure set_family_maxmembers(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor servers is
- select server_id from (
- select rownum row_number, server_id, modified from (
- select rcfsp.server_id,
- rcfsp.modified
- from rhnChannelFamilyServerPhysical rcfsp
- where rcfsp.customer_id = customer_id_in
- and rcfsp.channel_family_id = channel_family_id_in
- order by modified
- )
- where rownum > quantity_in
- );
- begin
- -- prune subscribed servers
- for server in servers loop
- rhn_channel.unsubscribe_server_from_family(server.server_id,
- channel_family_id_in);
- end loop;
-
- update rhnPrivateChannelFamily pcf
- set pcf.max_members = quantity_in
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- end;
-
- procedure unsubscribe_server_from_family(server_id_in in number,
- channel_family_id_in in number)
- is
- begin
- delete
- from rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and channel_id in (
- select rcfm.channel_id
- from rhnChannelFamilyMembers rcfm
- where rcfm.channel_family_id = channel_family_id_in);
- end;
-
- function get_org_id(channel_id_in in number)
- return number
- is
- org_id_out number;
- begin
- select org_id into org_id_out
- from rhnChannel
- where id = channel_id_in;
-
- return org_id_out;
- end get_org_id;
-
- function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
- return number
- is
- cursor families is
- select 1
- from rhnOrgChannelFamilyPermissions cfp
- where cfp.org_id = org_id_in;
- begin
- -- the idea: if we get past this query,
- -- the user has the role, else catch the exception and return 0
- for family in families loop
- return 1;
- end loop;
- return 0;
- end;
-
- function get_org_access(channel_id_in in number, org_id_in in number)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query,
- -- the org has access to the channel, else catch the exception and return 0
- select distinct 1 into throwaway
- from rhnChannelFamilyMembers CFM,
- rhnOrgChannelFamilyPermissions CFP
- where cfp.org_id = org_id_in
- and CFM.channel_family_id = CFP.channel_family_id
- and CFM.channel_id = channel_id_in
- and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if a user has a given role, or if such a role is inferrable
- function user_role_check_debug(channel_id_in in number,
- user_id_in in number,
- role_in in varchar2,
- reason_out out varchar2)
- return number
- is
- org_id number;
- begin
- org_id := rhn_user.get_org_id(user_id_in);
-
- if role_in = 'manage' and
- NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
- reason_out := 'channel_not_owned';
- return 0;
- end if;
-
- if role_in = 'subscribe' and
- rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
- reason_out := 'channel_not_available';
- return 0;
- end if;
-
- -- channel admins have all roles
- if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
- reason_out := 'channel_admin';
- return 1;
- end if;
-
- -- the subscribe permission is inferred
- -- UNLESS the not_globally_subscribable flag is set
- if role_in = 'subscribe'
- then
- if rhn_channel.org_channel_setting(channel_id_in,
- org_id,
- 'not_globally_subscribable') = 0 then
- reason_out := 'globally_subscribable';
- return 1;
- end if;
- end if;
-
- -- all other roles (manage right now) are explicitly granted
- reason_out := 'direct_permission';
- return rhn_channel.direct_user_role_check(channel_id_in,
- user_id_in, role_in);
- end;
-
- -- same as above, but with no OUT param; useful in views, etc
- function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway varchar2(256);
- begin
- return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
- end;
-
- -- same as above, but returns 1 if user_id_in is null
- -- This is useful in queries where user_id is not specified
- function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- begin
- if user_id_in is null then
- return 1;
- end if;
- return user_role_check(channel_id_in, user_id_in, role_in);
- end loose_user_role_check;
-
- -- directly checks the table, no inferred permissions
- function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
- select 1 into throwaway
- from rhnChannelPermissionRole CPR,
- rhnChannelPermission CP
- where CP.user_id = user_id_in
- and CP.channel_id = channel_id_in
- and CPR.label = role_in
- and CP.role_id = CPR.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if an org has a certain setting
- function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
- select 1 into throwaway
- from rhnOrgChannelSettingsType OCST,
- rhnOrgChannelSettings OCS
- where OCS.org_id = org_id_in
- and OCS.channel_id = channel_id_in
- and OCST.label = setting_in
- and OCS.setting_id = OCST.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- FUNCTION channel_priority(channel_id_in IN number)
- RETURN number
- IS
- channel_name varchar2(64);
- priority number;
- end_of_life_val date;
- org_id_val number;
- BEGIN
-
- select name, end_of_life, org_id
- into channel_name, end_of_life_val, org_id_val
- from rhnChannel
- where id = channel_id_in;
-
- if end_of_life_val is not null then
- return -400;
- end if;
-
- if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
- priority := 1000;
- if channel_name not like '%Beta%' then
- priority := priority + 1000;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 5%' then 600
- when channel_name like '%v. 4%' then 500
- when channel_name like '%v. 3%' then 400
- when channel_name like '%v. 2%' then 300
- when channel_name like '%v. 1%' then 200
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
- when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
- when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
- when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
- when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
- when channel_name like '%Extras%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%)' then 5
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
- elsif channel_name like 'Red Hat Desktop%' then
- priority := 900;
-
- if channel_name not like '%Beta%' then
- priority := priority + 50;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 4%' then 40
- when channel_name like '%v. 3%' then 30
- when channel_name like '%v. 2%' then 20
- when channel_name like '%v. 1%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
-
- elsif org_id_val is not null then
- priority := 600;
- else
- priority := 500;
- end if;
-
- return -priority;
-
- end channel_priority;
-
- -- right now this only does the accounting changes; the cascade
- -- actually does the rhnServerChannel delete.
- procedure delete_server_channels(server_id_in in number)
- is
- begin
- update rhnPrivateChannelFamily
- set current_members = current_members -1
- where org_id in (
- select org_id
- from rhnServer
- where id = server_id_in
- )
- and channel_family_id in (
- select rcfm.channel_family_id
- from rhnChannelFamilyMembers rcfm,
- rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and rsc.channel_id = rcfm.channel_id
- and not exists (
- select 1
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnServerEntitlementView sev,
- rhnVirtualInstance vi
- where
- -- system is a virtual instance
- vi.virtual_system_id = server_id_in
- and vi.host_system_id = sev.server_id
- -- system's host has a virt ent
- and sev.label in ('virtualization_host',
- 'virtualization_host_platform')
- and sev.server_group_type_id =
- sgtvsl.server_group_type_id
- -- the host's virt ent grants a cf virt sub level
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- -- the cf is in that virt sub level
- and cfvsl.channel_family_id = rcfm.channel_family_id
- )
- );
- end;
-
- -- this could certainly be optimized to do updates if needs be
- procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
- is
- begin
- delete from rhnChannelNewestPackage where channel_id = channel_id_in;
- insert into rhnChannelNewestPackage
- ( channel_id, name_id, evr_id, package_id, package_arch_id )
- ( select channel_id,
- name_id, evr_id,
- package_id, package_arch_id
- from rhnChannelNewestPackageView
- where channel_id = channel_id_in
- );
- insert into rhnChannelNewestPackageAudit (channel_id, caller)
- values (channel_id_in, caller_in);
- update rhnChannel
- set last_modified = greatest(sysdate, last_modified + 1/86400)
- where id = channel_id_in;
- end;
-
- procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
- date_to_use in date := sysdate )
- is
-
- channel_last_modified date;
- last_modified_value date;
-
- cursor snapshots is
- select snapshot_id id
- from rhnSnapshotChannel
- where channel_id = channel_id_in;
-
- begin
-
- select last_modified
- into channel_last_modified
- from rhnChannel
- where id = channel_id_in;
-
- last_modified_value := date_to_use;
-
- if last_modified_value <= channel_last_modified then
- last_modified_value := last_modified_value + 1/86400;
- end if;
-
- update rhnChannel set last_modified = last_modified_value
- where id = channel_id_in;
-
- if invalidate_ss = 1 then
- for snapshot in snapshots loop
- update rhnSnapshot
- set invalid = lookup_snapshot_invalid_reason('channel_modified')
- where id = snapshot.id;
- end loop;
- end if;
-
- end update_channel;
-
- procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelPackage
- where package_id = package_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we want to invalidate the snapshot assocated with the channel when we
- -- do this b/c we know we've added or removed or packages
- rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
- end loop;
- end update_channels_by_package;
-
-
- procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelErrata
- where errata_id = errata_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we won't invalidate snapshots, b/c just changing the errata associated with
- -- a channel shouldn't invalidate snapshots
- rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
- end loop;
- end update_channels_by_errata;
-
-END rhn_channel;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.75 2005/03/04 00:04:19 jslagle
--- bz #147617
--- Made Red Hat Desktop sort a little better.
---
--- Revision 1.74 2005/02/22 03:24:47 jslagle
--- bz #147617
--- Improve channel_priority function to order channels better.
---
--- Revision 1.73 2004/08/16 20:39:30 pjones
--- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
---
--- Revision 1.72 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.71 2004/04/13 16:28:36 bretm
--- bugzilla: 119871
---
--- keep track of rhnServer.channels_changed through the pl/sql fns
---
--- Revision 1.70 2004/03/26 18:11:32 rbb
--- Bugzilla: 114057
---
--- Add a script to determine channel priority.
---
--- Revision 1.69 2004/02/17 20:16:52 pjones
--- bugzilla: none -- add cvs tags into the package as long as we're touching
--- it anyway
---
--- Revision 1.68 2004/02/17 20:05:38 pjones
--- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
--- with arches incompatible with the target channel
---
--- Revision 1.67 2004/02/06 02:36:10 misa
--- Changed normalize_server_arch to allow for solaris arches
---
--- Revision 1.66 2003/11/13 16:58:34 cturner
--- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
---
--- Revision 1.65 2003/10/23 20:26:24 bretm
--- bugzilla: none
---
--- note the channel label when we unsubscribe, too
---
--- Revision 1.64 2003/10/15 14:47:17 bretm
--- bugzilla: none
---
--- add the channel label to the server history summary line when we log a channel change
---
--- Revision 1.63 2003/09/24 19:25:56 pjones
--- this wasn't the right fix, put it back
---
--- Revision 1.62 2003/09/24 17:42:19 pjones
--- bugzilla: none
---
--- limit our server base channel guess to channels with available permissions
---
--- Revision 1.61 2003/09/22 21:00:40 cturner
--- add method for easy acl check
---
--- Revision 1.60 2003/09/17 22:14:11 misa
--- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
---
--- Revision 1.59 2003/08/21 13:41:17 cturner
--- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
---
--- Revision 1.58 2003/07/24 16:46:22 cturner
--- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
---
--- Revision 1.57 2003/07/24 16:44:16 misa
--- bugzilla: none A function more usable on the rhnapp side
---
--- Revision 1.56 2003/07/23 22:36:51 cturner
--- argh, max returns null even when now rows; use distinct. how revolting
---
--- Revision 1.55 2003/07/23 22:01:31 cturner
--- oops, this one can return multiple rows; eliminate that in a lazy way
---
--- Revision 1.54 2003/07/23 21:59:19 cturner
--- rework how rhnUserChannel works; move to plsql for speed and maintenance
---
--- Revision 1.53 2003/07/21 17:49:12 pjones
--- bugzilla: none
---
--- add optional user for subscribe_server
---
--- Revision 1.52 2003/07/14 22:19:29 misa
--- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
---
--- Revision 1.51 2003/06/26 22:09:04 pjones
--- bugzilla: none
---
--- log subscribe and unsubscribe
---
--- Revision 1.50 2003/06/05 19:31:15 pjones
--- bugzilla: 88278 -- make the cursor name smaller
---
--- Revision 1.49 2003/06/05 19:18:21 pjones
--- bugzilla: 88278
---
--- unsubscribe_server() opens the package-level cursor when it invokes itself,
--- so we're using a local copy instead.
---
--- Revision 1.48 2003/06/04 16:41:39 pjones
--- bugzilla: none
---
--- make bulk_guess_server_base() silently ignore unguessables
---
--- Revision 1.47 2003/06/04 16:27:03 pjones
--- bugzilla: 88822
---
--- eliminate the last outliers that remove things from channels without using
--- unsubscribe_server, I think.
---
--- Revision 1.46 2003/06/03 20:49:37 pjones
--- bugzilla: 88822
--- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
--- for the server in question
---
--- Revision 1.45 2003/06/02 20:41:45 pjones
--- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
--- problem. Basicly, if you're out of the channel for any reason, you're
--- also out of rhnProxyInfo/rhnProxyInfo
---
--- Revision 1.44 2003/03/24 15:26:28 pjones
--- bugzilla: 85812
---
--- bulk_server_base_change silently ignores servers that are satellites
--- or proxies, as requested.
---
--- Revision 1.43 2003/02/26 20:28:17 pjones
--- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
--- the old codepath is:
---
--- ep ->
--- rhn_ep.entitlement_run_me() ->
--- rhn_ep.poll_customer() ->
--- rhn_channel.entitle_customer()
---
--- which doesn't change current_members, even though it may remove servers
--- from the family.
---
--- There's another bug here: currently, we don't try to order forced
--- unsubscribes in any way; we just use
--- rhn_channel.unsubscribe_server_from_family . If there are any child
--- channel subscriptions, this will leave them subscribed. We really need
--- to iterate across the channels again, and subscribe any channel for which
--- there are no parent channel subscriptions.
---
--- Ugh.
---
--- Revision 1.42 2003/01/28 00:19:45 pjones
--- fix clear_subscriptions; AFAICT, this is only hit on the
--- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
--- it infrequent enough that it could be our "bad count" culprit.
---
--- Revision 1.41 2003/01/14 19:51:45 pjones
--- make setting current_members on rhnChannelFamilyPermissions work when
--- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/061-rhn_package-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/061-rhn_package-deterministic.sql
deleted file mode 100644
index 8bd505f..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/061-rhn_package-deterministic.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE rhn_package
-IS
- CURSOR channel_occupancy_cursor(package_id_in IN NUMBER) IS
- SELECT C.id channel_id, C.name channel_name
- FROM rhnChannel C,
- rhnChannelPackage CP
- WHERE C.id = CP.channel_id
- AND CP.package_id = package_id_in
- ORDER BY C.name DESC;
-
- FUNCTION canonical_name(name_in IN VARCHAR2, evr_in IN EVR_T,
- arch_in IN VARCHAR2 := NULL)
- RETURN VARCHAR2
- DETERMINISTIC;
-
- FUNCTION channel_occupancy_string(package_id_in IN NUMBER, separator_in VARCHAR2 := ', ')
- RETURN VARCHAR2;
-
-END rhn_package;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.3 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/062-rpm.pks-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/062-rpm.pks-non-deterministic.sql
deleted file mode 100644
index a6428c4..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/062-rpm.pks-non-deterministic.sql
+++ /dev/null
@@ -1,56 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
--- PL/SQL version of rpmvercompare
---
-
-CREATE OR REPLACE PACKAGE rpm AS
- FUNCTION vercmp(
- e1 VARCHAR2, v1 VARCHAR2, r1 VARCHAR2,
- e2 VARCHAR2, v2 VARCHAR2, r2 VARCHAR2)
- RETURN NUMBER
- DETERMINISTIC
- PARALLEL_ENABLE;
- PRAGMA RESTRICT_REFERENCES(vercmp, WNDS, RNDS);
-
- FUNCTION vercmpCounter
- return NUMBER
- PARALLEL_ENABLE;
- PRAGMA RESTRICT_REFERENCES(vercmpCounter, WNDS, RNDS);
-
- FUNCTION vercmpResetCounter
- return NUMBER
- PARALLEL_ENABLE;
- PRAGMA RESTRICT_REFERENCES(vercmpResetCounter, WNDS, RNDS);
-
-END rpm;
-/
-SHOW ERRORS;
-
--- $Log$
--- Revision 1.4 2002/05/10 22:08:23 pjones
--- id/log
---
--- Revision 1.3 2002/04/02 23:19:44 misa
--- Added the comparison counter and assorted functions for handling it.
---
--- Revision 1.2 2002/03/21 20:21:24 misa
--- For some reason this doesn't work. I'll further investigate it.
---
--- Revision 1.1 2002/03/21 20:14:10 misa
--- The packaged version of the PL/SQL rpmvercmp
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/063-rpm.pkb-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/063-rpm.pkb-deterministic.sql
deleted file mode 100644
index 5ccf511..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/063-rpm.pkb-deterministic.sql
+++ /dev/null
@@ -1,267 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
--- PL/SQL version of rpmvercompare
-
-CREATE OR REPLACE PACKAGE BODY rpm AS
- vercmp_counter NUMBER := 0;
-
- FUNCTION isdigit(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END isdigit;
-
-
- FUNCTION isalpha(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z')
- then
- return TRUE;
- end if;
- return FALSE;
- END isalpha;
-
-
- FUNCTION isalphanum(ch CHAR)
- RETURN BOOLEAN
- deterministic
- IS
- BEGIN
- if ascii(ch) between ascii('a') and ascii('z') or
- ascii(ch) between ascii('A') and ascii('Z') or
- ascii(ch) between ascii('0') and ascii('9')
- then
- return TRUE;
- end if;
- return FALSE;
- END isalphanum;
-
-
- FUNCTION rpmstrcmp (string1 IN VARCHAR2, string2 IN VARCHAR2)
- RETURN NUMBER
- deterministic
- IS
- digits CHAR(10) := '0123456789';
- lc_alpha CHAR(27) := 'abcdefghijklmnopqrstuvwxyz';
- uc_alpha CHAR(27) := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
- alpha CHAR(54) := lc_alpha || uc_alpha;
- str1 VARCHAR2(32767) := string1;
- str2 VARCHAR2(32767) := string2;
- one VARCHAR2(32767);
- two VARCHAR2(32767);
- isnum BOOLEAN;
- BEGIN
- if str1 is NULL or str2 is NULL
- then
- raise VALUE_ERROR;
- end if;
- -- easy comparison to see if versions are identical
- if str1 = str2
- then
- return 0;
- end if;
- -- loop through each version segment of str1 and str2 and compare them
- one := str1;
- two := str2;
-
- <<segment_loop>>
- while one is not null and two is not null
- loop
- declare
- segm1 VARCHAR2(32767);
- segm2 VARCHAR2(32767);
- begin
- --DBMS_OUTPUT.PUT_LINE('Params: ' || one || ',' || two);
- -- Throw out all non-alphanum characters
- while one is not null and not isalphanum(one)
- loop
- one := substr(one, 2);
- end loop;
- while two is not null and not isalphanum(two)
- loop
- two := substr(two, 2);
- end loop;
- --DBMS_OUTPUT.PUT_LINE('new params: ' || one || ',' || two);
-
- str1 := one;
- str2 := two;
-
- /* grab first completely alpha or completely numeric segment */
- /* leave one and two pointing to the start of the alpha or numeric */
- /* segment and walk str1 and str2 to end of segment */
-
- if str1 is not null and isdigit(str1)
- then
- str1 := ltrim(str1, digits);
- str2 := ltrim(str2, digits);
- isnum := true;
- else
- str1 := ltrim(str1, alpha);
- str2 := ltrim(str2, alpha);
- isnum := false;
- end if;
-
- --DBMS_OUTPUT.PUT_LINE('Len: ' || length(str1) || ',' || length(str2));
- -- Oracle trats the length of an empty string as null
- if str1 is not null
- then segm1 := substr(one, 1, length(one) - length(str1));
- else segm1 := one;
- end if;
-
- if str2 is not null
- then segm2 := substr(two, 1, length(two) - length(str2));
- else segm2 := two;
- end if;
-
- --DBMS_OUTPUT.PUT_LINE('Segments: ' || segm1 || ',' || segm2);
- --DBMS_OUTPUT.PUT_LINE('Rest: ' || str1 || ',' || str2);
- /* take care of the case where the two version segments are */
- /* different types: one numeric and one alpha */
- if segm1 is null then return -1; end if; /* arbitrary */
- if segm2 is null then
- if isnum then
- return 1;
- else
- return -1;
- end if;
- end if;
-
- if isnum
- then
- /* this used to be done by converting the digit segments */
- /* to ints using atoi() - it's changed because long */
- /* digit segments can overflow an int - this should fix that. */
-
- /* throw away any leading zeros - it's a number, right? */
- segm1 := ltrim(segm1, '0');
- segm2 := ltrim(segm2, '0');
-
- /* whichever number has more digits wins */
- -- length of empty string is null
- if segm1 is null and segm2 is not null
- then
- return -1;
- end if;
- if segm1 is not null and segm2 is null
- then
- return 1;
- end if;
- if length(segm1) > length(segm2) then return 1; end if;
- if length(segm2) > length(segm1) then return -1; end if;
- end if;
-
- /* strcmp will return which one is greater - even if the two */
- /* segments are alpha or if they are numeric. don't return */
- /* if they are equal because there might be more segments to */
- /* compare */
-
- if segm1 < segm2 then return -1; end if;
- if segm1 > segm2 then return 1; end if;
-
- one := str1;
- two := str2;
- end;
- end loop segment_loop;
- /* this catches the case where all numeric and alpha segments have */
- /* compared identically but the segment sepparating characters were */
- /* different */
- if one is null and two is null then return 0; end if;
-
- /* whichever version still has characters left over wins */
- if one is null then return -1; end if;
- return 1;
- END rpmstrcmp;
-
-
- FUNCTION vercmp(
- e1 VARCHAR2, v1 VARCHAR2, r1 VARCHAR2,
- e2 VARCHAR2, v2 VARCHAR2, r2 VARCHAR2)
- RETURN NUMBER
- IS
- rc NUMBER;
- BEGIN
- DECLARE
- ep1 NUMBER;
- ep2 NUMBER;
- BEGIN
- vercmp_counter := vercmp_counter + 1;
- if e1 is null then
- ep1 := 0;
- else
- ep1 := TO_NUMBER(e1);
- end if;
- if e2 is null then
- ep2 := 0;
- else
- ep2 := TO_NUMBER(e2);
- end if;
- -- Epochs are non-null; compare them
- if ep1 < ep2 then return -1; end if;
- if ep1 > ep2 then return 1; end if;
- rc := rpmstrcmp(v1, v2);
- if rc != 0 then return rc; end if;
- return rpmstrcmp(r1, r2);
- END;
-
- END vercmp;
-
- FUNCTION vercmpCounter
- RETURN NUMBER
- IS
- BEGIN
- return vercmp_counter;
- END vercmpCounter;
-
- FUNCTION vercmpResetCounter
- RETURN NUMBER
- IS
- result NUMBER;
- BEGIN
- result := vercmp_counter;
- vercmp_counter := 0;
- return result;
- END vercmpResetCounter;
-END rpm;
-/
-SHOW ERRORS;
-
--- $Log$
--- Revision 1.4 2003/09/02 18:03:50 pjones
--- bugzilla: none
---
--- our rpmvercmp doesn't match the "fixed" rpm way. Does now.
---
--- Revision 1.3 2002/05/10 22:08:23 pjones
--- id/log
---
--- Revision 1.2 2002/04/02 23:19:44 misa
--- Added the comparison counter and assorted functions for handling it.
---
--- Revision 1.1 2002/03/21 20:14:10 misa
--- The packaged version of the PL/SQL rpmvercmp
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/064-channel_name_join-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/064-channel_name_join-deterministic.sql
deleted file mode 100644
index 61303b5..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/064-channel_name_join-deterministic.sql
+++ /dev/null
@@ -1,52 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace function
-channel_name_join(sep_in in varchar2, ch_in in channel_name_t)
-return varchar2
-deterministic
-is
- ret varchar2(4000);
- i binary_integer;
-begin
- ret := '';
- i := ch_in.first;
-
- if i is null
- then
- return ret;
- end if;
-
- ret := ch_in(i);
- i := ch_in.next(i);
-
- while i is not null
- loop
- ret := ret || sep_in || ch_in(i);
- i := ch_in.next(i);
- end loop;
-
- return ret;
-end;
-/
-
--- $Log$
--- Revision 1.3 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/065-id_join-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/065-id_join-deterministic.sql
deleted file mode 100644
index 3e2dadf..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/065-id_join-deterministic.sql
+++ /dev/null
@@ -1,53 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-ID_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_id_t)
-RETURN VARCHAR2
-deterministic
-IS
- ret VARCHAR2(4000);
- i BINARY_INTEGER;
-BEGIN
- ret := '';
- i := ugi_in.FIRST;
-
- IF i IS NULL
- THEN
- RETURN ret;
- END IF;
-
- ret := ugi_in(i);
- i := ugi_in.NEXT(i);
-
- WHILE i IS NOT NULL
- LOOP
- ret := ret || sep_in || ugi_in(i);
- i := ugi_in.NEXT(i);
- END LOOP;
-
- RETURN ret;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/066-label_join-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/066-label_join-deterministic.sql
deleted file mode 100644
index 2de8201..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/066-label_join-deterministic.sql
+++ /dev/null
@@ -1,53 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LABEL_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_label_t)
-RETURN VARCHAR2
-deterministic
-IS
- ret VARCHAR2(4000);
- i BINARY_INTEGER;
-BEGIN
- ret := '';
- i := ugi_in.FIRST;
-
- IF i IS NULL
- THEN
- RETURN ret;
- END IF;
-
- ret := ugi_in(i);
- i := ugi_in.NEXT(i);
-
- WHILE i IS NOT NULL
- LOOP
- ret := ret || sep_in || ugi_in(i);
- i := ugi_in.NEXT(i);
- END LOOP;
-
- RETURN ret;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/067-lookup_channel_arch-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/067-lookup_channel_arch-non-deterministic.sql
deleted file mode 100644
index 51de490..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/067-lookup_channel_arch-non-deterministic.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_CHANNEL_ARCH(label_in IN VARCHAR2)
-RETURN NUMBER
-IS
- channel_arch_id NUMBER;
-BEGIN
- SELECT id
- INTO channel_arch_id
- FROM rhnChannelArch
- WHERE label = label_in;
-
- RETURN channel_arch_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('channel_arch_not_found');
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2004/02/20 18:08:51 pjones
--- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
--- insert
--- add changes files for nonlinux systems
---
--- Revision 1.1 2002/11/13 23:16:18 pjones
--- lookup_*_arch()
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/068-lookup_client_capability-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/068-lookup_client_capability-non-deterministic.sql
deleted file mode 100644
index a60c907..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/068-lookup_client_capability-non-deterministic.sql
+++ /dev/null
@@ -1,47 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_CLIENT_CAPABILITY(name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- cap_name_id NUMBER;
-BEGIN
- SELECT id
- INTO cap_name_id
- FROM rhnClientCapabilityName
- WHERE name = name_in;
-
- RETURN cap_name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnClientCapabilityName (id, name)
- VALUES (rhn_client_capname_id_seq.nextval, name_in)
- RETURNING id INTO cap_name_id;
- COMMIT;
- RETURN cap_name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/07/21 22:30:04 misa
--- bugzilla: none Lookup function for capabilities
---
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/069-lookup_config_filename-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/069-lookup_config_filename-non-deterministic.sql
deleted file mode 100644
index 77408c9..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/069-lookup_config_filename-non-deterministic.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_CONFIG_FILENAME(name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- SELECT id
- INTO name_id
- FROM rhnConfigFileName
- WHERE path = name_in;
-
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnConfigFileName (id, path)
- VALUES (rhn_cfname_id_seq.nextval, name_in)
- RETURNING id INTO name_id;
- COMMIT;
- RETURN name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/07/31 16:55:34 cturner
--- lookup helper function and blob for configfiles
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/070-lookup_cve-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/070-lookup_cve-non-deterministic.sql
deleted file mode 100644
index 5c0d707..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/070-lookup_cve-non-deterministic.sql
+++ /dev/null
@@ -1,52 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_CVE(name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- SELECT id
- INTO name_id
- FROM rhnCve
- WHERE name = name_in;
-
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnCve (id, name)
- VALUES (rhn_cve_id_seq.nextval, name_in)
- RETURNING id INTO name_id;
- COMMIT;
- RETURN name_id;
-END LOOKUP_CVE;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2004/07/07 21:48:25 pjones
--- bugzilla: 123370 -- "end lookup_cve", to be consistent with the dbchange way
---
--- Revision 1.1 2004/07/07 17:27:36 bretm
--- bugzilla: 123370
---
--- lookup_cve utility function
---
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/071-lookup_evr-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/071-lookup_evr-non-deterministic.sql
deleted file mode 100644
index d38b4ae..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/071-lookup_evr-non-deterministic.sql
+++ /dev/null
@@ -1,48 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_EVR(e_in IN VARCHAR2, v_in IN VARCHAR2, r_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- evr_id NUMBER;
-BEGIN
- SELECT id INTO evr_id
- FROM rhnPackageEvr
- WHERE ((epoch IS NULL and e_in IS NULL) OR (epoch = e_in))
- AND version = v_in AND release = r_in;
-
- RETURN evr_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnPackageEvr (id, epoch, version, release, evr)
- VALUES (rhn_pkg_evr_seq.nextval, e_in, v_in, r_in,
- EVR_T(e_in, v_in, r_in))
- RETURNING id INTO evr_id;
- COMMIT;
- RETURN evr_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.3 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/072-lookup_package_arch-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/072-lookup_package_arch-non-deterministic.sql
deleted file mode 100644
index 34a703f..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/072-lookup_package_arch-non-deterministic.sql
+++ /dev/null
@@ -1,50 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_PACKAGE_ARCH(label_in IN VARCHAR2)
-RETURN NUMBER
-IS
- package_arch_id NUMBER;
-BEGIN
- if label_in is null then
- return null;
- end if;
-
- SELECT id
- INTO package_arch_id
- FROM rhnPackageArch
- WHERE label = label_in;
-
- RETURN package_arch_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('package_arch_not_found');
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2004/02/20 18:08:51 pjones
--- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
--- insert
--- add changes files for nonlinux systems
---
--- Revision 1.1 2002/11/13 23:16:18 pjones
--- lookup_*_arch()
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/073-lookup_package_capability-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/073-lookup_package_capability-non-deterministic.sql
deleted file mode 100644
index 9cf7da4..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/073-lookup_package_capability-non-deterministic.sql
+++ /dev/null
@@ -1,55 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_PACKAGE_CAPABILITY(name_in IN VARCHAR2,
- version_in IN VARCHAR2 DEFAULT NULL)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- IF version_in IS NULL THEN
- SELECT id
- INTO name_id
- FROM rhnPackageCapability
- WHERE name = name_in
- AND version IS NULL;
- ELSE
- SELECT id
- INTO name_id
- FROM rhnPackageCapability
- WHERE name = name_in
- AND version = version_in;
- END IF;
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnPackageCapability (id, name, version)
- VALUES (rhn_pkg_capability_id_seq.nextval, name_in, version_in)
- RETURNING id INTO name_id;
- COMMIT;
- RETURN name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/03/03 16:46:51 misa
--- bugzilla: 83674 Reworked the schema for package removal
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/074-lookup_package_delta-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/074-lookup_package_delta-non-deterministic.sql
deleted file mode 100644
index 63b2272..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/074-lookup_package_delta-non-deterministic.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_PACKAGE_DELTA(n_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- SELECT id INTO name_id
- FROM rhnPackageDelta
- WHERE label = n_in;
-
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnPackageDelta (id, label)
- VALUES (rhn_packagedelta_id_seq.nextval, n_in)
- RETURNING id INTO name_id;
- COMMIT;
- RETURN name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/06/30 22:14:16 misa
--- bugzilla: none Added a lookup function for package delta
---
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/075-lookup_package_name-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/075-lookup_package_name-non-deterministic.sql
deleted file mode 100644
index 8166080..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/075-lookup_package_name-non-deterministic.sql
+++ /dev/null
@@ -1,58 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_PACKAGE_NAME(name_in IN VARCHAR2, ignore_null in number := 0)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- if ignore_null = 1 and name_in is null then
- return null;
- end if;
-
- SELECT id
- INTO name_id
- FROM rhnPackageName
- WHERE name = name_in;
-
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnPackageName (id, name)
- VALUES (rhn_pkg_name_seq.nextval, name_in)
- RETURNING id INTO name_id;
- COMMIT;
- RETURN name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.5 2003/02/28 19:58:35 pjones
--- api change for lookup_package_name
---
--- Revision 1.4 2003/02/28 19:27:32 pjones
--- make lookup_package_name return early null with null input
--- lookup_hw* in lookup_functions target
---
--- Revision 1.3 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/076-lookup_server_arch-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/076-lookup_server_arch-non-deterministic.sql
deleted file mode 100644
index 9ab75f5..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/076-lookup_server_arch-non-deterministic.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_SERVER_ARCH(label_in IN VARCHAR2)
-RETURN NUMBER
-IS
- server_arch_id NUMBER;
-BEGIN
- SELECT id
- INTO server_arch_id
- FROM rhnServerArch
- WHERE label = label_in;
-
- RETURN server_arch_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('server_arch_not_found');
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2004/02/20 18:08:51 pjones
--- bugzilla: none -- make lookup_*_arch.sql not autonomous since they never
--- insert
--- add changes files for nonlinux systems
---
--- Revision 1.1 2002/11/13 23:16:18 pjones
--- lookup_*_arch()
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql
deleted file mode 100644
index eb4a80d..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/077-lookup_snapshot_invalid_reason-non-deterministic.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-lookup_snapshot_invalid_reason(label_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- snapshot_invalid_reason_id number;
-BEGIN
- SELECT id
- INTO snapshot_invalid_reason_id
- FROM rhnSnapshotInvalidReason
- WHERE label = label_in;
-
- RETURN snapshot_invalid_reason_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('invalid_snapshot_invalid_reason');
-END;
-/
-SHOW ERRORS
-
---
--- $Log$
--- Revision 1.1 2003/10/07 20:49:18 pjones
--- bugzilla: 106188
---
--- snapshot invalidation
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/078-lookup_source_name-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/078-lookup_source_name-non-deterministic.sql
deleted file mode 100644
index cfbc58a..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/078-lookup_source_name-non-deterministic.sql
+++ /dev/null
@@ -1,46 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_SOURCE_NAME(name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- source_id NUMBER;
-BEGIN
- select id into source_id
- from rhnSourceRPM
- where name = name_in;
-
- RETURN source_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- insert into rhnSourceRPM(id, name)
- values (rhn_sourcerpm_id_seq.nextval, name_in)
- returning id into source_id;
- COMMIT;
- RETURN source_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.5 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/079-lookup_tag-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/079-lookup_tag-non-deterministic.sql
deleted file mode 100644
index 00a24ad..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/079-lookup_tag-non-deterministic.sql
+++ /dev/null
@@ -1,49 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_TAG(org_id_in IN NUMBER, name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- tag_id NUMBER;
-BEGIN
- select id into tag_id
- from rhnTag
- where org_id = org_id_in
- and name_id = lookup_tag_name(name_in);
-
- RETURN tag_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- insert into rhnTag(id, org_id, name_id)
- values (rhn_tag_id_seq.nextval, org_id_in, lookup_tag_name(name_in))
- returning id into tag_id;
- COMMIT;
- RETURN tag_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/10/16 14:23:33 bretm
--- bugzilla: 107189
---
--- o added server_id to rhnSnapshotTag
--- o added lookup_tag(org_id, tagname)
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/080-lookup_tag_name-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/080-lookup_tag_name-non-deterministic.sql
deleted file mode 100644
index 9b995b2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/080-lookup_tag_name-non-deterministic.sql
+++ /dev/null
@@ -1,47 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_TAG_NAME(name_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- name_id NUMBER;
-BEGIN
- select id into name_id
- from rhnTagName
- where name = name_in;
-
- RETURN name_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- insert into rhnTagName(id, name)
- values (rhn_tagname_id_seq.nextval, name_in)
- returning id into name_id;
- COMMIT;
- RETURN name_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.1 2003/10/15 20:29:53 bretm
--- bugzilla: 107189
---
--- 1st pass at snapshot tagging schema
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/081-lookup_transaction_package-non-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/081-lookup_transaction_package-non-deterministic.sql
deleted file mode 100644
index 5ae1c92..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/081-lookup_transaction_package-non-deterministic.sql
+++ /dev/null
@@ -1,83 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-LOOKUP_TRANSACTION_PACKAGE(o_in IN VARCHAR2, n_in IN VARCHAR2,
- e_in IN VARCHAR2, v_in IN VARCHAR2, r_in IN VARCHAR2, a_in IN VARCHAR2)
-RETURN NUMBER
-IS
- PRAGMA AUTONOMOUS_TRANSACTION;
- o_id NUMBER;
- n_id NUMBER;
- e_id NUMBER;
- p_arch_id NUMBER;
- tp_id NUMBER;
-BEGIN
- BEGIN
- SELECT id
- INTO o_id
- FROM rhnTransactionOperation
- WHERE label = o_in;
- EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('invalid_transaction_operation');
- END;
-
- SELECT LOOKUP_PACKAGE_NAME(n_in)
- INTO n_id
- FROM dual;
-
- SELECT LOOKUP_EVR(e_in, v_in, r_in)
- INTO e_id
- FROM dual;
-
- p_arch_id := NULL;
- IF a_in IS NOT NULL
- THEN
- SELECT LOOKUP_PACKAGE_ARCH(a_in)
- INTO p_arch_id
- FROM dual;
- END IF;
-
- SELECT id
- INTO tp_id
- FROM rhnTransactionPackage
- WHERE operation = o_id
- AND name_id = n_id
- AND evr_id = e_id
- AND (package_arch_id = p_arch_id OR (p_arch_id IS NULL AND package_arch_id IS NULL));
- RETURN tp_id;
-EXCEPTION
- WHEN NO_DATA_FOUND THEN
- INSERT INTO rhnTransactionPackage
- (id, operation, name_id, evr_id, package_arch_id)
- VALUES (rhn_transpack_id_seq.nextval, o_id, n_id, e_id, p_arch_id)
- RETURNING id INTO tp_id;
- COMMIT;
- RETURN tp_id;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2003/07/09 16:29:33 cturner
--- update some strings and change lookup_transaction_package to throw an exception instead of SILENTLY RETURNING NULL
---
--- Revision 1.1 2003/07/01 14:52:35 misa
--- bugzilla: 90376 Need function to add transactions in the DB
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/082-name_join-deterministic.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/082-name_join-deterministic.sql
deleted file mode 100644
index b314fec..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/082-name_join-deterministic.sql
+++ /dev/null
@@ -1,53 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE FUNCTION
-NAME_JOIN(sep_in IN VARCHAR2, ugi_in IN user_group_name_t)
-RETURN VARCHAR2
-deterministic
-IS
- ret VARCHAR2(4000);
- i BINARY_INTEGER;
-BEGIN
- ret := '';
- i := ugi_in.FIRST;
-
- IF i IS NULL
- THEN
- RETURN ret;
- END IF;
-
- ret := ugi_in(i);
- i := ugi_in.NEXT(i);
-
- WHILE i IS NOT NULL
- LOOP
- ret := ret || sep_in || ugi_in(i);
- i := ugi_in.NEXT(i);
- END LOOP;
-
- RETURN ret;
-END;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.2 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/083-truncateCacheQueue-execute-immediate.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/083-truncateCacheQueue-execute-immediate.sql
deleted file mode 100644
index 9ee020b..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/083-truncateCacheQueue-execute-immediate.sql
+++ /dev/null
@@ -1,29 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace procedure truncateCacheQueue as
-begin
- execute immediate 'Truncate Table rhnOrgErrataCacheQueue';
-end;
-/
-
--- $Log$
--- Revision 1.2 2002/05/13 22:53:38 pjones
--- cvs id/log
--- some (note enough) readability fixes
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/084-rhnServerNeededPackageCache-indexes.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/084-rhnServerNeededPackageCache-indexes.sql
deleted file mode 100644
index 26ba826..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/084-rhnServerNeededPackageCache-indexes.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-
-drop index rhn_snpc_pid_eid_sid_idx;
-drop index rhn_snpc_sid_pid_eid_idx;
-drop index rhn_snpc_eid_sid_pid_idx;
-drop index rhn_snpc_oid_eid_sid_idx;
-
-create index rhn_snpc_pid_idx
- on rhnServerNeededPackageCache(package_id)
- parallel
- tablespace [[128m_tbs]]
- storage ( pctincrease 1 freelists 16 )
- pctfree 10
- initrans 32
- nologging;
-
-create index rhn_snpc_sid_idx
- on rhnServerNeededPackageCache(server_id)
- parallel
- tablespace [[128m_tbs]]
- storage ( pctincrease 1 freelists 16 )
- pctfree 10
- initrans 32
- nologging;
-
-create index rhn_snpc_eid_idx
- on rhnServerNeededPackageCache(errata_id)
- parallel
- tablespace [[128m_tbs]]
- storage ( pctincrease 1 freelists 16 )
- pctfree 10
- initrans 32
- nologging;
-
-create index rhn_snpc_oid_idx
- on rhnServerNeededPackageCache(org_id)
- parallel
- tablespace [[128m_tbs]]
- storage ( pctincrease 1 freelists 16 )
- pctfree 10
- initrans 32
- nologging;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/090-enable-row-movement.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/090-enable-row-movement.sql
deleted file mode 100644
index 7d10acf..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/090-enable-row-movement.sql
+++ /dev/null
@@ -1,391 +0,0 @@
-
-alter table PXTSessions enable row movement;
-alter table demo_log enable row movement;
-alter table rhnAction enable row movement;
-alter table rhnActionConfigChannel enable row movement;
-alter table rhnActionConfigDate enable row movement;
-alter table rhnActionConfigDateFile enable row movement;
-alter table rhnActionConfigFileName enable row movement;
-alter table rhnActionConfigRevision enable row movement;
-alter table rhnActionConfigRevisionResult enable row movement;
-alter table rhnActionDaemonConfig enable row movement;
-alter table rhnActionErrataUpdate enable row movement;
-alter table rhnActionKickstart enable row movement;
-alter table rhnActionKickstartFileList enable row movement;
-alter table rhnActionKickstartGuest enable row movement;
-alter table rhnActionPackage enable row movement;
-alter table rhnActionPackageAnswerfile enable row movement;
-alter table rhnActionPackageDelta enable row movement;
-alter table rhnActionPackageOrder enable row movement;
-alter table rhnActionPackageRemovalFailure enable row movement;
-alter table rhnActionScript enable row movement;
-alter table rhnActionStatus enable row movement;
-alter table rhnActionTransactions enable row movement;
-alter table rhnActionType enable row movement;
-alter table rhnActionVirtDestroy enable row movement;
-alter table rhnActionVirtReboot enable row movement;
-alter table rhnActionVirtRefresh enable row movement;
-alter table rhnActionVirtResume enable row movement;
-alter table rhnActionVirtSchedulePoller enable row movement;
-alter table rhnActionVirtSetMemory enable row movement;
-alter table rhnActionVirtShutdown enable row movement;
-alter table rhnActionVirtStart enable row movement;
-alter table rhnActionVirtSuspend enable row movement;
-alter table rhnActionVirtVcpu enable row movement;
-alter table rhnActivationKey enable row movement;
-alter table rhnAppInstallInstance enable row movement;
-alter table rhnAppInstallSession enable row movement;
-alter table rhnAppInstallSessionData enable row movement;
-alter table rhnArchType enable row movement;
-alter table rhnArchTypeActions enable row movement;
-alter table rhnBeehivePathMap enable row movement;
-alter table rhnBlacklistObsoletes enable row movement;
-alter table rhnCVE enable row movement;
-alter table rhnChannel enable row movement;
-alter table rhnChannelArch enable row movement;
-alter table rhnChannelCloned enable row movement;
-alter table rhnChannelComps enable row movement;
-alter table rhnChannelDownloads enable row movement;
-alter table rhnChannelErrata enable row movement;
-alter table rhnChannelFamily enable row movement;
-alter table rhnChannelFamilyLicense enable row movement;
-alter table rhnChannelFamilyLicenseConsent enable row movement;
-alter table rhnChannelFamilyMembers enable row movement;
-alter table rhnChannelFamilyVirtSubLevel enable row movement;
-alter table rhnChannelNewestPackage enable row movement;
-alter table rhnChannelNewestPackageAudit enable row movement;
-alter table rhnChannelPackage enable row movement;
-alter table rhnChannelPackageArchCompat enable row movement;
-alter table rhnChannelParent enable row movement;
-alter table rhnChannelPermission enable row movement;
-alter table rhnChannelPermissionRole enable row movement;
-alter table rhnChannelProduct enable row movement;
-alter table rhnClientCapability enable row movement;
-alter table rhnClientCapabilityName enable row movement;
-alter table rhnConfigChannel enable row movement;
-alter table rhnConfigChannelType enable row movement;
-alter table rhnConfigContent enable row movement;
-alter table rhnConfigFile enable row movement;
-alter table rhnConfigFileFailure enable row movement;
-alter table rhnConfigFileName enable row movement;
-alter table rhnConfigFileState enable row movement;
-alter table rhnConfigFileType enable row movement;
-alter table rhnConfigInfo enable row movement;
-alter table rhnConfigRevision enable row movement;
-alter table rhnCpu enable row movement;
-alter table rhnCpuArch enable row movement;
-alter table rhnCryptoKey enable row movement;
-alter table rhnCryptoKeyKickstart enable row movement;
-alter table rhnCryptoKeyType enable row movement;
-alter table rhnCustomDataKey enable row movement;
-alter table rhnDaemonState enable row movement;
-alter table rhnDailySummaryQueue enable row movement;
-alter table rhnDevice enable row movement;
-alter table rhnDistChannelMap enable row movement;
-alter table rhnDownloadType enable row movement;
-alter table rhnDownloads enable row movement;
-alter table rhnEmailAddress enable row movement;
-alter table rhnEmailAddressLog enable row movement;
-alter table rhnEmailAddressState enable row movement;
-alter table rhnEntitlementLog enable row movement;
-alter table rhnErrata enable row movement;
-alter table rhnErrataBuglist enable row movement;
-alter table rhnErrataBuglistTmp enable row movement;
-alter table rhnErrataCVE enable row movement;
-alter table rhnErrataCloned enable row movement;
-alter table rhnErrataClonedTmp enable row movement;
-alter table rhnErrataFile enable row movement;
-alter table rhnErrataFileChannel enable row movement;
-alter table rhnErrataFileChannelTmp enable row movement;
-alter table rhnErrataFilePackage enable row movement;
-alter table rhnErrataFilePackageSource enable row movement;
-alter table rhnErrataFilePackageTmp enable row movement;
-alter table rhnErrataFileTmp enable row movement;
-alter table rhnErrataFileType enable row movement;
-alter table rhnErrataKeyword enable row movement;
-alter table rhnErrataKeywordTmp enable row movement;
-alter table rhnErrataNotificationQueue enable row movement;
-alter table rhnErrataPackage enable row movement;
-alter table rhnErrataPackageTmp enable row movement;
-alter table rhnErrataQueue enable row movement;
-alter table rhnErrataSeverity enable row movement;
-alter table rhnErrataTmp enable row movement;
-alter table rhnException enable row movement;
-alter table rhnFAQ enable row movement;
-alter table rhnFAQClass enable row movement;
-alter table rhnFeature enable row movement;
-alter table rhnFile enable row movement;
-alter table rhnFileDownload enable row movement;
-alter table rhnFileList enable row movement;
-alter table rhnFileListMembers enable row movement;
-alter table rhnFileLocation enable row movement;
-alter table rhnGrailComponentChoices enable row movement;
-alter table rhnGrailComponents enable row movement;
-alter table rhnIndexerWork enable row movement;
-alter table rhnInfoPane enable row movement;
-alter table rhnKSData enable row movement;
-alter table rhnKSInstallType enable row movement;
-alter table rhnKSTreeFile enable row movement;
-alter table rhnKSTreeType enable row movement;
-alter table rhnKickstartChildChannel enable row movement;
-alter table rhnKickstartCommand enable row movement;
-alter table rhnKickstartCommandName enable row movement;
-alter table rhnKickstartDefaultRegToken enable row movement;
-alter table rhnKickstartDefaults enable row movement;
-alter table rhnKickstartIPRange enable row movement;
-alter table rhnKickstartPackage enable row movement;
-alter table rhnKickstartPreserveFileList enable row movement;
-alter table rhnKickstartScript enable row movement;
-alter table rhnKickstartSession enable row movement;
-alter table rhnKickstartSessionHistory enable row movement;
-alter table rhnKickstartSessionState enable row movement;
-alter table rhnKickstartTimezone enable row movement;
-alter table rhnKickstartVirtualizationType enable row movement;
-alter table rhnKickstartableTree enable row movement;
-alter table rhnMessage enable row movement;
-alter table rhnMessagePriority enable row movement;
-alter table rhnMessageType enable row movement;
-alter table rhnMonitor enable row movement;
-alter table rhnMonitorGranularity enable row movement;
-alter table rhnOrgChannelSettings enable row movement;
-alter table rhnOrgChannelSettingsType enable row movement;
-alter table rhnOrgEntitlementType enable row movement;
-alter table rhnOrgEntitlements enable row movement;
-alter table rhnOrgErrataCacheQueue enable row movement;
-alter table rhnOrgInfo enable row movement;
-alter table rhnOrgQuota enable row movement;
-alter table rhnPackage enable row movement;
-alter table rhnPackageArch enable row movement;
-alter table rhnPackageCapability enable row movement;
-alter table rhnPackageChangeLog enable row movement;
-alter table rhnPackageConflicts enable row movement;
-alter table rhnPackageDelta enable row movement;
-alter table rhnPackageDeltaElement enable row movement;
-alter table rhnPackageEVR enable row movement;
-alter table rhnPackageFile enable row movement;
-alter table rhnPackageFileDeleteQueue enable row movement;
-alter table rhnPackageGroup enable row movement;
-alter table rhnPackageNEVRA enable row movement;
-alter table rhnPackageName enable row movement;
-alter table rhnPackageObsoletes enable row movement;
-alter table rhnPackageProvides enable row movement;
-alter table rhnPackageRequires enable row movement;
-alter table rhnPackageSense enable row movement;
-alter table rhnPackageSenseMap enable row movement;
-alter table rhnPackageSource enable row movement;
-alter table rhnPackageSyncBlacklist enable row movement;
-alter table rhnPathChannelMap enable row movement;
-alter table rhnPrivateChannelFamily enable row movement;
-alter table rhnProduct enable row movement;
-alter table rhnProductChannel enable row movement;
-alter table rhnProductLine enable row movement;
-alter table rhnProductName enable row movement;
-alter table rhnProvisionState enable row movement;
-alter table rhnProxyInfo enable row movement;
-alter table rhnPublicChannelFamily enable row movement;
-alter table rhnPushClient enable row movement;
-alter table rhnPushClientState enable row movement;
-alter table rhnPushDispatcher enable row movement;
-alter table rhnRam enable row movement;
-alter table rhnRedHatCanonVersion enable row movement;
-alter table rhnRegToken enable row movement;
-alter table rhnRegTokenChannels enable row movement;
-alter table rhnRegTokenConfigChannels enable row movement;
-alter table rhnRegTokenEntitlement enable row movement;
-alter table rhnRegTokenGroups enable row movement;
-alter table rhnRegTokenOrgDefault enable row movement;
-alter table rhnRegTokenPackages enable row movement;
-alter table rhnRelationshipType enable row movement;
-alter table rhnReleaseChannelMap enable row movement;
-alter table rhnSGTypeBaseAddonCompat enable row movement;
-alter table rhnSGTypeVirtSubLevel enable row movement;
-alter table rhnSNPErrataQueue enable row movement;
-alter table rhnSNPServerQueue enable row movement;
-alter table rhnSatelliteCert enable row movement;
-alter table rhnSatelliteChannelFamily enable row movement;
-alter table rhnSatelliteInfo enable row movement;
-alter table rhnSatelliteServerGroup enable row movement;
-alter table rhnSavedSearch enable row movement;
-alter table rhnSavedSearchType enable row movement;
-alter table rhnServer enable row movement;
-alter table rhnServerAction enable row movement;
-alter table rhnServerActionPackageResult enable row movement;
-alter table rhnServerActionScriptResult enable row movement;
-alter table rhnServerActionVerifyMissing enable row movement;
-alter table rhnServerActionVerifyResult enable row movement;
-alter table rhnServerArch enable row movement;
-alter table rhnServerCacheInfo enable row movement;
-alter table rhnServerChannel enable row movement;
-alter table rhnServerChannelArchCompat enable row movement;
-alter table rhnServerConfigChannel enable row movement;
-alter table rhnServerCustomDataValue enable row movement;
-alter table rhnServerDMI enable row movement;
-alter table rhnServerEvent enable row movement;
-alter table rhnServerGroup enable row movement;
-alter table rhnServerGroupMembers enable row movement;
-alter table rhnServerGroupNotes enable row movement;
-alter table rhnServerGroupType enable row movement;
-alter table rhnServerGroupTypeFeature enable row movement;
-alter table rhnServerHistory enable row movement;
-alter table rhnServerInfo enable row movement;
-alter table rhnServerInstallInfo enable row movement;
-alter table rhnServerLocation enable row movement;
-alter table rhnServerLock enable row movement;
-alter table rhnServerMessage enable row movement;
-alter table rhnServerNeededErrataCache enable row movement;
-alter table rhnServerNeededPackageCache enable row movement;
-alter table rhnServerNetInterface enable row movement;
-alter table rhnServerNetwork enable row movement;
-alter table rhnServerNotes enable row movement;
-alter table rhnServerPackage enable row movement;
-alter table rhnServerPackageArchCompat enable row movement;
-alter table rhnServerPath enable row movement;
-alter table rhnServerPreserveFileList enable row movement;
-alter table rhnServerProfile enable row movement;
-alter table rhnServerProfilePackage enable row movement;
-alter table rhnServerProfileType enable row movement;
-alter table rhnServerServerGroupArchCompat enable row movement;
-alter table rhnServerTokenRegs enable row movement;
-alter table rhnServerUuid enable row movement;
-alter table rhnSet enable row movement;
-alter table rhnSnapshot enable row movement;
-alter table rhnSnapshotChannel enable row movement;
-alter table rhnSnapshotConfigChannel enable row movement;
-alter table rhnSnapshotConfigRevision enable row movement;
-alter table rhnSnapshotInvalidReason enable row movement;
-alter table rhnSnapshotPackage enable row movement;
-alter table rhnSnapshotServerGroup enable row movement;
-alter table rhnSnapshotTag enable row movement;
-alter table rhnSolarisPackage enable row movement;
-alter table rhnSolarisPatch enable row movement;
-alter table rhnSolarisPatchPackages enable row movement;
-alter table rhnSolarisPatchSet enable row movement;
-alter table rhnSolarisPatchSetMembers enable row movement;
-alter table rhnSolarisPatchType enable row movement;
-alter table rhnSolarisPatchedPackage enable row movement;
-alter table rhnSourceRPM enable row movement;
-alter table rhnTag enable row movement;
-alter table rhnTagName enable row movement;
-alter table rhnTaskQueue enable row movement;
-alter table rhnTemplateCategory enable row movement;
-alter table rhnTemplateString enable row movement;
-alter table rhnTextMessage enable row movement;
-alter table rhnTimezone enable row movement;
-alter table rhnTinyURL enable row movement;
-alter table rhnTransaction enable row movement;
-alter table rhnTransactionElement enable row movement;
-alter table rhnTransactionOperation enable row movement;
-alter table rhnTransactionPackage enable row movement;
-alter table rhnUserDefaultSystemGroups enable row movement;
-alter table rhnUserGroup enable row movement;
-alter table rhnUserGroupMembers enable row movement;
-alter table rhnUserGroupType enable row movement;
-alter table rhnUserInfo enable row movement;
-alter table rhnUserInfoPane enable row movement;
-alter table rhnUserMessage enable row movement;
-alter table rhnUserMessageStatus enable row movement;
-alter table rhnUserMessageType enable row movement;
-alter table rhnUserReserved enable row movement;
-alter table rhnUserServerGroupPerms enable row movement;
-alter table rhnUserServerPerms enable row movement;
-alter table rhnUserServerPrefs enable row movement;
-alter table rhnVersionInfo enable row movement;
-alter table rhnVirtSubLevel enable row movement;
-alter table rhnVirtualInstance enable row movement;
-alter table rhnVirtualInstanceEventLog enable row movement;
-alter table rhnVirtualInstanceEventType enable row movement;
-alter table rhnVirtualInstanceInfo enable row movement;
-alter table rhnVirtualInstanceInstallLog enable row movement;
-alter table rhnVirtualInstanceState enable row movement;
-alter table rhnVirtualInstanceType enable row movement;
-alter table rhnVisibleObjects enable row movement;
-alter table rhnWebContactChangeLog enable row movement;
-alter table rhnWebContactChangeState enable row movement;
-alter table rhn_check_probe enable row movement;
-alter table rhn_check_suite_probe enable row movement;
-alter table rhn_check_suites enable row movement;
-alter table rhn_command enable row movement;
-alter table rhn_command_center_state enable row movement;
-alter table rhn_command_class enable row movement;
-alter table rhn_command_groups enable row movement;
-alter table rhn_command_param_threshold enable row movement;
-alter table rhn_command_parameter enable row movement;
-alter table rhn_command_queue_commands enable row movement;
-alter table rhn_command_queue_execs enable row movement;
-alter table rhn_command_queue_execs_bk enable row movement;
-alter table rhn_command_queue_instances enable row movement;
-alter table rhn_command_queue_instances_bk enable row movement;
-alter table rhn_command_queue_params enable row movement;
-alter table rhn_command_queue_sessions enable row movement;
-alter table rhn_command_requirements enable row movement;
-alter table rhn_command_target enable row movement;
-alter table rhn_config_group enable row movement;
-alter table rhn_config_macro enable row movement;
-alter table rhn_config_parameter enable row movement;
-alter table rhn_config_security_type enable row movement;
-alter table rhn_contact_group_members enable row movement;
-alter table rhn_contact_groups enable row movement;
-alter table rhn_contact_methods enable row movement;
-alter table rhn_current_alerts enable row movement;
-alter table rhn_current_state_summaries enable row movement;
-alter table rhn_db_environment enable row movement;
-alter table rhn_deployed_probe enable row movement;
-alter table rhn_environment enable row movement;
-alter table rhn_host_check_suites enable row movement;
-alter table rhn_host_probe enable row movement;
-alter table rhn_interface_monitoring enable row movement;
-alter table rhn_ll_netsaint enable row movement;
-alter table rhn_method_types enable row movement;
-alter table rhn_metrics enable row movement;
-alter table rhn_multi_scout_threshold enable row movement;
-alter table rhn_notification_formats enable row movement;
-alter table rhn_notifservers enable row movement;
-alter table rhn_os enable row movement;
-alter table rhn_os_commands_xref enable row movement;
-alter table rhn_pager_types enable row movement;
-alter table rhn_physical_location enable row movement;
-alter table rhn_probe enable row movement;
-alter table rhn_probe_param_value enable row movement;
-alter table rhn_probe_state enable row movement;
-alter table rhn_probe_types enable row movement;
-alter table rhn_quanta enable row movement;
-alter table rhn_redirect_criteria enable row movement;
-alter table rhn_redirect_email_targets enable row movement;
-alter table rhn_redirect_group_targets enable row movement;
-alter table rhn_redirect_match_types enable row movement;
-alter table rhn_redirect_method_targets enable row movement;
-alter table rhn_redirect_types enable row movement;
-alter table rhn_redirects enable row movement;
-alter table rhn_sat_cluster enable row movement;
-alter table rhn_sat_cluster_probe enable row movement;
-alter table rhn_sat_node enable row movement;
-alter table rhn_sat_node_probe enable row movement;
-alter table rhn_satellite_state enable row movement;
-alter table rhn_schedule_days enable row movement;
-alter table rhn_schedule_days_norm enable row movement;
-alter table rhn_schedule_types enable row movement;
-alter table rhn_schedule_weeks enable row movement;
-alter table rhn_schedules enable row movement;
-alter table rhn_semantic_data_type enable row movement;
-alter table rhn_server_monitoring_info enable row movement;
-alter table rhn_service_probe_origins enable row movement;
-alter table rhn_snmp_alert enable row movement;
-alter table rhn_strategies enable row movement;
-alter table rhn_threshold_type enable row movement;
-alter table rhn_time_zone_names enable row movement;
-alter table rhn_units enable row movement;
-alter table rhn_url_probe enable row movement;
-alter table rhn_url_probe_step enable row movement;
-alter table rhn_widget enable row movement;
-alter table state_change enable row movement;
-alter table time_series enable row movement;
-alter table valid_countries enable row movement;
-alter table web_contact enable row movement;
-alter table web_customer enable row movement;
-alter table web_customer_notification enable row movement;
-alter table web_user_contact_permission enable row movement;
-alter table web_user_personal_info enable row movement;
-alter table web_user_prefix enable row movement;
-alter table web_user_site_info enable row movement;
-alter table web_user_site_type enable row movement;
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/091-rhn_command_parameter_data-user.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/091-rhn_command_parameter_data-user.sql
deleted file mode 100644
index af72996..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/091-rhn_command_parameter_data-user.sql
+++ /dev/null
@@ -1,5 +0,0 @@
-
-update rhn_command_parameter
-set last_update_user = 'system'
-where last_update_user = 'nhansen';
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/092-rhn_command_parameter_data-sshbannerignore.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/092-rhn_command_parameter_data-sshbannerignore.sql
deleted file mode 100644
index b7218fb..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/092-rhn_command_parameter_data-sshbannerignore.sql
+++ /dev/null
@@ -1,127 +0,0 @@
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (25, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (26, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (27, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (28, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 45, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (29, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (30, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (31, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (99, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (105, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 140, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (106, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 55, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (107, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 65, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (109, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (117, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (118, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 37, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (123, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (226, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (228, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (230, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 32, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (249, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 37, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (274, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 85, 'text', 8, 20, 1, 1, 'system', sysdate);
-
-insert into command_parameter(command_id, param_name, param_type,
-data_type_name, description, mandatory, default_value, min_value, max_value,
-field_order, field_widget_name, field_visible_length, field_maximum_length,
-field_visible, default_value_visible, last_update_user, last_update_date)
- values (304, 'sshbannerignore', 'config', 'integer', 'SSH banner (number of lines)', 0, '',NULL, NULL, 27, 'text', 8, 20, 1, 1, 'system', sysdate);
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/093-rhnChannelCloned_triggers.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/093-rhnChannelCloned_triggers.sql
deleted file mode 100644
index d809082..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/093-rhnChannelCloned_triggers.sql
+++ /dev/null
@@ -1,41 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace trigger
-rhn_channel_cloned_comps_trig
-before insert on rhnChannelCloned
-for each row
-begin
- -- if there are not comps in the cloned channel by now,
- -- we shall clone comps from the original channel
- insert into rhnChannelComps
- ( id, channel_id, relative_filename,
- last_modified, created, modified )
- select rhn_channelcomps_id_seq.nextval, :new.id, relative_filename,
- sysdate, sysdate, sysdate
- from rhnChannelComps
- where channel_id = :new.original_id
- and not exists (
- select 1
- from rhnChannelComps x
- where x.channel_id = :new.id
- );
-end;
-/
-show errors
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql
deleted file mode 100644
index 77d255e..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/094-rhnPackageChangelog-rhn_package_changelog_id_trig.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-
-create or replace trigger
-rhn_package_changelog_id_trig
-before insert on rhnPackageChangelog
-for each row
-when (new.id is null)
-begin
- select rhn_pkg_cl_id_seq.nextval into :new.id from dual;
-end;
-/
-show errors
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/103-rhnKSData.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/103-rhnKSData.sql
deleted file mode 100644
index f4ea766..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/103-rhnKSData.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-
-alter table rhnKSData
-add preLog char(1) default('N')
- constraint rhn_ks_pre_log_nn not null
- constraint rhn_ks_pre_log_ck
- check (preLog in ('Y','N'));
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/104-rhnKSData.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/104-rhnKSData.sql
deleted file mode 100644
index b676d7c..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/104-rhnKSData.sql
+++ /dev/null
@@ -1,7 +0,0 @@
-
-alter table rhnKSData
-add kscfg char(1) default('N')
- constraint rhn_ks_cfg_save_nn not null
- constraint rhn_ks_cfg_save_ck
- check (kscfg in ('Y','N'));
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/105-rhnKSData.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/105-rhnKSData.sql
deleted file mode 100644
index 2e4a388..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/105-rhnKSData.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-
-alter table rhnKSData
-add verboseup2date char(1) default('N')
- constraint rhn_ks_verbose_up2date_nn not null
- constraint rhn_ks_verbose_up2date_ck
- check (verboseup2date in ('Y','N'));
-
-alter table rhnKSData
-add nonchrootpost char(1) default('N')
- constraint rhn_ks_nonchroot_post_nn not null
- constraint rhn_ks_nonchroot_post_ck
- check (nonchrootpost in ('Y','N'));
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/200-rhn_cache.pks.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/200-rhn_cache.pks.sql
deleted file mode 100644
index e791ed8..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/200-rhn_cache.pks.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace package
-rhn_cache
-is
- version varchar2(100) := '$Id$';
-
- -- this searches out all users who get perms...
- procedure update_perms_for_server(
- server_id_in in number
- );
-
- procedure update_perms_for_user(
- user_id_in in number
- );
-
- procedure update_perms_for_server_group(
- server_group_id_in in number
- );
-end rhn_cache;
-/
-show errors
-
---
--- $Log$
--- Revision 1.1 2004/07/02 19:14:32 pjones
--- 125937 -- tools to manipulate rhnUserServerPerms when appropriate.
---
-
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/201-rhn_cache.pkb.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/201-rhn_cache.pkb.sql
deleted file mode 100644
index 7de0b6c..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/201-rhn_cache.pkb.sql
+++ /dev/null
@@ -1,92 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace package body
-rhn_cache
-is
- body_version varchar2(100) := '$Id$';
-
- -- this searches out all users who get perms...
- procedure update_perms_for_server(
- server_id_in in number
- ) is
- begin
- delete from rhnUserServerPerms where server_id = server_id_in;
- insert into rhnUserServerPerms(user_id, server_id) (
- select distinct user_id, server_id_in
- from rhnUserServerPermsDupes
- where server_id = server_id_in
- );
- end update_perms_for_server;
-
- procedure update_perms_for_user(
- user_id_in in number
- ) is
- begin
- delete from rhnUserServerPerms
- where user_id = user_id_in
- and server_id in
- (select server_id
- from rhnUserServerPerms
- where user_id = user_id_in
- minus
- select server_id
- from rhnUserServerPermsDupes uspd
- where uspd.user_id = user_id_in);
-
- insert into rhnUserServerPerms (user_id, server_id)
- select distinct user_id_in, server_id
- from rhnUserServerPermsDupes uspd
- where uspd.user_id = user_id_in
- and not exists
- (select 1
- from rhnUserServerPerms usp
- where usp.user_id = user_id_in
- and usp.server_id = uspd.server_id);
- end update_perms_for_user;
-
- -- this means a server got added or removed, so we
- -- can't key off of a server anywhere.
- procedure update_perms_for_server_group(
- server_group_id_in in number
- ) is
- cursor users is
- -- org admins aren't affected, so don't test for them
- select usgp.user_id id
- from rhnUserServerGroupPerms usgp
- where usgp.server_group_id = server_group_id_in
- and not exists (
- select 1
- from rhnUserGroup ug,
- rhnUserGroupMembers ugm,
- rhnServerGroup sg,
- rhnUserGroupType ugt
- where ugt.label = 'org_admin'
- and sg.id = server_group_id_in
- and ugm.user_id = usgp.user_id
- and ug.org_id = sg.org_id
- and ugm.user_group_id = ug.id
- );
- begin
- for u in users loop
- update_perms_for_user(u.id);
- end loop;
- end update_perms_for_server_group;
-end rhn_cache;
-/
-show errors
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/202-rhn_channel.pks.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/202-rhn_channel.pks.sql
deleted file mode 100644
index 85826af..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/202-rhn_channel.pks.sql
+++ /dev/null
@@ -1,246 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE rhn_channel
-IS
- version varchar2(100) := '$Id$';
-
- CURSOR server_base_subscriptions(server_id_in NUMBER) IS
- SELECT C.id
- FROM rhnChannel C, rhnServerChannel SC
- WHERE C.id = SC.channel_id
- AND SC.server_id = server_id_in
- AND C.parent_channel IS NULL;
-
- CURSOR check_server_subscription(server_id_in NUMBER, channel_id_in NUMBER) IS
- SELECT channel_id
- FROM rhnServerChannel
- WHERE server_id = server_id_in
- AND channel_id = channel_id_in;
-
- CURSOR check_server_parent_membership(server_id_in NUMBER, channel_id_in NUMBER) IS
- SELECT C.id
- FROM rhnChannel C, rhnServerChannel SC
- WHERE C.parent_channel = channel_id_in
- AND C.id = SC.channel_id
- AND SC.server_id = server_id_in;
-
- CURSOR channel_family_perm_cursor(channel_family_id_in NUMBER, org_id_in NUMBER) IS
- SELECT *
- FROM rhnOrgChannelFamilyPermissions
- WHERE channel_family_id = channel_family_id_in
- AND org_id = org_id_in;
-
- PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER);
- FUNCTION get_license_path(channel_id_in IN NUMBER) RETURN VARCHAR2;
-
- PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
- deleting_server in number := 0 );
- PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in number := null);
-
- function can_server_consume_virt_channl(
- server_id_in IN NUMBER,
- family_id_in in number)
- return number;
-
- FUNCTION guess_server_base(server_id_in IN NUMBER) RETURN NUMBER;
-
- FUNCTION base_channel_for_release_arch(release_in in varchar2,
- server_arch_in in varchar2, org_id_in in number := -1,
- user_id_in in number := null) RETURN number;
-
- FUNCTION base_channel_rel_archid(release_in in varchar2,
- server_arch_id_in in number, org_id_in in number := -1,
- user_id_in in number := null) RETURN number;
-
- FUNCTION channel_priority(channel_id_in in number) RETURN number;
-
- PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
- PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
-
- PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
- procedure bulk_server_basechange_from(
- set_label_in in varchar2,
- set_uid_in in number,
- old_channel_id_in in number,
- new_channel_id_in in number);
-
- procedure bulk_guess_server_base(
- set_label_in in varchar2,
- set_uid_in in number);
-
- procedure bulk_guess_server_base_from(
- set_label_in in varchar2,
- set_uid_in in number,
- channel_id_in in number);
-
- PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server in number := 0 );
-
- FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
-
- function channel_family_current_members(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- return number;
-
- PROCEDURE update_family_counts(channel_family_id_in IN NUMBER, org_id_in IN NUMBER);
- FUNCTION family_for_channel(channel_id_in IN NUMBER) RETURN NUMBER;
-
- FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
-
- procedure entitle_customer(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
- procedure set_family_maxmembers(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
- procedure unsubscribe_server_from_family(server_id_in in number, channel_family_id_in in number);
-
- procedure delete_server_channels(server_id_in in number);
- procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)');
-
- function get_org_id(channel_id_in in number) return number;
- PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
-
- function get_org_access(channel_id_in in number, org_id_in in number) return number;
- PRAGMA RESTRICT_REFERENCES(get_org_access, WNDS, RNPS, WNPS);
-
- function get_cfam_org_access(cfam_id_in in number, org_id_in in number) return number;
-
- function user_role_check_debug(channel_id_in in number, user_id_in in number, role_in in varchar2, reason_out out varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(user_role_check_debug, WNDS, RNPS, WNPS);
-
- function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(user_role_check, WNDS, RNPS, WNPS);
-
- function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(loose_user_role_check, WNDS, RNPS, WNPS);
-
- function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(direct_user_role_check, WNDS, RNPS, WNPS);
-
- function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
- RETURN NUMBER;
-
- PROCEDURE update_channel ( channel_id_in in number, invalidate_ss in number := 0,
- date_to_use in date := sysdate );
-
- PROCEDURE update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate );
-
- PROCEDURE update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate );
-
-
- PRAGMA RESTRICT_REFERENCES(org_channel_setting, WNDS, RNPS, WNPS);
-
-END rhn_channel;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.37 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.36 2004/03/26 18:11:32 rbb
--- Bugzilla: 114057
---
--- Add a script to determine channel priority.
---
--- Revision 1.35 2004/02/17 20:16:52 pjones
--- bugzilla: none -- add cvs tags into the package as long as we're touching
--- it anyway
---
--- Revision 1.34 2003/11/13 18:13:09 cturner
--- pragmas can now return now that rhn_user pragmas are fixed
---
--- Revision 1.32 2003/09/22 21:00:40 cturner
--- add method for easy acl check
---
--- Revision 1.31 2003/09/17 22:14:11 misa
--- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
---
--- Revision 1.30 2003/07/24 16:44:16 misa
--- bugzilla: none A function more usable on the rhnapp side
---
--- Revision 1.29 2003/07/24 14:00:17 misa
--- bugzilla: none PRAGMA RESTRICT_REFERENCES good
---
--- Revision 1.28 2003/07/23 21:59:19 cturner
--- rework how rhnUserChannel works; move to plsql for speed and maintenance
---
--- Revision 1.27 2003/07/21 17:49:12 pjones
--- bugzilla: none
---
--- add optional user for subscribe_server
---
--- Revision 1.26 2002/12/19 18:13:42 misa
--- Added caller with a default value
---
--- Revision 1.25 2002/12/11 22:18:46 pjones
--- rhnChannelNewestPackage
---
--- Revision 1.24 2002/11/21 22:08:11 pjones
--- make unsubscribe_channels have a "unsubscribe_children_in number := 0"
--- argument so that you can tell it to unsubscribe children.
---
--- Also, make it raise an exception instead of silent failure in the
--- other case.
---
--- Revision 1.23 2002/11/18 17:20:50 pjones
--- this should have gone back too
---
--- Revision 1.22 2002/11/13 23:16:18 pjones
--- lookup_*_arch()
---
--- Revision 1.21 2002/10/07 20:01:59 rnorwood
--- guess base channel for ssm and single system
---
--- Revision 1.20 2002/10/02 19:21:03 bretm
--- o 3rd party channel schema changes, no more clobs...
---
--- Revision 1.19 2002/09/20 19:21:58 bretm
--- o more 3rd party channel stuff...
---
--- Revision 1.18 2002/06/12 22:33:03 pjones
--- procedure bulk_guess_server_base_from(
--- set_label_in in varchar2,
--- set_uid_in in number,
--- channel_id_in in number);
---
--- for bretm
---
--- Revision 1.17 2002/06/12 22:12:25 pjones
--- procedure bulk_guess_server_base(
--- set_label_in in varchar2,
--- set_uid_in in number);
---
--- for bretm
---
--- Revision 1.16 2002/06/12 19:37:55 pjones
--- bulk_server_basechange_from(
--- set_label_in in varchar2,
--- set_uid_in in number,
--- old_channel_id_in in number,
--- new_channel_id_in in number
--- );
---
--- for bretm
---
--- Revision 1.15 2002/05/10 22:08:22 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/203-rhn_channel.pkb.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/203-rhn_channel.pkb.sql
deleted file mode 100644
index f10baea..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/203-rhn_channel.pkb.sql
+++ /dev/null
@@ -1,1368 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_channel
-IS
- body_version varchar2(100) := '$Id$';
-
- -- Cursor that fetches all the possible base channels for a
- -- (server_arch_id, release, org_id) combination
- cursor base_channel_cursor(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number
- ) return rhnChannel%ROWTYPE is
- select distinct c.*
- from rhnDistChannelMap dcm,
- rhnServerChannelArchCompat scac,
- rhnChannel c,
- rhnChannelPermissions cp
- where cp.org_id = org_id_in
- and cp.channel_id = c.id
- and c.parent_channel is null
- and c.id = dcm.channel_id
- and c.channel_arch_id = dcm.channel_arch_id
- and dcm.release = release_in
- and scac.server_arch_id = server_arch_id_in
- and scac.channel_arch_id = c.channel_arch_id;
-
- FUNCTION get_license_path(channel_id_in IN NUMBER)
- RETURN VARCHAR2
- IS
- license_val VARCHAR2(1000);
- BEGIN
- SELECT CFL.license_path INTO license_val
- FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
- WHERE CFM.channel_id = channel_id_in
- AND CFM.channel_family_id = CFL.channel_family_id;
-
- RETURN license_val;
-
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END get_license_path;
-
-
- PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
- IS
- channel_family_id_val NUMBER;
- BEGIN
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- IF rhn_channel.get_license_path(channel_id_in) IS NULL
- THEN
- rhn_exception.raise_exception('channel_consent_no_license');
- END IF;
-
- INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
- VALUES (channel_family_id_val, user_id_in, server_id_in);
- END license_consent;
-
- PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
- IS
- channel_parent_val rhnChannel.parent_channel%TYPE;
- parent_subscribed BOOLEAN;
- server_has_base_chan BOOLEAN;
- server_already_in_chan BOOLEAN;
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- consenting_user NUMBER;
- allowed number := 0;
- current_members_val number;
- BEGIN
- if user_id_in is not null then
- allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
- else
- allowed := 1;
- end if;
-
- if allowed = 0 then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
-
-
- SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
-
- IF channel_parent_val IS NOT NULL
- THEN
- -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
- parent_subscribed := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
- LOOP
- parent_subscribed := TRUE;
- END LOOP check_subscription;
-
- IF NOT parent_subscribed
- THEN
- RETURN;
- END IF;
- ELSE
- -- base channel
- server_has_base_chan := FALSE;
- FOR base IN server_base_subscriptions(server_id_in)
- LOOP
- server_has_base_chan := TRUE;
- END LOOP base;
-
- IF server_has_base_chan
- THEN
- rhn_exception.raise_exception('channel_server_one_base');
- END IF;
- END IF;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- SELECT org_id INTO server_org_id_val
- FROM rhnServer
- WHERE id = server_id_in;
-
- select current_members
- into current_members_val
- from rhnPrivateChannelFamily
- where org_id = server_org_id_val and channel_family_id = channel_family_id_val
- for update of current_members;
-
- available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
-
- IF available_subscriptions IS NULL OR
- available_subscriptions > 0 or
- can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
- THEN
-
- IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
- THEN
- BEGIN
-
- SELECT user_id INTO consenting_user
- FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_consent');
- END;
- END IF;
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- queue_server(server_id_in, immediate_in);
- ELSE
- rhn_exception.raise_exception('channel_family_no_subscriptions');
- END IF;
-
- END subscribe_server;
-
- function can_server_consume_virt_channl(
- server_id_in in number,
- family_id_in in number )
- return number
- is
-
- cursor server_virt_families is
- select vi.virtual_system_id, cfvsl.channel_family_id
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnVirtualInstance vi
- where
- vi.virtual_system_id = server_id_in
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- and cfvsl.channel_family_id = family_id_in
- and exists (
- select 1
- from rhnServerEntitlementView sev
- where vi.host_system_id = sev.server_id
- and sev.server_group_type_id = sgtvsl.server_group_type_id );
- begin
-
- for server_virt_family in server_virt_families loop
- return 1;
- end loop;
-
- return 0;
-
- end;
-
-
- PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END LOOP server;
- END bulk_subscribe_server;
-
- PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- IF rhn_server.can_change_base_channel(server.element) = 1
- THEN
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END IF;
- END LOOP server;
- END bulk_server_base_change;
-
- procedure bulk_server_basechange_from(
- set_label_in in varchar2,
- set_uid_in in number,
- old_channel_id_in in number,
- new_channel_id_in in number
- ) is
- cursor servers is
- select sc.server_id id
- from rhnChannel nc,
- rhnServerChannelArchCompat scac,
- rhnServer s,
- rhnChannel oc,
- rhnServerChannel sc,
- rhnSet st
- where 1=1
- -- first, find the servers we're looking for.
- and st.label = set_label_in
- and st.user_id = set_uid_in
- and st.element = sc.server_id
- -- now, filter out anything that's not in the
- -- old base channel.
- and sc.channel_id = old_channel_id_in
- and sc.channel_id = oc.id
- and oc.parent_channel is null
- -- now, see if it's compatible with the new base channel
- and nc.id = new_channel_id_in
- and nc.parent_channel is null
- and sc.server_id = s.id
- and s.server_arch_id = scac.server_arch_id
- and scac.channel_arch_id = nc.channel_arch_id;
- begin
- for s in servers loop
- insert into rhnSet (
- user_id, label, element
- ) values (
- set_uid_in,
- set_label_in || 'basechange',
- s.id
- );
- end loop channel;
- bulk_server_base_change(new_channel_id_in,
- set_label_in || 'basechange',
- set_uid_in);
- delete from rhnSet
- where label = set_label_in||'basechange'
- and user_id = set_uid_in;
- end bulk_server_basechange_from;
-
- procedure bulk_guess_server_base(
- set_label_in in varchar2,
- set_uid_in in number
- ) is
- channel_id number;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- -- anything that doesn't work, we just ignore
- begin
- if rhn_server.can_change_base_channel(server.element) = 1
- then
- channel_id := guess_server_base(TO_NUMBER(server.element));
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
- end if;
- exception when others then
- null;
- end;
- end loop server;
- end;
-
- function guess_server_base(
- server_id_in in number
- ) RETURN number is
- cursor server_cursor is
- select s.server_arch_id, s.release, s.org_id
- from rhnServer s
- where s.id = server_id_in;
- begin
- for s in server_cursor loop
- for channel in base_channel_cursor(s.release,
- s.server_arch_id, s.org_id)
- loop
- return channel.id;
- end loop base_channel_cursor;
- end loop server_cursor;
- -- Server not found, or no base channel applies to it
- return null;
- end;
-
- -- Private function
- function normalize_server_arch(server_arch_in in varchar2)
- return varchar2
- deterministic
- is
- suffix VARCHAR2(128) := '-redhat-linux';
- suffix_len NUMBER := length(suffix);
- begin
- if server_arch_in is NULL then
- return NULL;
- end if;
- if instr(server_arch_in, '-') > 0
- then
- -- Suffix already present
- return server_arch_in;
- end if;
- return server_arch_in || suffix;
- end normalize_server_arch;
-
- --
- --
- -- Raises:
- -- server_arch_not_found
- -- no_subscribe_permissions
- function base_channel_for_release_arch(
- release_in in varchar2,
- server_arch_in in varchar2,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- server_arch varchar2(256) := normalize_server_arch(server_arch_in);
- server_arch_id number;
- begin
- -- Look up the server arch
- begin
- select id
- into server_arch_id
- from rhnServerArch
- where label = server_arch;
- exception
- when no_data_found then
- rhn_exception.raise_exception('server_arch_not_found');
- end;
- return base_channel_rel_archid(release_in, server_arch_id,
- org_id_in, user_id_in);
- end base_channel_for_release_arch;
-
- function base_channel_rel_archid(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- denied_channel_id number := null;
- valid_org_id number := org_id_in;
- valid_user_id number := user_id_in;
- channel_subscribable number;
- begin
- if org_id_in = -1 and user_id_in is not null then
- -- Get the org id from the user id
- begin
- select org_id
- into valid_org_id
- from web_contact
- where id = user_id_in;
- exception
- when no_data_found then
- -- User doesn't exist
- -- XXX Only list public stuff for now
- valid_user_id := null;
- valid_org_id := -1;
- end;
- end if;
-
- for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
- loop
- -- This row is a possible match
- if valid_user_id is null then
- -- User ID not specified, so no user to channel permissions to
- -- check
- return c.id;
- end if;
-
- -- Check user to channel permissions
- select loose_user_role_check(c.id, user_id_in, 'subscribe')
- into channel_subscribable
- from dual;
-
- if channel_subscribable = 1 then
- return c.id;
- end if;
-
- -- Base channel exists, but is not subscribable; keep trying
- denied_channel_id := c.id;
- end loop base_channel_fetch;
-
- if denied_channel_id is not null then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
- -- No base channel applies
- return NULL;
- end base_channel_rel_archid;
-
- procedure bulk_guess_server_base_from(
- set_label_in in varchar2,
- set_uid_in in number,
- channel_id_in in number
- ) is
- cursor channels(server_id_in in number) is
- select rsc.channel_id
- from rhnServerChannel rsc,
- rhnChannel rc
- where server_id_in = rsc.server_id
- and rsc.channel_id = rc.id
- and rc.parent_channel is null;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- for channel in channels(server.element)
- loop
- if channel.channel_id = channel_id_in
- then
- insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
- end if;
- end loop channel;
- end loop server;
- bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
- delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
- end;
-
-
- PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
- IS
- cursor server_channels(server_id_in in number) is
- select s.org_id, sc.channel_id, cfm.channel_family_id
- from rhnServer s,
- rhnServerChannel sc,
- rhnChannelFamilyMembers cfm
- where s.id = server_id_in
- and s.id = sc.server_id
- and sc.channel_id = cfm.channel_id;
- BEGIN
- for channel in server_channels(server_id_in)
- loop
- unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
- rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
- end loop channel;
- END clear_subscriptions;
-
- PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
- deleting_server IN NUMBER := 0 )
- IS
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- server_already_in_chan BOOLEAN;
- cursor channel_family_is_proxy(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-proxy';
- cursor channel_family_is_satellite(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-satellite';
- -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
- -- with the package-level one, we get a "cursor already open", so we need a
- -- copy on our call stack instead. GROAN.
- cursor local_chk_server_parent_memb (
- server_id_in number,
- channel_id_in number ) is
- select c.id
- from rhnChannel c,
- rhnServerChannel sc
- where 1=1
- and c.parent_channel = channel_id_in
- and c.id = sc.channel_id
- and sc.server_id = server_id_in;
- BEGIN
- FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
- LOOP
- if unsubscribe_children_in = 1 then
- unsubscribe_server(server_id_in => server_id_in,
- channel_id_in => child.id,
- immediate_in => immediate_in,
- unsubscribe_children_in => unsubscribe_children_in,
- deleting_server => deleting_server);
- else
- rhn_exception.raise_exception('channel_unsubscribe_child_exists');
- end if;
- END LOOP child;
-
- server_already_in_chan := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF NOT server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- if deleting_server = 0 then
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
-
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- end if;
-
- DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
-
- if deleting_server = 0 then
- queue_server(server_id_in, immediate_in);
- end if;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_unsubscribe_no_family');
- END IF;
-
- for ignore in channel_family_is_satellite(channel_family_id_val) loop
- delete from rhnSatelliteInfo where server_id = server_id_in;
- delete from rhnSatelliteChannelFamily where server_id = server_id_in;
- end loop;
-
- for ignore in channel_family_is_proxy(channel_family_id_val) loop
- delete from rhnProxyInfo where server_id = server_id_in;
- end loop;
-
- DELETE FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- SELECT org_id INTO server_org_id_val
- FROM rhnServer
- WHERE id = server_id_in;
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- END unsubscribe_server;
-
- PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
- END LOOP server;
- END bulk_unsubscribe_server;
-
- FUNCTION family_for_channel(channel_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN channel_family_id_val;
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END family_for_channel;
-
- FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- cfp channel_family_perm_cursor%ROWTYPE;
- current_members_val NUMBER;
- max_members_val NUMBER;
- found NUMBER;
- BEGIN
- IF NOT channel_family_perm_cursor%ISOPEN
- THEN
- OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
- END IF;
-
- FETCH channel_family_perm_cursor INTO cfp;
-
- WHILE channel_family_perm_cursor%FOUND
- LOOP
- found := 1;
-
- current_members_val := cfp.current_members;
- max_members_val := cfp.max_members;
-
- FETCH channel_family_perm_cursor INTO cfp;
- END LOOP;
-
- IF channel_family_perm_cursor%ISOPEN
- THEN
- CLOSE channel_family_perm_cursor;
- END IF;
-
- -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
- -- either way, there are no available subscriptions
-
- IF found IS NULL
- THEN
- RETURN 0;
- END IF;
-
- -- null max members? in that case, pass it on; NULL means infinite
- IF max_members_val IS NULL
- THEN
- RETURN NULL;
- END IF;
-
- -- otherwise, return the delta
- RETURN max_members_val - current_members_val;
- END available_family_subscriptions;
-
- -- *******************************************************************
- -- FUNCTION: channel_family_current_members
- -- Calculates and returns the actual count of systems consuming
- -- physical channel subscriptions.
- -- Called by: update_family_counts
- -- rhn_entitlements.repoll_virt_guest_entitlements
- -- *******************************************************************
- function channel_family_current_members(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- return number
- is
- current_members_count number := 0;
- begin
- select count(sc.server_id)
- into current_members_count
- from rhnChannelFamilyMembers cfm,
- rhnServerChannel sc,
- rhnServer s
- where s.org_id = org_id_in
- and s.id = sc.server_id
- and cfm.channel_family_id = channel_family_id_in
- and cfm.channel_id = sc.channel_id
- and exists (
- select 1
- from rhnChannelFamilyServerPhysical cfsp
- where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
- and cfsp.server_id = s.id
- );
-
- return current_members_count;
- end;
-
- PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- IS
- BEGIN
- update rhnPrivateChannelFamily
- set current_members = (
- channel_family_current_members(channel_family_id_in, org_id_in)
- )
- where org_id = org_id_in
- and channel_family_id = channel_family_id_in;
- END update_family_counts;
-
- FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
- org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN rhn_channel.available_family_subscriptions(
- channel_family_id_val, org_id_in);
- END available_chan_subscriptions;
-
- -- *******************************************************************
- -- PROCEDURE: entitle_customer
- -- Creates a chan fam bucket, or sets max_members for an existing bucket
- -- Called by: rhn_ep.poll_customer_internal
- -- Calls: set_family_maxmembers + update_family_counts if the row
- -- already exists, else it creates it in rhnPrivateChannelFamily.
- -- *******************************************************************
- procedure entitle_customer(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor permissions is
- select 1
- from rhnPrivateChannelFamily pcf
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- begin
- for perm in permissions loop
- set_family_maxmembers(
- customer_id_in,
- channel_family_id_in,
- quantity_in
- );
- rhn_channel.update_family_counts(
- channel_family_id_in,
- customer_id_in
- );
- return;
- end loop;
-
- insert into rhnPrivateChannelFamily pcf (
- channel_family_id, org_id, max_members, current_members
- ) values (
- channel_family_id_in, customer_id_in, quantity_in, 0
- );
- end;
-
- -- *******************************************************************
- -- PROCEDURE: set_family_maxmembers
- -- Prunes an existing channel family bucket by unsubscribing the
- -- necessary servers and sets max_members.
- -- Called by: rhn_channel.entitle_customer
- -- Calls: unsubscribe_server_from_family
- -- *******************************************************************
- procedure set_family_maxmembers(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor servers is
- select server_id from (
- select rownum row_number, server_id, modified from (
- select rcfsp.server_id,
- rcfsp.modified
- from rhnChannelFamilyServerPhysical rcfsp
- where rcfsp.customer_id = customer_id_in
- and rcfsp.channel_family_id = channel_family_id_in
- order by modified
- )
- where rownum > quantity_in
- );
- begin
- -- prune subscribed servers
- for server in servers loop
- rhn_channel.unsubscribe_server_from_family(server.server_id,
- channel_family_id_in);
- end loop;
-
- update rhnPrivateChannelFamily pcf
- set pcf.max_members = quantity_in
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- end;
-
- procedure unsubscribe_server_from_family(server_id_in in number,
- channel_family_id_in in number)
- is
- begin
- delete
- from rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and channel_id in (
- select rcfm.channel_id
- from rhnChannelFamilyMembers rcfm
- where rcfm.channel_family_id = channel_family_id_in);
- end;
-
- function get_org_id(channel_id_in in number)
- return number
- is
- org_id_out number;
- begin
- select org_id into org_id_out
- from rhnChannel
- where id = channel_id_in;
-
- return org_id_out;
- end get_org_id;
-
- function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
- return number
- is
- cursor families is
- select 1
- from rhnOrgChannelFamilyPermissions cfp
- where cfp.org_id = org_id_in;
- begin
- -- the idea: if we get past this query,
- -- the user has the role, else catch the exception and return 0
- for family in families loop
- return 1;
- end loop;
- return 0;
- end;
-
- function get_org_access(channel_id_in in number, org_id_in in number)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query,
- -- the org has access to the channel, else catch the exception and return 0
- select distinct 1 into throwaway
- from rhnChannelFamilyMembers CFM,
- rhnOrgChannelFamilyPermissions CFP
- where cfp.org_id = org_id_in
- and CFM.channel_family_id = CFP.channel_family_id
- and CFM.channel_id = channel_id_in
- and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if a user has a given role, or if such a role is inferrable
- function user_role_check_debug(channel_id_in in number,
- user_id_in in number,
- role_in in varchar2,
- reason_out out varchar2)
- return number
- is
- org_id number;
- begin
- org_id := rhn_user.get_org_id(user_id_in);
-
- if role_in = 'manage' and
- NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
- reason_out := 'channel_not_owned';
- return 0;
- end if;
-
- if role_in = 'subscribe' and
- rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
- reason_out := 'channel_not_available';
- return 0;
- end if;
-
- -- channel admins have all roles
- if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
- reason_out := 'channel_admin';
- return 1;
- end if;
-
- -- the subscribe permission is inferred
- -- UNLESS the not_globally_subscribable flag is set
- if role_in = 'subscribe'
- then
- if rhn_channel.org_channel_setting(channel_id_in,
- org_id,
- 'not_globally_subscribable') = 0 then
- reason_out := 'globally_subscribable';
- return 1;
- end if;
- end if;
-
- -- all other roles (manage right now) are explicitly granted
- reason_out := 'direct_permission';
- return rhn_channel.direct_user_role_check(channel_id_in,
- user_id_in, role_in);
- end;
-
- -- same as above, but with no OUT param; useful in views, etc
- function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway varchar2(256);
- begin
- return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
- end;
-
- -- same as above, but returns 1 if user_id_in is null
- -- This is useful in queries where user_id is not specified
- function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- begin
- if user_id_in is null then
- return 1;
- end if;
- return user_role_check(channel_id_in, user_id_in, role_in);
- end loose_user_role_check;
-
- -- directly checks the table, no inferred permissions
- function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
- select 1 into throwaway
- from rhnChannelPermissionRole CPR,
- rhnChannelPermission CP
- where CP.user_id = user_id_in
- and CP.channel_id = channel_id_in
- and CPR.label = role_in
- and CP.role_id = CPR.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if an org has a certain setting
- function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
- select 1 into throwaway
- from rhnOrgChannelSettingsType OCST,
- rhnOrgChannelSettings OCS
- where OCS.org_id = org_id_in
- and OCS.channel_id = channel_id_in
- and OCST.label = setting_in
- and OCS.setting_id = OCST.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- FUNCTION channel_priority(channel_id_in IN number)
- RETURN number
- IS
- channel_name varchar2(64);
- priority number;
- end_of_life_val date;
- org_id_val number;
- BEGIN
-
- select name, end_of_life, org_id
- into channel_name, end_of_life_val, org_id_val
- from rhnChannel
- where id = channel_id_in;
-
- if end_of_life_val is not null then
- return -400;
- end if;
-
- if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
- priority := 1000;
- if channel_name not like '%Beta%' then
- priority := priority + 1000;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 5%' then 600
- when channel_name like '%v. 4%' then 500
- when channel_name like '%v. 3%' then 400
- when channel_name like '%v. 2%' then 300
- when channel_name like '%v. 1%' then 200
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
- when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
- when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
- when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
- when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
- when channel_name like '%Extras%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%)' then 5
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
- elsif channel_name like 'Red Hat Desktop%' then
- priority := 900;
-
- if channel_name not like '%Beta%' then
- priority := priority + 50;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 4%' then 40
- when channel_name like '%v. 3%' then 30
- when channel_name like '%v. 2%' then 20
- when channel_name like '%v. 1%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
-
- elsif org_id_val is not null then
- priority := 600;
- else
- priority := 500;
- end if;
-
- return -priority;
-
- end channel_priority;
-
- -- right now this only does the accounting changes; the cascade
- -- actually does the rhnServerChannel delete.
- procedure delete_server_channels(server_id_in in number)
- is
- begin
- update rhnPrivateChannelFamily
- set current_members = current_members -1
- where org_id in (
- select org_id
- from rhnServer
- where id = server_id_in
- )
- and channel_family_id in (
- select rcfm.channel_family_id
- from rhnChannelFamilyMembers rcfm,
- rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and rsc.channel_id = rcfm.channel_id
- and not exists (
- select 1
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnServerEntitlementView sev,
- rhnVirtualInstance vi
- where
- -- system is a virtual instance
- vi.virtual_system_id = server_id_in
- and vi.host_system_id = sev.server_id
- -- system's host has a virt ent
- and sev.label in ('virtualization_host',
- 'virtualization_host_platform')
- and sev.server_group_type_id =
- sgtvsl.server_group_type_id
- -- the host's virt ent grants a cf virt sub level
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- -- the cf is in that virt sub level
- and cfvsl.channel_family_id = rcfm.channel_family_id
- )
- );
- end;
-
- -- this could certainly be optimized to do updates if needs be
- procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
- is
- begin
- delete from rhnChannelNewestPackage where channel_id = channel_id_in;
- insert into rhnChannelNewestPackage
- ( channel_id, name_id, evr_id, package_id, package_arch_id )
- ( select channel_id,
- name_id, evr_id,
- package_id, package_arch_id
- from rhnChannelNewestPackageView
- where channel_id = channel_id_in
- );
- insert into rhnChannelNewestPackageAudit (channel_id, caller)
- values (channel_id_in, caller_in);
- update rhnChannel
- set last_modified = greatest(sysdate, last_modified + 1/86400)
- where id = channel_id_in;
- end;
-
- procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
- date_to_use in date := sysdate )
- is
-
- channel_last_modified date;
- last_modified_value date;
-
- cursor snapshots is
- select snapshot_id id
- from rhnSnapshotChannel
- where channel_id = channel_id_in;
-
- begin
-
- select last_modified
- into channel_last_modified
- from rhnChannel
- where id = channel_id_in;
-
- last_modified_value := date_to_use;
-
- if last_modified_value <= channel_last_modified then
- last_modified_value := last_modified_value + 1/86400;
- end if;
-
- update rhnChannel set last_modified = last_modified_value
- where id = channel_id_in;
-
- if invalidate_ss = 1 then
- for snapshot in snapshots loop
- update rhnSnapshot
- set invalid = lookup_snapshot_invalid_reason('channel_modified')
- where id = snapshot.id;
- end loop;
- end if;
-
- end update_channel;
-
- procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelPackage
- where package_id = package_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we want to invalidate the snapshot assocated with the channel when we
- -- do this b/c we know we've added or removed or packages
- rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
- end loop;
- end update_channels_by_package;
-
-
- procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelErrata
- where errata_id = errata_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we won't invalidate snapshots, b/c just changing the errata associated with
- -- a channel shouldn't invalidate snapshots
- rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
- end loop;
- end update_channels_by_errata;
-
-END rhn_channel;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.75 2005/03/04 00:04:19 jslagle
--- bz #147617
--- Made Red Hat Desktop sort a little better.
---
--- Revision 1.74 2005/02/22 03:24:47 jslagle
--- bz #147617
--- Improve channel_priority function to order channels better.
---
--- Revision 1.73 2004/08/16 20:39:30 pjones
--- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
---
--- Revision 1.72 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.71 2004/04/13 16:28:36 bretm
--- bugzilla: 119871
---
--- keep track of rhnServer.channels_changed through the pl/sql fns
---
--- Revision 1.70 2004/03/26 18:11:32 rbb
--- Bugzilla: 114057
---
--- Add a script to determine channel priority.
---
--- Revision 1.69 2004/02/17 20:16:52 pjones
--- bugzilla: none -- add cvs tags into the package as long as we're touching
--- it anyway
---
--- Revision 1.68 2004/02/17 20:05:38 pjones
--- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
--- with arches incompatible with the target channel
---
--- Revision 1.67 2004/02/06 02:36:10 misa
--- Changed normalize_server_arch to allow for solaris arches
---
--- Revision 1.66 2003/11/13 16:58:34 cturner
--- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
---
--- Revision 1.65 2003/10/23 20:26:24 bretm
--- bugzilla: none
---
--- note the channel label when we unsubscribe, too
---
--- Revision 1.64 2003/10/15 14:47:17 bretm
--- bugzilla: none
---
--- add the channel label to the server history summary line when we log a channel change
---
--- Revision 1.63 2003/09/24 19:25:56 pjones
--- this wasn't the right fix, put it back
---
--- Revision 1.62 2003/09/24 17:42:19 pjones
--- bugzilla: none
---
--- limit our server base channel guess to channels with available permissions
---
--- Revision 1.61 2003/09/22 21:00:40 cturner
--- add method for easy acl check
---
--- Revision 1.60 2003/09/17 22:14:11 misa
--- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
---
--- Revision 1.59 2003/08/21 13:41:17 cturner
--- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
---
--- Revision 1.58 2003/07/24 16:46:22 cturner
--- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
---
--- Revision 1.57 2003/07/24 16:44:16 misa
--- bugzilla: none A function more usable on the rhnapp side
---
--- Revision 1.56 2003/07/23 22:36:51 cturner
--- argh, max returns null even when now rows; use distinct. how revolting
---
--- Revision 1.55 2003/07/23 22:01:31 cturner
--- oops, this one can return multiple rows; eliminate that in a lazy way
---
--- Revision 1.54 2003/07/23 21:59:19 cturner
--- rework how rhnUserChannel works; move to plsql for speed and maintenance
---
--- Revision 1.53 2003/07/21 17:49:12 pjones
--- bugzilla: none
---
--- add optional user for subscribe_server
---
--- Revision 1.52 2003/07/14 22:19:29 misa
--- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
---
--- Revision 1.51 2003/06/26 22:09:04 pjones
--- bugzilla: none
---
--- log subscribe and unsubscribe
---
--- Revision 1.50 2003/06/05 19:31:15 pjones
--- bugzilla: 88278 -- make the cursor name smaller
---
--- Revision 1.49 2003/06/05 19:18:21 pjones
--- bugzilla: 88278
---
--- unsubscribe_server() opens the package-level cursor when it invokes itself,
--- so we're using a local copy instead.
---
--- Revision 1.48 2003/06/04 16:41:39 pjones
--- bugzilla: none
---
--- make bulk_guess_server_base() silently ignore unguessables
---
--- Revision 1.47 2003/06/04 16:27:03 pjones
--- bugzilla: 88822
---
--- eliminate the last outliers that remove things from channels without using
--- unsubscribe_server, I think.
---
--- Revision 1.46 2003/06/03 20:49:37 pjones
--- bugzilla: 88822
--- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
--- for the server in question
---
--- Revision 1.45 2003/06/02 20:41:45 pjones
--- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
--- problem. Basicly, if you're out of the channel for any reason, you're
--- also out of rhnProxyInfo/rhnProxyInfo
---
--- Revision 1.44 2003/03/24 15:26:28 pjones
--- bugzilla: 85812
---
--- bulk_server_base_change silently ignores servers that are satellites
--- or proxies, as requested.
---
--- Revision 1.43 2003/02/26 20:28:17 pjones
--- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
--- the old codepath is:
---
--- ep ->
--- rhn_ep.entitlement_run_me() ->
--- rhn_ep.poll_customer() ->
--- rhn_channel.entitle_customer()
---
--- which doesn't change current_members, even though it may remove servers
--- from the family.
---
--- There's another bug here: currently, we don't try to order forced
--- unsubscribes in any way; we just use
--- rhn_channel.unsubscribe_server_from_family . If there are any child
--- channel subscriptions, this will leave them subscribed. We really need
--- to iterate across the channels again, and subscribe any channel for which
--- there are no parent channel subscriptions.
---
--- Ugh.
---
--- Revision 1.42 2003/01/28 00:19:45 pjones
--- fix clear_subscriptions; AFAICT, this is only hit on the
--- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
--- it infrequent enough that it could be our "bad count" culprit.
---
--- Revision 1.41 2003/01/14 19:51:45 pjones
--- make setting current_members on rhnChannelFamilyPermissions work when
--- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/204-rhn_entitlements.pks.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/204-rhn_entitlements.pks.sql
deleted file mode 100644
index cc52ad2..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/204-rhn_entitlements.pks.sql
+++ /dev/null
@@ -1,225 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace
-package rhn_entitlements
-is
- body_version varchar2(100) := '$Id$';
-
- type ents_array is varray(10) of rhnServerGroupType.label%TYPE;
-
- procedure remove_org_entitlements (
- org_id_in number
- );
-
- function entitlement_grants_service (
- entitlement_in in varchar2,
- service_level_in in varchar2
- ) return number;
-
- function lookup_entitlement_group (
- org_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- ) return number;
-
- function create_entitlement_group (
- org_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- ) return number;
-
- function can_entitle_server (
- server_id_in in number,
- type_label_in in varchar2
- )
- return number;
-
- function can_switch_base (
- server_id_in in integer,
- type_label_in in varchar2
- )
- return number;
-
- function find_compatible_sg (
- server_id_in in number,
- type_label_in in varchar2,
- sgid_out out number
- )
- return boolean;
-
- procedure entitle_server (
- server_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- );
-
- procedure remove_server_entitlement (
- server_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled',
- repoll_virt_guests in number := 1
- );
-
- procedure unentitle_server (
- server_id_in in number
- );
-
- procedure repoll_virt_guest_entitlements(
- server_id_in in number
- );
-
- function get_server_entitlement (
- server_id_in in number
- ) return ents_array;
-
- procedure modify_org_service (
- org_id_in in number,
- service_label_in in varchar2,
- enable_in in char
- );
-
- procedure set_customer_enterprise (
- customer_id_in in number
- );
-
- procedure set_customer_provisioning (
- customer_id_in in number
- );
-
- procedure set_customer_nonlinux (
- customer_id_in in number
- );
-
- procedure unset_customer_enterprise (
- customer_id_in in number
- );
-
- procedure unset_customer_provisioning (
- customer_id_in in number
- );
-
- procedure unset_customer_nonlinux (
- customer_id_in in number
- );
-
- procedure assign_system_entitlement(
- group_label_in in varchar2,
- from_org_id_in in number,
- to_org_id_in in number,
- quantity_in in number
- );
-
- procedure assign_channel_entitlement(
- channel_family_label_in in varchar2,
- from_org_id_in in number,
- to_org_id_in in number,
- quantity_in in number
- );
-
- procedure activate_system_entitlement(
- org_id_in in number,
- group_label_in in varchar2,
- quantity_in in number
- );
-
- procedure activate_channel_entitlement(
- org_id_in in number,
- channel_family_label_in in varchar2,
- quantity_in in number
- );
-
- procedure set_group_count (
- customer_id_in in number, -- customer_id
- type_in in char, -- 'U' or 'S'
- group_type_in in number, -- rhn[User|Server]GroupType.id
- quantity_in in number -- quantity
- );
-
- procedure set_family_count (
- customer_id_in in number, -- customer_id
- channel_family_id_in in number, -- 246
- quantity_in in number -- 3
- );
-
- -- this makes NO checks that the quantity is within max,
- -- so we should NEVER run this unless we KNOW that we won't be
- -- violating the max
- procedure entitle_last_modified_servers (
- customer_id_in in number, -- customer_id
- type_label_in in varchar2, -- 'enterprise_entitled'
- quantity_in in number -- 3
- );
-
- procedure prune_everything (
- customer_id_in in number
- );
-
- procedure subscribe_newest_servers (
- customer_id_in in number
- );
-end rhn_entitlements;
-/
-show errors
-
--- $Log$
--- Revision 1.19 2004/05/26 19:45:48 pjones
--- bugzilla: 123639
--- 1) reformat "entitlement_grants_service"
--- 2) make the .pks and .pkb be in the same order.
--- 3) add "modify_org_service" (to be used instead of set_customer_SERVICELEVEL)
--- 4) add monitoring specific data.
---
--- Revision 1.18 2004/02/19 20:17:49 pjones
--- bugzilla: 115896 -- add sgt and oet data for nonlinux, add
--- [un]set_customer_nonlinux
---
--- Revision 1.17 2004/01/13 23:37:08 pjones
--- bugzilla: none -- mate provisioning and management slots.
---
--- Revision 1.16 2003/09/23 22:14:41 bretm
--- bugzilla: 103655
---
--- need something in the db that knows provisioning boxes are management boxes too, etc.
---
--- Revision 1.15 2003/09/19 22:35:07 pjones
--- bugzilla: none
---
--- provisioning and config management entitlement support
---
--- Revision 1.14 2003/09/02 22:22:54 pjones
--- bugzilla: none
---
--- attempt to autoentitle upon entitlement changes
---
--- Revision 1.13 2003/06/05 21:43:40 pjones
--- bugzilla: none
---
--- add rhn_entitlements.prune_everything(customer_id_in in number);
---
--- Revision 1.12 2003/05/22 16:01:14 pjones
--- reformat
--- remove update_[server|user]group_counts (unused)
---
--- Revision 1.11 2002/06/03 16:07:29 pjones
--- make prune_group and prune_family update respective max_members
--- correctly.
---
--- Revision 1.10 2002/05/29 19:10:31 pjones
--- code to entitle the last N modified servers to a particular service
--- level
---
--- Revision 1.9 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/205-rhn_entitlements.pkb.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/205-rhn_entitlements.pkb.sql
deleted file mode 100644
index 7caac8c..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/205-rhn_entitlements.pkb.sql
+++ /dev/null
@@ -1,1719 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace
-package body rhn_entitlements
-is
- body_version varchar2(100) := '$Id$';
-
-
- -- *******************************************************************
- -- PROCEDURE: remove_org_entitlements
- --
- -- Removes both system entitlements and channel subscriptions
- -- that are currently assigned to an org and re-assigns to the
- -- master org (org_id = 1).
- --
- -- When we call this we expect everything to already be unentitled
- -- which shoul be handled by delete_org.
- --
- -- Called by: delete_org
- -- *******************************************************************
- procedure remove_org_entitlements(
- org_id_in in number
- )
- is
-
- cursor system_ents is
- select sg.id, sg.max_members, sg.group_type
- from rhnServerGroup sg
- where group_type is not null
- and org_id = org_id_in;
-
- cursor channel_subs is
- select pcf.channel_family_id, pcf.max_members
- from rhnChannelFamily cf,
- rhnPrivateChannelFamily pcf
- where pcf.org_id = org_id_in
- and pcf.channel_family_id = cf.id
- and cf.org_id is null;
-
- begin
-
- for system_ent in system_ents loop
- update rhnServerGroup
- set max_members = max_members + system_ent.max_members
- where org_id = 1
- and group_type = system_ent.group_type;
- end loop;
-
- update rhnServerGroup
- set max_members = 0
- where org_id = org_id_in;
-
- for channel_sub in channel_subs loop
- update rhnPrivateChannelFamily
- set max_members = max_members + channel_sub.max_members
- where org_id = 1
- and channel_family_id = channel_sub.channel_family_id;
- end loop;
-
- update rhnPrivateChannelFamily
- set max_members = 0
- where org_id = org_id_in;
-
- end remove_org_entitlements;
-
- function entitlement_grants_service (
- entitlement_in in varchar2,
- service_level_in in varchar2
- ) return number is
- begin
- if service_level_in = 'provisioning' then
- if entitlement_in = 'provisioning_entitled' then
- return 1;
- else
- return 0;
- end if;
- elsif service_level_in = 'management' then
- if entitlement_in = 'enterprise_entitled' then
- return 1;
- else
- return 0;
- end if;
- elsif service_level_in = 'monitoring' then
- if entitlement_in = 'monitoring_entitled' then
- return 1;
- end if;
- elsif service_level_in = 'updates' then
- return 1;
- else
- return 0;
- end if;
- end entitlement_grants_service;
-
- function lookup_entitlement_group (
- org_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- ) return number is
- cursor server_groups is
- select sg.id server_group_id
- from rhnServerGroup sg,
- rhnServerGroupType sgt
- where sgt.label = type_label_in
- and sgt.id = sg.group_type
- and sg.org_id = org_id_in;
- begin
- for sg in server_groups loop
- return sg.server_group_id;
- end loop;
- return rhn_entitlements.create_entitlement_group(
- org_id_in,
- type_label_in
- );
- end lookup_entitlement_group;
-
- function create_entitlement_group (
- org_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- ) return number is
- sg_id_val number;
- begin
- select rhn_server_group_id_seq.nextval
- into sg_id_val
- from dual;
-
- insert into rhnServerGroup (
- id, name, description, max_members, current_members,
- group_type, org_id
- ) (
- select sg_id_val, sgt.label, sgt.label,
- 0, 0, sgt.id, org_id_in
- from rhnServerGroupType sgt
- where sgt.label = type_label_in
- );
-
- return sg_id_val;
- end create_entitlement_group;
-
- function can_entitle_server (
- server_id_in in number,
- type_label_in in varchar2 )
- return number is
- cursor addon_servergroups (base_label_in in varchar2,
- addon_label_in in varchar2) is
- select
- addon_id
- from
- rhnSGTypeBaseAddonCompat
- where base_id = lookup_sg_type (base_label_in)
- and addon_id = lookup_sg_type (addon_label_in);
-
- previous_ent rhn_entitlements.ents_array;
- is_base_in char := 'N';
- is_base_current char := 'N';
- i number := 0;
- sgid number := 0;
-
- begin
-
- previous_ent := rhn_entitlements.ents_array();
- previous_ent := rhn_entitlements.get_server_entitlement(server_id_in);
-
- select distinct is_base
- into is_base_in
- from rhnServerGroupType
- where label = type_label_in;
-
- if previous_ent.count = 0 then
- if (is_base_in = 'Y' and rhn_entitlements.find_compatible_sg (server_id_in, type_label_in, sgid)) then
- -- rhn_server.insert_into_servergroup (server_id_in, sgid);
- return 1;
- else
- -- rhn_exception.raise_exception ('invalid_base_entitlement');
- return 0;
- end if;
-
- -- there are previous ents, first make sure we're not trying to entitle a base ent
- elsif is_base_in = 'Y' then
- -- rhn_exception.raise_exception ('invalid_addon_entitlement');
- return 0;
-
- -- it must be an addon, so proceed with the entitlement
- else
-
- -- find the servers base ent
- is_base_current := 'N';
- i := 0;
- while is_base_current = 'N' and i <= previous_ent.count
- loop
- i := i + 1;
- select is_base
- into is_base_current
- from rhnServerGroupType
- where label = previous_ent(i);
- end loop;
-
- -- never found a base ent, that would be strange
- if is_base_current = 'N' then
- -- rhn_exception.raise_exception ('invalid_base_entitlement');
- return 0;
- end if;
-
- -- this for loop verifies the validity of the addon path
- for addon_servergroup in addon_servergroups (previous_ent(i), type_label_in) loop
- -- find an appropriate sgid for the addon and entitle the server
- if rhn_entitlements.find_compatible_sg (server_id_in, type_label_in, sgid) then
- -- rhn_server.insert_into_servergroup (server_id_in, sgid);
- return 1;
- else
- -- rhn_exception.raise_exception ('invalid_addon_entitlement');
- return 0;
- end if;
- end loop;
-
- end if;
-
- return 0;
-
- end can_entitle_server;
-
- function can_switch_base (
- server_id_in in integer,
- type_label_in in varchar2
- ) return number is
-
- type_label_in_is_base char(1);
- sgid number;
-
- begin
-
- begin
- select is_base into type_label_in_is_base
- from rhnServerGroupType
- where label = type_label_in;
- exception
- when no_data_found then
- rhn_exception.raise_exception ( 'invalid_entitlement' );
- end;
-
- if type_label_in_is_base = 'N' then
- rhn_exception.raise_exception ( 'invalid_entitlement' );
- elsif rhn_entitlements.find_compatible_sg ( server_id_in,
- type_label_in, sgid ) then
- return 1;
- else
- return 0;
- end if;
-
- end can_switch_base;
-
-
- function find_compatible_sg (
- server_id_in in number,
- type_label_in in varchar2,
- sgid_out out number
- ) return boolean is
-
- cursor servergroups is
- select sg.id id
- from rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServer s,
- rhnServerServerGroupArchCompat ssgac
- where s.id = server_id_in
- and s.org_id = sg.org_id
- and sgt.label = type_label_in
- and sg.group_type = sgt.id
- and ssgac.server_group_type = sgt.id
- and ssgac.server_arch_id = s.server_arch_id
- and not exists (
- select 1
- from rhnServerGroupMembers sgm
- where sgm.server_group_id = sg.id
- and sgm.server_id = s.id);
-
-
- begin
- for servergroup in servergroups loop
- sgid_out := servergroup.id;
- return true;
- end loop;
-
- --no servergroup found
- sgid_out := 0;
- return false;
- end find_compatible_sg;
-
- procedure entitle_server (
- server_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled'
- ) is
- sgid number := 0;
- is_virt number := 0;
-
- begin
-
- begin
- select 1 into is_virt
- from rhnServerEntitlementView
- where server_id = server_id_in
- and label in ('virtualization_host', 'virtualization_host_platform');
- exception
- when no_data_found then
- is_virt := 0;
- end;
-
- if is_virt = 0 and (type_label_in = 'virtualization_host' or
- type_label_in = 'virtualization_host_platform') then
-
- is_virt := 1;
- end if;
-
-
-
- if rhn_entitlements.can_entitle_server(server_id_in,
- type_label_in) = 1 then
- if rhn_entitlements.find_compatible_sg (server_id_in,
- type_label_in, sgid) then
- insert into rhnServerHistory ( id, server_id, summary, details )
- values ( rhn_event_id_seq.nextval, server_id_in,
- 'added system entitlement ',
- case type_label_in
- when 'enterprise_entitled' then 'Management'
- when 'sw_mgr_entitled' then 'Update'
- when 'provisioning_entitled' then 'Provisioning'
- when 'monitoring_entitled' then 'Monitoring'
- when 'virtualization_host' then 'Virtualization'
- when 'virtualization_host_platform' then
- 'Virtualization Platform' end );
-
- rhn_server.insert_into_servergroup (server_id_in, sgid);
-
- if is_virt = 1 then
- rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
- end if;
-
- else
- rhn_exception.raise_exception ('no_available_server_group');
- end if;
- else
- rhn_exception.raise_exception ('invalid_entitlement');
- end if;
- end entitle_server;
-
- procedure remove_server_entitlement (
- server_id_in in number,
- type_label_in in varchar2 := 'sw_mgr_entitled',
- repoll_virt_guests in number := 1
- ) is
- group_id number;
- type_is_base char;
- is_virt number := 0;
- begin
- begin
-
-
- -- would be nice if there were a virt attribute of entitlement types, not have to specify 2 different ones...
- begin
- select 1 into is_virt
- from rhnServerEntitlementView
- where server_id = server_id_in
- and label in ('virtualization_host', 'virtualization_host_platform');
- exception
- when no_data_found then
- is_virt := 0;
- end;
-
- select sg.id, sgt.is_base
- into group_id, type_is_base
- from rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServerGroupMembers sgm,
- rhnServer s
- where s.id = server_id_in
- and s.id = sgm.server_id
- and sgm.server_group_id = sg.id
- and sg.org_id = s.org_id
- and sgt.label = type_label_in
- and sgt.id = sg.group_type;
-
- if ( type_is_base = 'Y' ) then
- -- unentitle_server should handle everything, don't really need to do anything else special here
- unentitle_server ( server_id_in );
- else
-
- insert into rhnServerHistory ( id, server_id, summary, details )
- values ( rhn_event_id_seq.nextval, server_id_in,
- 'removed system entitlement ',
- case type_label_in
- when 'enterprise_entitled' then 'Management'
- when 'sw_mgr_entitled' then 'Update'
- when 'provisioning_entitled' then 'Provisioning'
- when 'monitoring_entitled' then 'Monitoring'
- when 'virtualization_host' then 'Virtualization'
- when 'virtualization_host_platform' then
- 'Virtualization Platforrm' end );
-
- rhn_server.delete_from_servergroup(server_id_in, group_id);
-
- -- special case: clean up related monitornig data
- if type_label_in = 'monitoring_entitled' then
- DELETE
- FROM state_change
- WHERE o_id IN (SELECT probe_id
- FROM rhn_check_probe
- WHERE host_id = server_id_in);
- DELETE
- FROM time_series
- WHERE SUBSTR(o_id, INSTR(o_id, '-') + 1,
- (INSTR(o_id, '-', INSTR(o_id, '-') + 1) - INSTR(o_id, '-')) - 1)
- IN (SELECT probe_id
- FROM rhn_check_probe
- WHERE host_id = server_id_in);
- DELETE
- FROM rhn_probe
- WHERE recid IN (SELECT probe_id
- FROM rhn_check_probe
- WHERE host_id = server_id_in);
- end if;
-
- if is_virt = 1 and repoll_virt_guests = 1 then
- rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
- end if;
- end if;
-
- exception
- when no_data_found then
- rhn_exception.raise_exception('invalid_server_group_member');
- end;
-
- end remove_server_entitlement;
-
-
- procedure unentitle_server (server_id_in in number) is
-
- cursor servergroups is
- select distinct sgt.label, sg.id server_group_id
- from rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServer s,
- rhnServerGroupMembers sgm
- where s.id = server_id_in
- and s.org_id = sg.org_id
- and sg.group_type = sgt.id
- and sgm.server_group_id = sg.id
- and sgm.server_id = s.id;
-
- is_virt number := 0;
-
- begin
-
- begin
- select 1 into is_virt
- from rhnServerEntitlementView
- where server_id = server_id_in
- and label in ('virtualization_host', 'virtualization_host_platform');
- exception
- when no_data_found then
- is_virt := 0;
- end;
-
- for servergroup in servergroups loop
-
- insert into rhnServerHistory ( id, server_id, summary, details )
- values ( rhn_event_id_seq.nextval, server_id_in,
- 'removed system entitlement ',
- case servergroup.label
- when 'enterprise_entitled' then 'Management'
- when 'sw_mgr_entitled' then 'Update'
- when 'provisioning_entitled' then 'Provisioning'
- when 'monitoring_entitled' then 'Monitoring'
- when 'virtualization_host' then 'Virtualization'
- when 'virtualization_host_platform' then
- 'Virtualization Platform' end );
-
- rhn_server.delete_from_servergroup(server_id_in,
- servergroup.server_group_id );
- end loop;
-
- if is_virt = 1 then
- rhn_entitlements.repoll_virt_guest_entitlements(server_id_in);
- end if;
-
- end unentitle_server;
-
-
- -- *******************************************************************
- -- PROCEDURE: repoll_virt_guest_entitlements
- --
- -- Whenever we add/remove a virtualization_host* entitlement from
- -- a host, we can call this procedure to update what type of slots
- -- the guests are consuming.
- --
- -- If you're removing the entitlement, it's
- -- possible the guests will become unentitled if you don't have enough
- -- physical slots to cover them.
- --
- -- If you're adding the entitlement, you end up freeing up physical
- -- slots for other systems.
- --
- -- *******************************************************************
- procedure repoll_virt_guest_entitlements(server_id_in in number)
- is
-
- -- All channel families associated with the guests of server_id_in
- cursor families is
- select distinct cfs.channel_family_id
- from
- rhnChannelFamilyServers cfs,
- rhnVirtualInstance vi
- where
- vi.host_system_id = server_id_in
- and vi.virtual_system_id = cfs.server_id;
-
- -- All of server group types associated with the guests of
- -- server_id_in
- cursor group_types is
- select distinct sg.group_type, sgt.label
- from
- rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServerGroupMembers sgm,
- rhnVirtualInstance vi
- where
- vi.host_system_id = server_id_in
- and vi.virtual_system_id = sgm.server_id
- and sgm.server_group_id = sg.id
- and sg.group_type = sgt.id;
-
- -- Virtual servers from a certain family belonging to a speicifc
- -- host that are consuming physical channel slots over the limit.
- cursor virt_servers_cfam(family_id_in in number, quantity_in in number) is
- select virtual_system_id
- from (
- select rownum, vi.virtual_system_id
- from
- rhnChannelFamilyMembers cfm,
- rhnServerChannel sc,
- rhnVirtualInstance vi
- where
- vi.host_system_id = server_id_in
- and vi.virtual_system_id = sc.server_id
- and sc.channel_id = cfm.channel_id
- and cfm.channel_family_id = family_id_in
- order by sc.modified desc
- )
- where rownum <= quantity_in;
-
- -- Virtual servers from a certain family belonging to a speicifc
- -- host that are consuming physical system slots over the limit.
- cursor virt_servers_sgt(group_type_in in number, quantity_in in number) is
- select virtual_system_id
- from (
- select rownum, vi.virtual_system_id
- from
- rhnServerGroup sg,
- rhnServerGroupMembers sgm,
- rhnVirtualInstance vi
- where
- vi.host_system_id = server_id_in
- and vi.virtual_system_id = sgm.server_id
- and sgm.server_group_id = sg.id
- and sg.group_type = group_type_in
- order by sgm.modified desc
- )
- where rownum <= quantity_in;
-
- org_id_val number;
- max_members_val number;
- current_members_calc number;
- sg_id number;
-
- begin
-
- select org_id
- into org_id_val
- from rhnServer
- where id = server_id_in;
-
- -- deal w/ channel entitlements first ...
- for family in families loop
- -- get the current (physical) members of the family
- current_members_calc :=
- rhn_channel.channel_family_current_members(family.channel_family_id,
- org_id_val); -- fixed transposed args
-
- -- get the max members of the family
- select max_members
- into max_members_val
- from rhnPrivateChannelFamily
- where channel_family_id = family.channel_family_id
- and org_id = org_id_val;
-
- if current_members_calc > max_members_val then
- -- A virtualization_host* ent must have been removed, so we'll
- -- unsubscribe guests from the host first.
-
- -- hm, i don't think max_members - current_members_calc yielding a negative number
- -- will work w/ rownum, swaping 'em in the body of this if...
- for virt_server in virt_servers_cfam(family.channel_family_id,
- current_members_calc - max_members_val) loop
-
- rhn_channel.unsubscribe_server_from_family(
- virt_server.virtual_system_id,
- family.channel_family_id);
- end loop;
-
- -- if we're still over the limit, which would be odd,
- -- just prune the group to max_members
- --
- -- er... wouldn't we actually have to refresh the values of
- -- current_members_calc and max_members_val to actually ever
- -- *skip this??
- if current_members_calc > max_members_val then
- -- argh, transposed again?!
- set_family_count(org_id_val,
- family.channel_family_id,
- max_members_val);
- end if;
-
- end if;
-
- -- update current_members for the family. This will set the value
- -- to reflect adding/removing the entitlement.
- --
- -- what's the difference of doing this vs the unavoidable set_family_count above?
- rhn_channel.update_family_counts(family.channel_family_id,
- org_id_val);
- end loop;
-
- for a_group_type in group_types loop
- -- get the current *physical* members of the system entitlement type for the org...
- --
- -- unlike channel families, it appears the standard rhnServerGroup.max_members represents
- -- *physical* slots, vs physical+virt ... boy that's confusing...
-
- select max_members, id
- into max_members_val, sg_id
- from rhnServerGroup
- where group_type = a_group_type.group_type
- and org_id = org_id_val;
-
-
- select count(sep.server_id) into current_members_calc
- from rhnServerEntitlementPhysical sep
- where sep.server_group_id = sg_id
- and sep.server_group_type_id = a_group_type.group_type;
-
- if current_members_calc > max_members_val then
- -- A virtualization_host* ent must have been removed, and we're over the limit, so unsubscribe guests
- for virt_server in virt_servers_sgt(a_group_type.group_type,
- current_members_calc - max_members_val) loop
- rhn_entitlements.remove_server_entitlement(virt_server.virtual_system_id, a_group_type.label);
-
- -- decrement current_members_calc, we'll use it to reset current_members for the group at the end...
- current_members_calc := current_members_calc - 1;
- end loop;
-
- end if;
-
- update rhnServerGroup set current_members = current_members_calc
- where org_id = org_id_val
- and group_type = a_group_type.group_type;
-
- -- I think that's all the house-keeping we have to do...
- end loop;
-
- end repoll_virt_guest_entitlements;
-
-
- function get_server_entitlement (
- server_id_in in number
- ) return ents_array is
-
- cursor server_groups is
- select sgt.label
- from rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServerGroupMembers sgm
- where 1=1
- and sgm.server_id = server_id_in
- and sg.id = sgm.server_group_id
- and sgt.id = sg.group_type
- and sgt.label in (
- 'sw_mgr_entitled','enterprise_entitled',
- 'provisioning_entitled', 'nonlinux_entitled',
- 'monitoring_entitled', 'virtualization_host',
- 'virtualization_host_platform'
- );
-
- ent_array ents_array;
-
- begin
-
- ent_array := ents_array();
-
- for sg in server_groups loop
- ent_array.extend;
- ent_array(ent_array.count) := sg.label;
- end loop;
-
- return ent_array;
-
- end get_server_entitlement;
-
-
- -- this desperately needs to be table driven.
- procedure modify_org_service (
- org_id_in in number,
- service_label_in in varchar2,
- enable_in in char
- ) is
- type roles_v is varray(10) of rhnUserGroupType.label%TYPE;
- roles_to_process roles_v;
- cursor roles(role_label_in in varchar2) is
- select label, id
- from rhnUserGroupType
- where label = role_label_in;
- cursor org_roles(role_label_in in varchar2) is
- select 1
- from rhnUserGroup ug,
- rhnUserGroupType ugt
- where ugt.label = role_label_in
- and ug.org_id = org_id_in
- and ugt.id = ug.group_type;
-
- type ents_v is varray(10) of rhnOrgEntitlementType.label%TYPE;
- ents_to_process ents_v;
- cursor ents(ent_label_in in varchar2) is
- select label, id
- from rhnOrgEntitlementType
- where label = ent_label_in;
- cursor org_ents(ent_label_in in varchar2) is
- select 1
- from rhnOrgEntitlements oe,
- rhnOrgEntitlementType oet
- where oet.label = ent_label_in
- and oe.org_id = org_id_in
- and oet.id = oe.entitlement_id;
- create_row char(1);
- begin
- ents_to_process := ents_v();
- roles_to_process := roles_v();
- -- a bit kludgy, but only for 3.4 really. Certainly no
- -- worse than the old code...
- if service_label_in = 'enterprise' or
- service_label_in = 'management' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'org_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'system_group_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'activation_key_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'org_applicant';
- elsif service_label_in = 'provisioning' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'rhn_provisioning';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'system_group_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'activation_key_admin';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'config_admin';
- -- another nasty special case...
- if enable_in = 'Y' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'sw_mgr_enterprise';
- end if;
- elsif service_label_in = 'monitoring' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'rhn_monitor';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'monitoring_admin';
- elsif service_label_in = 'virtualization' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'rhn_virtualization';
-
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'config_admin';
- elsif service_label_in = 'virtualization_platform' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'rhn_virtualization_platform';
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'config_admin';
- elsif service_label_in = 'nonlinux' then
- ents_to_process.extend;
- ents_to_process(ents_to_process.count) := 'rhn_nonlinux';
- roles_to_process.extend;
- roles_to_process(roles_to_process.count) := 'config_admin';
- end if;
-
- if enable_in = 'Y' then
- for i in 1..ents_to_process.count loop
- for ent in ents(ents_to_process(i)) loop
- create_row := 'Y';
- for oe in org_ents(ent.label) loop
- create_row := 'N';
- end loop;
- if create_row = 'Y' then
- insert into rhnOrgEntitlements(org_id, entitlement_id)
- values (org_id_in, ent.id);
- end if;
- end loop;
- end loop;
- for i in 1..roles_to_process.count loop
- for role in roles(roles_to_process(i)) loop
- create_row := 'Y';
- for o_r in org_roles(role.label) loop
- create_row := 'N';
- end loop;
- if create_row = 'Y' then
- insert into rhnUserGroup(
- id, name, description, current_members,
- group_type, org_id
- ) (
- select rhn_user_group_id_seq.nextval,
- ugt.name || 's',
- ugt.name || 's for Org ' ||
- o.name || ' ('|| o.id ||')',
- 0, ugt.id, o.id
- from rhnUserGroupType ugt,
- web_customer o
- where o.id = org_id_in
- and ugt.id = role.id
- );
- end if;
- end loop;
- end loop;
- else
- for i in 1..ents_to_process.count loop
- for ent in ents(ents_to_process(i)) loop
- delete from rhnOrgEntitlements
- where org_id = org_id_in
- and entitlement_id = ent.id;
- end loop;
- end loop;
- end if;
- end modify_org_service;
-
- procedure set_customer_enterprise (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'enterprise', 'Y');
- end set_customer_enterprise;
-
- procedure set_customer_provisioning (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'provisioning', 'Y');
- end set_customer_provisioning;
-
- procedure set_customer_monitoring (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'monitoring', 'Y');
- end set_customer_monitoring;
-
- procedure set_customer_nonlinux (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'nonlinux', 'Y');
- end set_customer_nonlinux;
-
- procedure unset_customer_enterprise (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'enterprise', 'N');
- end unset_customer_enterprise;
-
- procedure unset_customer_provisioning (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'provisioning', 'N');
- end unset_customer_provisioning;
-
- procedure unset_customer_monitoring (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'monitoring', 'N');
- end unset_customer_monitoring;
-
- procedure unset_customer_nonlinux (
- customer_id_in in number
- ) is
- begin
- modify_org_service(customer_id_in, 'nonlinux', 'N');
- end unset_customer_nonlinux;
-
- -- *******************************************************************
- -- PROCEDURE: prune_group
- -- Unsubscribes servers consuming physical slots that over the org's
- -- limit.
- -- Called by: set_group_count, prune_everything, repoll_virt_guest_entitlements
- -- *******************************************************************
- procedure prune_group (
- group_id_in in number,
- type_in in char,
- quantity_in in number
- ) is
- cursor usergroups is
- select user_id, user_group_id, ugt.label
- from rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where 1=1
- and ugm.user_group_id = group_id_in
- and ugm.user_id in (
- select user_id
- from (
- select rownum row_number,
- user_id,
- time
- from (
- select user_id,
- modified time
- from rhnUserGroupMembers
- where user_group_id = group_id_in
- order by time asc
- )
- )
- where row_number > quantity_in
- )
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id;
- cursor servergroups is
- select server_id, server_group_id, sgt.id group_type_id, sgt.label
- from rhnServerGroupType sgt,
- rhnServerGroup sg,
- rhnServerGroupMembers sgm
- where 1=1
- and sgm.server_group_id = group_id_in
- and sgm.server_id in (
- select server_id
- from (
- select rownum row_number,
- server_id,
- time
- from (
- select sep.server_id,
- sep.modified time
- from
- rhnServerEntitlementPhysical sep
- where
- sep.server_group_id = group_id_in
- order by time asc
- )
- )
- where row_number > quantity_in
- )
- and sgm.server_group_id = sg.id
- and sg.group_type = sgt.id;
- type_is_base char;
- begin
- if type_in = 'U' then
- update rhnUserGroup
- set max_members = quantity_in
- where id = group_id_in;
-
- for ug in usergroups loop
- rhn_user.remove_from_usergroup(ug.user_id, ug.user_group_id);
- end loop;
- elsif type_in = 'S' then
- update rhnServerGroup
- set max_members = quantity_in
- where id = group_id_in;
-
- for sg in servergroups loop
- remove_server_entitlement(sg.server_id, sg.label);
-
- select is_base
- into type_is_base
- from rhnServerGroupType sgt
- where sgt.id = sg.group_type_id;
-
- -- if we're removing a base ent, then be sure to
- -- remove the server's channel subscriptions.
- if ( type_is_base = 'Y' ) then
- rhn_channel.clear_subscriptions(sg.server_id);
- end if;
-
- end loop;
- end if;
- end prune_group;
-
- -- *******************************************************************
- -- PROCEDURE: assign_system_entitlement
- --
- -- Moves system entitlements from from_org_id_in to to_org_id_in.
- -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
- -- does not have enough entitlements to cover the move.
- -- Takes care of unentitling systems if necessary by calling
- -- set_group_count
- -- *******************************************************************
- procedure assign_system_entitlement(
- group_label_in in varchar2,
- from_org_id_in in number,
- to_org_id_in in number,
- quantity_in in number
- )
- is
- prev_ent_count number;
- to_org_prev_ent_count number;
- new_ent_count number;
- new_quantity number;
- group_type number;
- begin
-
- begin
- select max_members
- into prev_ent_count
- from rhnServerGroupType sgt,
- rhnServerGroup sg
- where sg.org_id = from_org_id_in
- and sg.group_type = sgt.id
- and sgt.label = group_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- end;
-
- begin
- select max_members
- into to_org_prev_ent_count
- from rhnServerGroupType sgt,
- rhnServerGroup sg
- where sg.org_id = to_org_id_in
- and sg.group_type = sgt.id
- and sgt.label = group_label_in;
- exception
- when NO_DATA_FOUND then
- to_org_prev_ent_count := 0;
- end;
-
- begin
- select id
- into group_type
- from rhnServerGroupType
- where label = group_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'invalid_server_group');
- end;
-
- new_ent_count := prev_ent_count - quantity_in;
-
- if prev_ent_count > new_ent_count then
- new_quantity := to_org_prev_ent_count + quantity_in;
- end if;
-
- if new_ent_count < 0 then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- end if;
-
-
- rhn_entitlements.set_group_count(from_org_id_in,
- 'S',
- group_type,
- new_ent_count);
-
- rhn_entitlements.set_group_count(to_org_id_in,
- 'S',
- group_type,
- new_quantity);
-
- -- Create or delete the entries in rhnOrgEntitlementType
- if group_label_in = 'enterprise_entitled' then
- if new_quantity > 0 then
- set_customer_enterprise(to_org_id_in);
- else
- unset_customer_enterprise(to_org_id_in);
- end if;
- end if;
-
- if group_label_in = 'provisioning_entitled' then
- if new_quantity > 0 then
- set_customer_provisioning(to_org_id_in);
- else
- unset_customer_provisioning(to_org_id_in);
- end if;
- end if;
-
- if group_label_in = 'monitoring_entitled' then
- if new_quantity > 0 then
- set_customer_monitoring(to_org_id_in);
- else
- unset_customer_monitoring(to_org_id_in);
- end if;
- end if;
-
- end assign_system_entitlement;
-
- -- *******************************************************************
- -- PROCEDURE: assign_channel_entitlement
- --
- -- Moves channel entitlements from from_org_id_in to to_org_id_in.
- -- Can raise not_enough_entitlements_in_base_org if from_org_id_in
- -- does not have enough entitlements to cover the move.
- -- Takes care of unentitling systems if necessary by calling
- -- set_family_count
- -- *******************************************************************
- procedure assign_channel_entitlement(
- channel_family_label_in in varchar2,
- from_org_id_in in number,
- to_org_id_in in number,
- quantity_in in number
- )
- is
- prev_ent_count number;
- new_ent_count number;
- to_org_prev_ent_count number;
- new_quantity number;
- cfam_id number;
- begin
-
- begin
- select max_members
- into prev_ent_count
- from rhnChannelFamily cf,
- rhnPrivateChannelFamily pcf
- where pcf.org_id = from_org_id_in
- and pcf.channel_family_id = cf.id
- and cf.label = channel_family_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- end;
-
- begin
- select max_members
- into to_org_prev_ent_count
- from rhnChannelFamily cf,
- rhnPrivateChannelFamily pcf
- where pcf.org_id = to_org_id_in
- and pcf.channel_family_id = cf.id
- and cf.label = channel_family_label_in;
- exception
- when NO_DATA_FOUND then
- to_org_prev_ent_count := 0;
- end;
-
-
- begin
- select id
- into cfam_id
- from rhnChannelFamily
- where label = channel_family_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'invalid_channel_family');
- end;
-
- new_ent_count := prev_ent_count - quantity_in;
-
- if prev_ent_count > new_ent_count then
- new_quantity := to_org_prev_ent_count + quantity_in;
- end if;
-
-
- if new_ent_count < 0 then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- end if;
-
- rhn_entitlements.set_family_count(from_org_id_in,
- cfam_id,
- new_ent_count);
-
- rhn_entitlements.set_family_count(to_org_id_in,
- cfam_id,
- new_quantity);
-
- end assign_channel_entitlement;
-
- -- *******************************************************************
- -- PROCEDURE: activate_system_entitlement
- --
- -- Sets the values in rhnServerGroup for a given rhnServerGroupType.
- --
- -- Calls: set_group_count to update, prune, or create the group.
- -- Called by: the code that activates a satellite cert.
- --
- -- Raises not_enough_entitlements_in_base_org if all entitlements
- -- in the org are used so the free entitlements would not cover
- -- the difference when descreasing the number of entitlements.
- -- *******************************************************************
- procedure activate_system_entitlement(
- org_id_in in number,
- group_label_in in varchar2,
- quantity_in in number
- )
- is
- prev_ent_count number;
- prev_ent_count_sum number;
- group_type number;
- begin
-
- -- Fetch the current entitlement count for the org
- -- into prev_ent_count
- begin
- select current_members
- into prev_ent_count
- from rhnServerGroupType sgt,
- rhnServerGroup sg
- where sg.group_type = sgt.id
- and sgt.label = group_label_in
- and sg.org_id = org_id_in;
- exception
- when NO_DATA_FOUND then
- prev_ent_count := 0;
- end;
-
- begin
- select id
- into group_type
- from rhnServerGroupType
- where label = group_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'invalid_server_group');
- end;
-
- -- If we're setting the total entitlemnt count to a lower value,
- -- and that value is less than the allocated count in this org,
- -- we need to raise an exception.
- if quantity_in < prev_ent_count then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- else
- rhn_entitlements.set_group_count(org_id_in,
- 'S',
- group_type,
- quantity_in);
- end if;
-
-
- end activate_system_entitlement;
-
- -- *******************************************************************
- -- PROCEDURE: activate_channel_entitlement
- --
- -- Calls: set_family_count to update, prune, or create the family
- -- permission bucket.
- -- Called by: the code that activates a satellite cert.
- --
- -- Raises not_enough_entitlements_in_base_org if there are not enough
- -- entitlements in the org to cover the difference when you are
- -- descreasing the number of entitlements.
- --
- -- The backend code in Python is expected to do whatever arithmetics
- -- is needed.
- -- *******************************************************************
- procedure activate_channel_entitlement(
- org_id_in in number,
- channel_family_label_in in varchar2,
- quantity_in in number
- )
- is
- prev_ent_count number;
- prev_ent_count_sum number;
- cfam_id number;
- begin
-
- -- Fetch the current entitlement count for the org
- -- into prev_ent_count
- begin
- select current_members
- into prev_ent_count
- from rhnChannelFamily cf,
- rhnPrivateChannelFamily pcf
- where pcf.org_id = org_id_in
- and pcf.channel_family_id = cf.id
- and cf.label = channel_family_label_in;
- exception
- when NO_DATA_FOUND then
- prev_ent_count := 0;
- end;
-
- begin
- select id
- into cfam_id
- from rhnChannelFamily
- where label = channel_family_label_in;
- exception
- when NO_DATA_FOUND then
- rhn_exception.raise_exception(
- 'invalid_channel_family');
- end;
-
- -- If we're setting the total entitlemnt count to a lower value,
- -- and that value is less than the count in that one org,
- -- we need to raise an exception.
- if quantity_in < prev_ent_count then
- rhn_exception.raise_exception(
- 'not_enough_entitlements_in_base_org');
- else
- rhn_entitlements.set_family_count(org_id_in,
- cfam_id,
- quantity_in);
- end if;
-
- end activate_channel_entitlement;
-
-
- procedure set_group_count (
- customer_id_in in number,
- type_in in char,
- group_type_in in number,
- quantity_in in number
- ) is
- group_id number;
- quantity number;
- begin
- quantity := quantity_in;
- if quantity is not null and quantity < 0 then
- quantity := 0;
- end if;
-
- if type_in = 'U' then
- select rug.id
- into group_id
- from rhnUserGroup rug
- where 1=1
- and rug.org_id = customer_id_in
- and rug.group_type = group_type_in;
- elsif type_in = 'S' then
- select rsg.id
- into group_id
- from rhnServerGroup rsg
- where 1=1
- and rsg.org_id = customer_id_in
- and rsg.group_type = group_type_in;
- end if;
-
- rhn_entitlements.prune_group(
- group_id,
- type_in,
- quantity
- );
- exception
- when no_data_found then
- if type_in = 'U' then
- insert into rhnUserGroup (
- id, name, description, max_members, current_members,
- group_type, org_id, created, modified
- ) (
- select rhn_user_group_id_seq.nextval, name, name,
- quantity, 0, id, customer_id_in,
- sysdate, sysdate
- from rhnUserGroupType
- where id = group_type_in
- );
- elsif type_in = 'S' then
- insert into rhnServerGroup (
- id, name, description, max_members, current_members,
- group_type, org_id, created, modified
- ) (
- select rhn_server_group_id_seq.nextval, name, name,
- quantity, 0, id, customer_id_in,
- sysdate, sysdate
- from rhnServerGroupType
- where id = group_type_in
- );
- end if;
- end set_group_count;
-
- -- *******************************************************************
- -- PROCEDURE: prune_family
- -- Unsubscribes servers consuming physical slots from the channel family
- -- that are over the org's limit.
- -- Called by: set_family_count, prune_everything
- -- *******************************************************************
- procedure prune_family (
- customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number
- ) is
- cursor serverchannels is
- select sc.server_id,
- sc.channel_id
- from rhnServerChannel sc,
- rhnChannelFamilyMembers cfm
- where 1=1
- and cfm.channel_family_id = channel_family_id_in
- and cfm.channel_id = sc.channel_id
- and server_id in (
- select server_id
- from (
- select server_id,
- time,
- rownum row_number
- from (
- select rs.id server_id,
- rcfm.modified time
- from
- rhnServerChannel rsc,
- rhnChannelFamilyMembers rcfm,
- rhnServer rs
- where 1=1
- and rs.org_id = customer_id_in
- and rs.id = rsc.server_id
- and rsc.channel_id = rcfm.channel_id
- and rcfm.channel_family_id =
- channel_family_id_in
- -- we only want to grab servers consuming
- -- physical slots.
- and exists (
- select 1
- from rhnChannelFamilyServerPhysical cfsp
- where cfsp.server_id = rs.id
- and cfsp.channel_family_id =
- channel_family_id_in
- )
- order by time asc
- )
- )
- where row_number > quantity_in
- );
- begin
- -- if we get a null customer_id, this is completely bogus.
- if customer_id_in is null then
- return;
- end if;
-
- update rhnPrivateChannelFamily
- set max_members = quantity_in
- where 1=1
- and org_id = customer_id_in
- and channel_family_id = channel_family_id_in;
-
- for sc in serverchannels loop
- rhn_channel.unsubscribe_server(sc.server_id, sc.channel_id, 1, 1);
- end loop;
- end prune_family;
-
- procedure set_family_count (
- customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number
- ) is
- cursor privperms is
- select 1
- from rhnPrivateChannelFamily
- where org_id = customer_id_in
- and channel_family_id = channel_family_id_in;
- cursor pubperms is
- select o.id org_id
- from web_customer o,
- rhnPublicChannelFamily pcf
- where pcf.channel_family_id = channel_family_id_in;
- quantity number;
- done number := 0;
- begin
- quantity := quantity_in;
- if quantity is not null and quantity < 0 then
- quantity := 0;
- end if;
-
- if customer_id_in is not null then
- for perm in privperms loop
- rhn_entitlements.prune_family(
- customer_id_in,
- channel_family_id_in,
- quantity
- );
- update rhnPrivateChannelFamily
- set max_members = quantity
- where org_id = customer_id_in
- and channel_family_id = channel_family_id_in;
- return;
- end loop;
-
- insert into rhnPrivateChannelFamily (
- channel_family_id, org_id, max_members, current_members
- ) values (
- channel_family_id_in, customer_id_in, quantity, 0
- );
- return;
- end if;
-
- for perm in pubperms loop
- if quantity = 0 then
- rhn_entitlements.prune_family(
- perm.org_id,
- channel_family_id_in,
- quantity
- );
- if done = 0 then
- delete from rhnPublicChannelFamily
- where channel_family_id = channel_family_id_in;
- end if;
- end if;
- done := 1;
- end loop;
- -- if done's not 1, then we don't have any entitlements
- if done != 1 then
- insert into rhnPublicChannelFamily (
- channel_family_id
- ) values (
- channel_family_id_in
- );
- end if;
- end set_family_count;
-
- -- this expects quantity_in to be the number of available slots, not the
- -- max_members of the server group. If you give it too many, it'll fail
- -- and raise servergroup_max_members.
- -- We should NEVER run this unless we're SURE that we won't
- -- be violating the max.
- procedure entitle_last_modified_servers (
- customer_id_in in number,
- type_label_in in varchar2,
- quantity_in in number
- ) is
- -- find the servers that aren't currently in slots
- cursor servers(cid_in in number, quant_in in number) is
- select server_id
- from (
- select rownum row_number,
- server_id
- from (
- select rs.id server_iD
- from rhnServer rs
- where 1=1
- and rs.org_id = cid_in
- and not exists (
- select 1
- from rhnServerGroup sg,
- rhnServerGroupMembers rsgm
- where rsgm.server_id = rs.id
- and rsgm.server_group_id = sg.id
- and sg.group_type is not null
- )
- and not exists (
- select 1
- from rhnVirtualInstance vi
- where vi.virtual_system_id =
- rs.id
- ) order by modified desc
- )
- )
- where row_number <= quant_in;
- begin
- for server in servers(customer_id_in, quantity_in) loop
- rhn_entitlements.entitle_server(server.server_id, type_label_in);
- end loop;
- end entitle_last_modified_servers;
-
- procedure prune_everything (
- customer_id_in in number
- ) is
- cursor everything is
- -- all our server groups
- select sg.id id,
- 'S' type,
- sg.max_members quantity
- from rhnServerGroup sg
- where sg.org_id = customer_id_in
- union
- -- all our user groups
- select ug.id id,
- 'U' type,
- ug.max_members quantity
- from rhnUserGroup ug
- where ug.org_id = customer_id_in
- union (
- -- all the channel families we have perms to
- select cfp.channel_family_id id,
- 'C' type,
- cfp.max_members quantity
- from rhnOrgChannelFamilyPermissions cfp
- where cfp.org_id = customer_id_in
- union
- -- plus all the ones we're using that we have no perms for
- select cfm.channel_family_id id,
- 'C' type,
- 0 quantity
- from rhnChannelFamily cf,
- rhnChannelFamilyMembers cfm,
- rhnServerChannel sc,
- rhnServer s
- where s.org_id = customer_id_in
- and s.id = sc.server_id
- and sc.channel_id = cfm.channel_id
- and cfm.channel_family_id = cf.id
- and cf.org_id is not null
- and cf.org_id != customer_id_in
- and not exists (
- select 1
- from rhnOrgChannelFamilyPermissions cfp
- where cfp.org_id = customer_id_in
- and cfp.channel_family_id = cfm.channel_family_id
- )
- );
- begin
- for one in everything loop
- if one.type in ('U','S') then
- prune_group(one.id, one.type, one.quantity);
- else
- prune_family(customer_id_in, one.id, one.quantity);
- end if;
- end loop;
- end prune_everything;
-
- procedure subscribe_newest_servers (
- customer_id_in in number
- ) is
- -- find servers without base channels
- cursor servers(cid_in in number) is
- select s.id
- from rhnServer s
- where 1=1
- and s.org_id = cid_in
- and not exists (
- select 1
- from rhnChannel c,
- rhnServerChannel sc
- where sc.server_id = s.id
- and sc.channel_id = c.id
- and c.parent_channel is null
- )
- and not exists (
- select 1
- from rhnVirtualInstance vi
- where vi.virtual_system_id = s.id
- )
- order by s.modified desc;
- channel_id number;
- begin
- for server in servers(customer_id_in) loop
- channel_id := rhn_channel.guess_server_base(server.id);
- if channel_id is not null then
- begin
- rhn_channel.subscribe_server(server.id, channel_id);
- commit;
- -- exception is really channel_family_no_subscriptions
- exception
- when others then
- null;
- end;
- end if;
- end loop;
- end subscribe_newest_servers;
-end rhn_entitlements;
-/
-show errors
-
---
--- $Log$
--- Revision 1.56 2004/07/21 21:27:36 nhansen
--- bug 128196: use rhn_monitor instead of rhn_monitoring as the rhnOrgEntitlementType
---
--- Revision 1.55 2004/07/20 15:38:57 pjones
--- bugzilla: 128196 -- make entitling "monitoring" work.
---
--- Revision 1.54 2004/07/14 19:13:13 pjones
--- bugzilla: 126461 -- entitlement changes for new user roles
---
--- Revision 1.53 2004/07/02 19:18:20 pjones
--- bugzilla: 125937 -- use rhn_user to remove user roles
---
--- Revision 1.52 2004/05/26 19:45:48 pjones
--- bugzilla: 123639
--- 1) reformat "entitlement_grants_service"
--- 2) make the .pks and .pkb be in the same order.
--- 3) add "modify_org_service" (to be used instead of set_customer_SERVICELEVEL)
--- 4) add monitoring specific data.
---
--- Revision 1.51 2004/04/19 18:18:51 pjones
--- bugzilla: none -- misa's using set_family_count() to set null org entitlements
---
--- Revision 1.50 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.49 2004/03/26 16:53:42 pjones
--- bugzilla: none -- make rhn_nonlinux give config_admin too on sat.
---
--- Revision 1.48 2004/03/25 22:29:56 pjones
--- bugzilla: none -- only create config_admin in set_customer_prov if we're
--- on a satellite
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/206-rhn_org.pks.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/206-rhn_org.pks.sql
deleted file mode 100644
index fc2d020..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/206-rhn_org.pks.sql
+++ /dev/null
@@ -1,55 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE rhn_org
-IS
- version varchar2(100) := '$Id$';
-
- CURSOR server_group_by_label(org_id_in NUMBER, group_label_in VARCHAR2) IS
- SELECT SG.*
- FROM rhnServerGroupType SGT,
- rhnServerGroup SG
- WHERE SG.group_type = SGT.id
- AND SGT.label = group_label_in
- AND SG.org_id = org_id_in;
-
- FUNCTION find_server_group_by_type(org_id_in NUMBER,
- group_label_in VARCHAR2)
- RETURN NUMBER;
-
- procedure delete_org(org_id_in in number);
- procedure delete_user(user_id_in in number, deleting_org in number := 0);
-
-END rhn_org;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.7 2004/07/13 22:46:04 pjones
--- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
---
--- Revision 1.6 2004/02/10 15:05:01 pjones
--- bugzilla: none -- add version tag here
---
--- Revision 1.5 2003/02/18 16:35:45 pjones
--- delete_user
---
--- Revision 1.4 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/207-rhn_org.pkb.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/207-rhn_org.pkb.sql
deleted file mode 100644
index a6ee578..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/207-rhn_org.pkb.sql
+++ /dev/null
@@ -1,304 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_org
-IS
- body_version varchar2(100) := '$Id$';
-
- FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
- RETURN NUMBER
- IS
- server_group server_group_by_label%ROWTYPE;
- BEGIN
- OPEN server_group_by_label(org_id_in, group_label_in);
- FETCH server_group_by_label INTO server_group;
- CLOSE server_group_by_label;
-
- RETURN server_group.id;
- END find_server_group_by_type;
-
- procedure delete_org (
- org_id_in in number
- )
- is
-
- cursor users is
- select id
- from web_contact
- where org_id = org_id_in;
-
- cursor servers(org_id_in in number) is
- select id
- from rhnServer
- where org_id = org_id_in;
-
- cursor config_channels is
- select id
- from rhnConfigChannel
- where org_id = org_id_in;
-
- begin
-
- if org_id_in = 1 then
- rhn_exception.raise_exception('cannot_delete_base_org');
- end if;
-
- -- Delete all users.
- for u in users loop
- rhn_org.delete_user(u.id, 1);
- end loop;
-
- -- Delete all servers.
- for s in servers(org_id_in) loop
- delete_server(s.id);
- end loop;
-
- -- Delete all config channels.
- for c in config_channels loop
- rhn_config.delete_channel(c.id);
- end loop;
-
- -- Give the org's entitlements back to the main org.
- rhn_entitlements.remove_org_entitlements(org_id_in);
-
- -- Clean up tables where we don't have a cascading delete.
- delete from rhnChannel where org_id = org_id_in;
- delete from rhnDailySummaryQueue where org_id = org_id_in;
- delete from rhnOrgQuota where org_id = org_id_in;
- delete from rhnOrgInfo where org_id = org_id_in;
- delete from rhnFileList where org_id = org_id_in;
- delete from rhnServerGroup where org_id = org_id_in;
- delete from rhn_check_suites where customer_id = org_id_in;
- delete from rhn_command_target where customer_id = org_id_in;
- delete from rhn_contact_groups where customer_id = org_id_in;
- delete from rhn_notification_formats where customer_id = org_id_in;
- delete from rhn_probe where customer_id = org_id_in;
- delete from rhn_redirects where customer_id = org_id_in;
- delete from rhn_sat_cluster where customer_id = org_id_in;
- delete from rhn_schedules where customer_id = org_id_in;
-
- -- Delete the org.
- delete from web_customer where id = org_id_in;
-
- end delete_org;
-
- procedure delete_user(user_id_in in number, deleting_org in number := 0) is
- cursor is_admin is
- select 1
- from rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin';
- cursor servergroups_needing_admins is
- select usgp.server_group_id server_group_id
- from rhnUserServerGroupPerms usgp
- where 1=1
- and usgp.user_id = user_id_in
- and not exists (
- select 1
- from rhnUserServerGroupPerms sq_usgp
- where 1=1
- and sq_usgp.server_group_id = usgp.server_group_id
- and sq_usgp.user_id != user_id_in
- );
- cursor messages is
- select message_id id
- from rhnUserMessage
- where user_id = user_id_in;
- users number;
- our_org_id number;
- other_users number;
- other_org_admin number;
- other_user_id number;
- begin
- select wc.org_id
- into our_org_id
- from web_contact wc
- where id = user_id_in;
-
- -- find any other users
- begin
- select id, 1
- into other_user_id, other_users
- from web_contact
- where 1=1
- and org_id = our_org_id
- and id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- other_users := 0;
- end;
-
- -- now do org admin stuff
- if other_users != 0 then
- for ignore in is_admin loop
- begin
- select new_ugm.user_id
- into other_org_admin
- from rhnUserGroupMembers new_ugm,
- rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin'
- and ug.id = new_ugm.user_group_id
- and new_ugm.user_id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- -- If we're deleting the org, we don't want to raise
- -- the exception.
- if deleting_org = 0 then
- rhn_exception.raise_exception('cannot_delete_user');
- end if;
- end;
-
- for sg in servergroups_needing_admins loop
- rhn_user.add_servergroup_perm(other_org_admin,
- sg.server_group_id);
- end loop;
- end loop;
- end if;
-
- -- and now things for every user
- for message in messages loop
- delete
- from rhnUserMessage
- where user_id = user_id_in
- and message_id = message.id;
- begin
- select 1
- into users
- from rhnUserMessage
- where message_id = message.id
- and rownum = 1;
- delete
- from rhnMessage
- where id = message.id;
- exception
- when no_data_found then
- null;
- end;
- end loop;
- delete from rhn_command_queue_sessions where contact_id = user_id_in;
- delete from rhn_contact_methods where contact_id = user_id_in;
- delete from rhn_redirects where contact_id = user_id_in;
- delete from rhnUserServerPerms where user_id = user_id_in;
- if other_users != 0 then
- update rhnRegToken
- set user_id = nvl(other_org_admin, other_user_id)
- where org_id = our_org_id
- and user_id = user_id_in;
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- -- Just Delete the user
- else
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- end if;
- return;
- end delete_user;
-
-END rhn_org;
-/
-SHOW ERRORS
-
--- $Log$
--- Revision 1.22 2004/10/29 04:50:49 pjones
--- bugzilla: 135179 -- fix org admin swapping during user deletion
---
--- Revision 1.21 2004/07/13 22:46:04 pjones
--- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
---
--- Revision 1.20 2004/07/02 22:24:38 pjones
--- bugzilla: none -- typo fix
---
--- Revision 1.19 2004/07/02 19:19:02 pjones
--- bugzilla: 125937 -- use rhn_user to grant roles to users
---
--- Revision 1.18 2004/05/28 22:21:36 pjones
--- bugzilla: none -- update for monitoring schema
---
--- Revision 1.17 2004/04/05 16:31:07 pjones
--- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
--- has a cascade problem
---
--- Revision 1.16 2004/03/15 17:10:28 pjones
--- bugzilla: 118244 -- delete servers explicitly while deleting lone users
---
--- Revision 1.15 2004/02/09 17:14:54 pjones
--- bugzilla: none -- fix log garbage
---
--- Revision 1.14 2004/01/22 19:44:42 pjones
--- bugzilla: 106562 -- fix exceptions on delete_user()
---
--- Revision 1.13 2004/01/20 17:00:48 pjones
--- bugzilla: none -- try to make delete_user() succeed when there are
--- server groups that have been snapshotted
---
--- Revision 1.12 2004/01/14 20:22:03 pjones
--- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
---
--- Revision 1.11 2003/03/20 17:08:16 pjones
--- avoid the server group members trigger that updates last_modified; it'll
--- cause a mutating table error
---
--- Revision 1.10 2003/03/17 16:31:25 pjones
--- use "on delete set null" where applicable
---
--- Revision 1.9 2003/03/15 00:31:07 pjones
--- bugzilla: none
---
--- tested wrong table for perms on a server group
---
--- Revision 1.8 2003/03/15 00:23:36 pjones
--- bugzilla: 83631
---
--- working delete_user
---
--- Revision 1.7 2003/03/03 23:39:36 pjones
--- different delete_user; this one might actually work.
---
--- Takes about 18 seconds, which seems kindof slow, but isn't
--- intolerable I don't think...
---
--- Revision 1.6 2003/03/02 18:07:00 pjones
--- make it use marty's test instead of is_satellite(); in the sat env,
--- marty's test _is_ is_satellite()
---
--- Revision 1.5 2003/02/18 16:35:45 pjones
--- delete_user
---
--- Revision 1.4 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pkb.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pkb.sql
deleted file mode 100644
index 5969a5c..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pkb.sql
+++ /dev/null
@@ -1,308 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace
-package body rhn_user
-is
- body_version varchar2(100) := '$Id$';
-
- function check_role(user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
- select 1 into throwaway
- from rhnUserGroupType UGT,
- rhnUserGroup UG,
- rhnUserGroupMembers UGM
- where UGM.user_id = user_id_in
- and UGM.user_group_id = UG.id
- and UG.group_type = UGT.id
- and UGT.label = role_in;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end check_role;
-
- function check_role_implied(user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- if the user directly has the role, they win
- if rhn_user.check_role(user_id_in, role_in) = 1
- then
- return 1;
- end if;
-
- -- config_admin and channel_admin are automatically implied for org admins
- if role_in = 'config_admin' and rhn_user.check_role(user_id_in, 'org_admin') = 1
- then
- return 1;
- end if;
-
- if role_in = 'channel_admin' and rhn_user.check_role(user_id_in, 'org_admin') = 1
- then
- return 1;
- end if;
-
- return 0;
- end check_role_implied;
-
- function get_org_id(user_id_in in number)
- return number
- is
- org_id_out number;
- begin
- select org_id into org_id_out
- from web_contact
- where id = user_id_in;
-
- return org_id_out;
- end get_org_id;
-
- -- paid users often don't have verified email addresses, so
- -- try to find an address that is useful to us.
- function find_mailable_address(user_id_in in number)
- return varchar2 is
- PRAGMA AUTONOMOUS_TRANSACTION;
- -- this would be so much prettier if we just had an order built
- -- into rhnEmailAddressState
- cursor addrs is
- select ea.state_id, ea.address
- from rhnEmailAddressState eas,
- rhnEmailAddress ea
- where ea.user_id = user_id_in
- and eas.label = 'verified'
- and ea.state_id = eas.id
- union all
- select ea.state_id, ea.address
- from rhnEmailAddressState eas,
- rhnEmailAddress ea
- where ea.user_id = user_id_in
- and eas.label = 'unverified'
- and ea.state_id = eas.id
- union all
- select ea.state_id, ea.address
- from rhnEmailAddressState eas,
- rhnEmailAddress ea
- where ea.user_id = user_id_in
- and eas.label = 'pending'
- and ea.state_id = eas.id
- union all
- select ea.state_id, ea.address
- from rhnEmailAddressState eas,
- rhnEmailAddress ea
- where ea.user_id = user_id_in
- and eas.label = 'pending_warned'
- and ea.state_id = eas.id
- union all
- select ea.state_id, ea.address
- from rhnEmailAddressState eas,
- rhnEmailAddress ea
- where ea.user_id = user_id_in
- and eas.label = 'needs_verifying'
- and ea.state_id = eas.id
- union all
- select -1 state_id,
- email address
- from web_user_personal_info
- where web_user_id = user_id_in;
- retval rhnEmailAddress.address%TYPE;
- begin
- for addr in addrs loop
- retval := addr.address;
- if addr.address is null then
- update web_user_contact_permission
- set email = 'N'
- where web_user_id = user_id_in;
- commit;
- return null;
- end if;
- if addr.state_id = -1 then
- insert into rhnEmailAddress (
- id, address,
- user_id, state_id
- ) (
- select rhn_eaddress_id_seq.nextval, addr.address,
- user_id_in, eas.id
- from rhnEmailAddressState eas
- where eas.label = 'unverified'
- );
- end if;
- commit;
- return retval;
- end loop;
- return null;
- end;
-
- procedure add_servergroup_perm(
- user_id_in in number,
- server_group_id_in in number
- ) is
- cursor orgs_match is
- select 1
- from rhnServerGroup sg,
- web_contact u
- where u.id = user_id_in
- and sg.id = server_group_id_in
- and sg.org_id = u.org_id;
- begin
- for okay in orgs_match loop
- insert into rhnUserServerGroupPerms(user_id, server_group_id)
- values (user_id_in, server_group_id_in);
- rhn_cache.update_perms_for_user(user_id_in);
- return;
- end loop;
- rhn_exception.raise_exception('usgp_different_orgs');
- exception when dup_val_on_index then
- rhn_exception.raise_exception('usgp_already_allowed');
- end add_servergroup_perm;
-
- procedure remove_servergroup_perm(
- user_id_in in number,
- server_group_id_in in number
- ) is
- cursor perms is
- select 1
- from rhnUserServerGroupPerms
- where user_id = user_id_in
- and server_group_id = server_group_id_in;
- begin
- for perm in perms loop
- delete from rhnUserServerGroupPerms
- where user_id = user_id_in
- and server_group_id = server_group_id_in;
- rhn_cache.update_perms_for_user(user_id_in);
- return;
- end loop;
- rhn_exception.raise_exception('usgp_not_allowed');
- end remove_servergroup_perm;
-
- procedure add_to_usergroup(
- user_id_in in number,
- user_group_id_in in number
- ) is
- cursor perm_granting_usergroups is
- select user_group_id_in
- from rhnUserGroup ug,
- rhnUserGroupType ugt
- where ugt.label in ('org_admin') -- and server_group_admin ?
- and ug.id = user_group_id_in
- and ug.group_type = ugt.id;
- begin
- insert into rhnUserGroupMembers(user_id, user_group_id)
- values (user_id_in, user_group_id_in);
-
- for ug in perm_granting_usergroups loop
- rhn_cache.update_perms_for_user(user_id_in);
- return;
- end loop;
- end add_to_usergroup;
-
- procedure add_users_to_usergroups(
- user_id_in in number
- ) is
- cursor ugms is
- select element user_id,
- element_two user_group_id
- from rhnSet
- where user_id = user_id_in
- and label = 'user_group_list';
- begin
- for ugm in ugms loop
- rhn_user.add_to_usergroup(ugm.user_id, ugm.user_group_id);
- end loop;
- end add_users_to_usergroups;
-
- procedure remove_from_usergroup(
- user_id_in in number,
- user_group_id_in in number
- ) is
- cursor perm_granting_usergroups is
- select label
- from rhnUserGroupType ugt,
- rhnUserGroupMembers ugm,
- rhnUserGroup ug
- where 1=1
- and ug.id = user_group_id_in
- and ugm.user_group_id = user_group_id_in
- and ug.group_type = ugt.id
- and ugm.user_id = user_id_in;
- begin
- -- we only do anything if you're really in the group, because
- -- testing is significantly cheaper than rebuilding the user's
- -- cache for no reason.
- for ug in perm_granting_usergroups loop
- delete from rhnUserGroupMembers
- where user_id = user_id_in
- and user_group_id = user_group_id_in;
- if ug.label in ('org_admin') then
- rhn_cache.update_perms_for_user(user_id_in);
- end if;
- end loop;
- end remove_from_usergroup;
-
- procedure remove_users_from_servergroups(
- user_id_in in number
- ) is
- cursor ugms is
- select element user_id,
- element_two user_group_id
- from rhnSet
- where user_id = user_id_in
- and label = 'user_group_list';
- begin
- for ugm in ugms loop
- rhn_user.remove_from_usergroup(ugm.user_id, ugm.user_group_id);
- end loop;
- end remove_users_from_servergroups;
-end rhn_user;
-/
-SHOW ERRORS
-
--- select rhn_user.get_org_id(502474) from dual;
--- 1271287
--- select rhn_user.check_role(502474, 'org_admin') from dual;
--- 1
--- select rhn_user.check_role(502474, 'org_admin_nope') from dual;
--- 0, but should later raise an exception
-
---
--- $Log$
--- Revision 1.8 2004/07/12 19:35:51 pjones
--- bugzilla: 125937 -- we _always_ delete, but only rebuild cache on org_admin.
---
--- Revision 1.7 2004/07/02 22:29:36 pjones
--- bugzilla: none -- typos and spelling errors.
---
--- Revision 1.6 2004/07/02 19:16:54 pjones
--- bugzilla: 125937 -- tools to manipulate rhnServerGroupMembers and
--- rhnUserGroupMembers
---
--- Revision 1.5 2004/03/31 21:09:47 pjones
--- bugzilla: none -- if the user truly doesn't have any email address, compensate.
---
--- Revision 1.4 2004/02/12 20:53:30 pjones
--- bugzilla: 108212 -- s/get_email_address/find_mailable_address/ and make it
--- do the same as web's version
---
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pks.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pks.sql
deleted file mode 100644
index 7deee08..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/208-rhn_user.pks.sql
+++ /dev/null
@@ -1,64 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create or replace
-package rhn_user
-is
- version varchar2(100) := '$Id$';
-
- function check_role(user_id_in in number, role_in in varchar2) return number;
- PRAGMA RESTRICT_REFERENCES(check_role, WNDS, RNPS, WNPS);
-
- function check_role_implied(user_id_in in number, role_in in varchar2) return number;
- PRAGMA RESTRICT_REFERENCES(check_role_implied, WNDS, RNPS, WNPS);
-
- function get_org_id(user_id_in in number) return number;
- PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
-
- function find_mailable_address(user_id_in in number) return varchar2;
-
- procedure add_servergroup_perm(
- user_id_in in number,
- server_group_id_in in number
- );
-
- procedure remove_servergroup_perm(
- user_id_in in number,
- server_group_id_in in number
- );
-
- procedure add_to_usergroup(
- user_id_in in number,
- user_group_id_in in number
- );
-
- procedure add_users_to_usergroups(
- user_id_in in number
- );
-
- procedure remove_from_usergroup(
- user_id_in in number,
- user_group_id_in in number
- );
-
- procedure remove_users_from_servergroups(
- user_id_in in number
- );
-end rhn_user;
-/
-SHOW ERRORS
diff --git a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/500-rhnPrivateErrataMail.sql b/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/500-rhnPrivateErrataMail.sql
deleted file mode 100644
index 51b67f1..0000000
--- a/schema/spacewalk/upgrade/satellite-5.1-spacewalk-0.2/500-rhnPrivateErrataMail.sql
+++ /dev/null
@@ -1,155 +0,0 @@
--- This view is used for extracting data needed by the errata mailer
--- for private errata mails
---
--- $Id$
-
-create or replace view
-rhnPrivateErrataMail
-as
-with rhnSPmaxEVR as (
- select sq2_sp.server_id, sq2_sp.name_id, max(sq2_pe.evr) max_evr
- from rhnServerPackage sq2_sp,
- rhnPackageEVR sq2_pe
- where sq2_sp.evr_id = sq2_pe.id
- group by sq2_sp.server_id, sq2_sp.name_id)
-select
- w.login,
- w.login_uc,
- wpi.email,
- w.id user_id,
- s.id server_id,
- -- use sg here so we can start with org and work to errata from there
- w.org_id org_id,
- s.name server_name,
- sa.name server_arch,
- s.release server_release,
- ce.errata_id errata_id,
- e.advisory
-from
- rhnServer s,
- web_user_personal_info wpi,
- rhnUserInfo ui,
- rhnErrata e,
- rhnServerArch sa,
- rhnChannelErrata ce,
- web_contact w,
- rhnServerChannel sc,
- rhnServerGroupMembers sgm,
- rhnServerGroup sg
-where 1=1
- -- we plan on starting with org_id, and server group is the
- -- best place to find that that's near servers
- and sg.id = sgm.server_group_id
- and sgm.server_id = sc.server_id
- -- then find the contacts, because permission checking is next
- and sg.org_id = w.org_id
- -- filter out users who don't want mail about this server
- -- they get an entry if they _don't_ want mail
- and not exists (
- select usprefs.server_id
- from rhnUserServerPrefs usprefs
- where 1=1
- and w.id = usprefs.user_id
- and sc.server_id = usprefs.server_id
- and usprefs.name = 'receive_notifications'
- )
- -- filter out users who don't want/can't get email
- and w.id = wpi.web_user_id
- and wpi.email is not null
- and w.id = ui.user_id
- and ui.email_notify = 1
- -- check permissions. For this query being an org admin is the
- -- most common thing, so we test for that first
- and exists (
- select 1
- from
- rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where 1=1
- and ugt.label = 'org_admin'
- and ugt.id = ug.group_type
- and ug.id = ugm.user_group_id
- and ugm.user_id = w.id
- union all
- select 1
- from
- rhnServerGroupMembers sq_sgm,
- rhnUserServerGroupPerms usg
- where sc.server_id = sq_sgm.server_id
- and sq_sgm.server_group_id = usg.server_group_id
- and usg.user_id = w.id
- )
- -- filter out servers that aren't in useful channels
- and sc.channel_id = ce.channel_id
- -- find the server, so we can do s.arch comparisons
- and sc.server_id = s.id
- and exists (
- select 1
- from
- rhnPackageEVR p_evr,
- rhnPackageEVR sp_evr,
- rhnServerPackage sp,
- rhnChannelPackage cp,
- rhnPackage p,
- rhnErrataPackage ep,
- rhnServerPackageArchCompat spac
- where 1=1
- -- packages from channels this server is subscribed to
- and sc.channel_id = cp.channel_id
- and cp.package_id = p.id
- -- part of an errata
- and ce.errata_id = ep.errata_id
- and ep.package_id = p.id
- -- and that errata maps back to the server channel
- and sc.channel_id = ce.channel_id
- and ce.errata_id = ep.errata_id
- -- also installed on this server
- and sc.server_id = sp.server_id
- and sp.name_id = p.name_id
- and sp.evr_id = sp_evr.id
- -- different evr
- and p.evr_id = p_evr.id
- and sp.evr_id != p.evr_id
- -- and newer evr
- and sp_evr.evr < p_evr.evr
- and sp_evr.evr = (
- select max_evr from rhnSPmaxEVR rsme
- where sp.server_id = rsme.server_id
- and sp.name_id = rsme.name_id
- )
- -- compat arch
- and p.package_arch_id = spac.package_arch_id
- and s.server_arch_id = spac.server_arch_id
- )
- -- below here isn't needed except for output
- and s.server_arch_id = sa.id
- and ce.errata_id = e.id
- and not exists ( select 1
- from rhnWebContactDisabled wcd
- where wcd.id = w.id )
-/
-
-
---select count(*) from rhnMailErrataView
---where org_id = 1 and errata_id = 916;
-
--- $Log$
--- Revision 1.2 2003/02/21 20:56:00 pjones
--- change the comments to match the code ;)
---
--- Revision 1.1 2003/02/21 20:45:00 pjones
--- private errata mail
---
--- Revision 1.4 2003/02/12 18:49:11 pjones
--- note about old errata
---
--- Revision 1.3 2002/11/14 17:20:34 pjones
--- arch -> *_arch_id and archCompat changes
---
--- Revision 1.2 2002/11/11 20:49:46 pjones
--- that line's a typo
---
--- Revision 1.1 2002/09/24 22:42:17 pjones
--- free vs paid
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/100-rhnCpuArch-i86pc.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/100-rhnCpuArch-i86pc.sql
deleted file mode 100644
index 8ab903b..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/100-rhnCpuArch-i86pc.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-insert into rhnCpuArch (id, label, name) (
- select rhn_cpu_arch_id_seq.nextval, 'i86pc', 'i86pc'
- from dual
- where not exists (
- select 1
- from rhnCpuArch
- where label = 'i86pc' and name = 'i86pc')
-);
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/101-rhnKickstartPackage-position.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/101-rhnKickstartPackage-position.sql
deleted file mode 100644
index 7f7bdac..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/101-rhnKickstartPackage-position.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-
-alter table rhnKickstartPackage
-add position number;
-
-update rhnKickstartPackage
-set position = 0;
-
-commit;
-
-alter table rhnKickstartPackage
-modify position not null;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/102-rhnIndexerWork-last_modified.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/102-rhnIndexerWork-last_modified.sql
deleted file mode 100644
index 9e15cb9..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/102-rhnIndexerWork-last_modified.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-
-alter table rhnIndexerWork
-add last_modified date default (sysdate) not null;
-
-commit;
-
-
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-drop-rhn-clean-current-state.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-drop-rhn-clean-current-state.sql
deleted file mode 100644
index e5a8926..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-drop-rhn-clean-current-state.sql
+++ /dev/null
@@ -1 +0,0 @@
-drop procedure RHN_CLEAN_CURRENT_STATE;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-rhn_config_parameter_data-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-rhn_config_parameter_data-move_opt.sql
deleted file mode 100644
index 87bc4d6..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/103-rhn_config_parameter_data-move_opt.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-
-update rhn_config_parameter set value=replace(value, '/opt/nocpulse/TSDBLocalQueue', '/var/log/nocpulse/TSDBLocalQueue');
-update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/var/', '/var/lib/nocpulse/');
-update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/etc', '/etc/nocpulse');
-update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/bin/', '/usr/bin/');
-update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/.ssh', '/var/lib/nocpulse/.ssh');
-update rhn_config_parameter set value=replace(value, '/opt/notification/queue', '/var/lib/nocpulse/queue');
-update rhn_config_parameter set value=replace(value, '/opt/notification/var', '/var/log/nocpulse');
-update rhn_config_parameter set value=replace(value, '/opt/notification/etc', '/etc/nocpulse');
-update rhn_config_parameter set value=replace(value, '/opt/notification/tmp', '/var/tmp');
-update rhn_config_parameter set value=replace(value, '/opt/notification', '/var/lib/nocpulse');
-
-commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-drop-is-user-org-admin.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-drop-is-user-org-admin.sql
deleted file mode 100644
index 47031e7..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-drop-is-user-org-admin.sql
+++ /dev/null
@@ -1 +0,0 @@
-drop function is_user_org_admin;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-rhn_command-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-rhn_command-move_opt.sql
deleted file mode 100644
index 784c5a0..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/104-rhn_command-move_opt.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter table rhn_command
-modify command_class default '/var/lib/nocpulse/libexec';
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/105-rhn_command_queue_commands-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/105-rhn_command_queue_commands-move_opt.sql
deleted file mode 100644
index 3748aeb..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/105-rhn_command_queue_commands-move_opt.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-update rhn_command_queue_commands set command_line=replace(command_line, '/opt/home/nocpulse/bin/', '/usr/bin/');
-commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/110-rhn_contact_groups-cleanup.sql b/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/110-rhn_contact_groups-cleanup.sql
deleted file mode 100644
index 411cc72..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.2-spacewalk-0.3/110-rhn_contact_groups-cleanup.sql
+++ /dev/null
@@ -1,8 +0,0 @@
-
-delete from rhn_contact_groups
-where not exists (
- select 1
- from rhn_contact_group_members
- where rhn_contact_groups.recid = contact_group_id
- );
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/112-rhnKSData-drop-name.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/112-rhnKSData-drop-name.sql
deleted file mode 100644
index 33bc74e..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/112-rhnKSData-drop-name.sql
+++ /dev/null
@@ -1,35 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnKSData
-DROP CONSTRAINT rhn_ks_oid_name_uq;
-
-ALTER TABLE rhnKSData
-DROP COLUMN name;
-
-ALTER TABLE rhnKsData
-ADD cobbler_id varchar(64);
-
-show errors
-
--- $Log$
--- Revision 2 2008/12/02 16:51:05.2 jsherrill
--- Add cobbler_id column
---
--- Revision 1 2008/10/01 7:01:05 mmccune
--- Removed the unused name column
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/113-rhnActionKickstart-add-kshost.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/113-rhnActionKickstart-add-kshost.sql
deleted file mode 100644
index a281877..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/113-rhnActionKickstart-add-kshost.sql
+++ /dev/null
@@ -1,27 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
-ALTER TABLE rhnActionKickstart
- ADD kickstart_host varchar2(256);
-
-show errors
-
--- $Log$
--- Revision 1 2008/10/29 7:01:05 mmccune
--- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/114-rhnChannelTrust.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/114-rhnChannelTrust.sql
deleted file mode 100644
index c4ee3a1..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/114-rhnChannelTrust.sql
+++ /dev/null
@@ -1,51 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnChannelTrust
-(
- channel_id number
- constraint rhn_channel_trust_cid_nn not null
- constraint rhn_channel_trust_cid_fk
- references rhnChannel(id)
- on delete cascade,
- org_trust_id number
- constraint rhn_channel_trust_otid_nn not null
- constraint rhn_channel_trust_otid_fk
- references web_customer(id)
- on delete cascade,
- created date default (sysdate)
- constraint rhn_channel_trust_created_nn not null,
- modified date default (sysdate)
- constraint rhn_channel_trust_modified_nn not null
-)
- storage( pctincrease 1 freelists 16)
- enable row movement
- initrans 32;
-
-create unique index rhn_channel_trust_cid_uq
- on rhnChannelTrust(channel_id,org_trust_id)
- tablespace [[2m_tbs]]
- storage( pctincrease 1 freelists 16)
- initrans 32;
-
-create index rhn_channel_trust_org_trust
- on rhnChannelTrust(org_trust_id)
- tablespace [[2m_tbs]]
- storage( pctincrease 1 freelists 16)
- initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/115-rhnChannel-add-maint-columns.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/115-rhnChannel-add-maint-columns.sql
deleted file mode 100644
index ad73ba9..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/115-rhnChannel-add-maint-columns.sql
+++ /dev/null
@@ -1,54 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-ALTER TABLE rhnChannel
-ADD channel_access varchar2(10) default 'private';
-
-ALTER TABLE rhnChannel
-ADD maint_name varchar2(128);
-
-ALTER TABLE rhnChannel
-ADD maint_email varchar2(128);
-
-ALTER TABLE rhnChannel
-ADD maint_phone varchar2(128);
-
-ALTER TABLE rhnChannel
-ADD support_policy varchar2(256);
-
-
-
-create index rhn_channel_access_idx
- on rhnChannel(channel_access)
- tablespace [[64k_tbs]]
- storage ( freelists 16 )
- initrans 32
- nologging;
-
-create or replace trigger rhn_channel_access_trig
-after update on rhnChannel
-for each row
-begin
- if :old.channel_access = 'protected' and
- :new.channel_access != 'protected'
- then
- delete from rhnChannelTrust where channel_id = :old.id;
- end if;
-end;
-/
-show errors
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/116-rhnTrustedOrgs.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/116-rhnTrustedOrgs.sql
deleted file mode 100644
index 2f4e8fa..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/116-rhnTrustedOrgs.sql
+++ /dev/null
@@ -1,45 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnTrustedOrgs
-(
- org_id number
- constraint rhn_trusted_orgs_oid_nn not null
- constraint rhn_trusted_orgs_oid_fk
- references web_customer(id)
- on delete cascade,
- org_trust_id number
- constraint rhn_trusted_orgs_otid_nn not null
- constraint rhn_trusted_orgs_otid_fk
- references web_customer(id)
- on delete cascade,
- created date default (sysdate)
- constraint rhn_trusted_orgs_created_nn not null,
- modified date default (sysdate)
- constraint rhn_trusted_orgs_modified_nn not null
-)
- storage( pctincrease 1 freelists 16)
- enable row movement
- initrans 32;
-
-create unique index rhn_trusted_orgs_oid_uq
- on rhnTrustedOrgs(org_id,org_trust_id)
- tablespace [[2m_tbs]]
- storage( pctincrease 1 freelists 16)
- initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/117-rhnAllowTrust.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/117-rhnAllowTrust.sql
deleted file mode 100644
index da05422..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/117-rhnAllowTrust.sql
+++ /dev/null
@@ -1,42 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnAllowTrust
-(
- org_id number
- constraint rhn_allow_trust_oid_nn not null
- constraint rhn_allow_trust_oid_fk
- references web_customer(id)
- on delete cascade,
- channel_flag char(1) default('N')
- constraint rhn_allow_trust_channelflg_nn not null
- constraint rhn_allow_trust_channelflg_ck
- check (channel_flag in ('N','Y')),
- migration_flag char(1) default('N')
- constraint rhn_allow_trust_migrflg_nn not null
- constraint rhn_allow_trust_migrflg_ck
- check (migration_flag in ('N','Y')),
- created date default (sysdate)
- constraint rhn_allow_trust_created_nn not null,
- modified date default (sysdate)
- constraint rhn_allow_trust_modified_nn not null
-)
- storage( pctincrease 1 freelists 16)
- enable row movement
- initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/118-rhnSystemMigrations.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/118-rhnSystemMigrations.sql
deleted file mode 100644
index 39084c2..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/118-rhnSystemMigrations.sql
+++ /dev/null
@@ -1,51 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-create table
-rhnSystemMigrations
-(
- org_id_to number
- constraint rhn_sys_mig_oidto_nn not null
- constraint rhn_sys_mig_oidto_fk
- references web_customer(id),
- org_id_from number
- constraint rhn_sys_mig_oidfrm_nn not null
- constraint rhn_sys_mig_oidfrm_fk
- references web_customer(id),
- server_id number
- constraint rhn_sys_mig_sid_nn not null
- constraint rhn_sys_mig_sid_fk
- references rhnServer(id)
- on delete cascade,
- migrated date default (sysdate)
- constraint rhn_sys_mig_migrated_nn not null
-)
- storage ( pctincrease 1 freelists 16 )
- enable row movement
- initrans 32;
-
-create index rsm_org_id_to_idx
- on rhnSystemMigrations ( org_id_to )
- storage ( freelists 16 )
- initrans 32;
-
-
-create index rsm_org_id_from_idx
- on rhnSystemMigrations ( org_id_from )
- storage ( freelists 16 )
- initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/119-rhnSharedChannelView.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/119-rhnSharedChannelView.sql
deleted file mode 100644
index bced9fb..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/119-rhnSharedChannelView.sql
+++ /dev/null
@@ -1,55 +0,0 @@
-CREATE OR REPLACE VIEW RHNSHAREDCHANNELVIEW
-AS
-SELECT
- CH.ID,
- CH.PARENT_CHANNEL,
- CH.ORG_ID,
- CH.CHANNEL_ARCH_ID,
- CH.LABEL,
- CH.BASEDIR,
- CH.NAME,
- CH.SUMMARY,
- CH.DESCRIPTION,
- CH.PRODUCT_NAME_ID,
- CH.GPG_KEY_URL,
- CH.GPG_KEY_ID,
- CH.GPG_KEY_FP,
- CH.END_OF_LIFE,
- CH.RECEIVING_UPDATES,
- CH.LAST_MODIFIED,
- CH.CHANNEL_PRODUCT_ID,
- CH.CREATED,
- CH.MODIFIED,
- CH.CHANNEL_ACCESS,
- TR.ORG_TRUST_ID
-FROM RHNCHANNEL CH,
- RHNTRUSTEDORGS TR
-WHERE CH.ORG_ID = TR.ORG_ID AND
- CH.CHANNEL_ACCESS = 'public'
-UNION
-SELECT
- CH.ID,
- CH.PARENT_CHANNEL,
- CH.ORG_ID,
- CH.CHANNEL_ARCH_ID,
- CH.LABEL,
- CH.BASEDIR,
- CH.NAME,
- CH.SUMMARY,
- CH.DESCRIPTION,
- CH.PRODUCT_NAME_ID,
- CH.GPG_KEY_URL,
- CH.GPG_KEY_ID,
- CH.GPG_KEY_FP,
- CH.END_OF_LIFE,
- CH.RECEIVING_UPDATES,
- CH.LAST_MODIFIED,
- CH.CHANNEL_PRODUCT_ID,
- CH.CREATED,
- CH.MODIFIED,
- CH.CHANNEL_ACCESS,
- TR.ORG_TRUST_ID
-FROM RHNCHANNEL CH,
- RHNCHANNELTRUST TR
-WHERE CH.ID = TR.CHANNEL_ID
-/
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/120-rhnUserChannel.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/120-rhnUserChannel.sql
deleted file mode 100644
index 7164afc..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/120-rhnUserChannel.sql
+++ /dev/null
@@ -1,66 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-create or replace view rhnUserChannel
-as
-select
- cfp.user_id,
- cfp.org_id,
- cfm.channel_id,
- 'manage' role
-from rhnChannelFamilyMembers cfm,
- rhnUserChannelFamilyPerms cfp
-where
- cfp.channel_family_id = cfm.channel_family_id and
- rhn_channel.user_role_check(cfm.channel_id, cfp.user_id, 'manage') = 1
-union all
-select
- cfp.user_id,
- cfp.org_id,
- cfm.channel_id,
- 'subscribe' role
-from rhnChannelFamilyMembers cfm,
- rhnUserChannelFamilyPerms cfp
-where
- cfp.channel_family_id = cfm.channel_family_id and
- rhn_channel.user_role_check(cfm.channel_id, cfp.user_id, 'subscribe') = 1
-union all
-select
- w.id as user_id,
- w.org_id,
- s.id as channel_id,
- 'subscribe' role
-from rhnSharedChannelView s,
- web_contact w
-where
- w.org_id = s.org_trust_id and
- rhn_channel.user_role_check(s.id, w.id, 'subscribe') = 1;
-
---
---
--- Revision 1.15 2004/04/28 14:57:02 pjones
--- bugzilla: 119698 -- Go back to a split version of this, like in 1.13. We
--- don't need the distinct though; nothing can show up in either table twice.
---
--- Revision 1.13 2004/04/14 15:58:39 pjones
--- bugzilla: none -- make rhnUserChannel work without org_id... (duh...)
---
--- Revision 1.12 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/121-rhn_channel.pks.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/121-rhn_channel.pks.sql
deleted file mode 100644
index 7783451..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/121-rhn_channel.pks.sql
+++ /dev/null
@@ -1,250 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-CREATE OR REPLACE
-PACKAGE rhn_channel
-IS
- version varchar2(100) := '';
-
- CURSOR server_base_subscriptions(server_id_in NUMBER) IS
- SELECT C.id
- FROM rhnChannel C, rhnServerChannel SC
- WHERE C.id = SC.channel_id
- AND SC.server_id = server_id_in
- AND C.parent_channel IS NULL;
-
- CURSOR check_server_subscription(server_id_in NUMBER, channel_id_in NUMBER) IS
- SELECT channel_id
- FROM rhnServerChannel
- WHERE server_id = server_id_in
- AND channel_id = channel_id_in;
-
- CURSOR check_server_parent_membership(server_id_in NUMBER, channel_id_in NUMBER) IS
- SELECT C.id
- FROM rhnChannel C, rhnServerChannel SC
- WHERE C.parent_channel = channel_id_in
- AND C.id = SC.channel_id
- AND SC.server_id = server_id_in;
-
- CURSOR channel_family_perm_cursor(channel_family_id_in NUMBER, org_id_in NUMBER) IS
- SELECT *
- FROM rhnOrgChannelFamilyPermissions
- WHERE channel_family_id = channel_family_id_in
- AND org_id = org_id_in;
-
- PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER);
- FUNCTION get_license_path(channel_id_in IN NUMBER) RETURN VARCHAR2;
-
- PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
- deleting_server in number := 0 );
- PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in number := null);
-
- function can_server_consume_virt_channl(
- server_id_in IN NUMBER,
- family_id_in in number)
- return number;
-
- FUNCTION guess_server_base(server_id_in IN NUMBER) RETURN NUMBER;
-
- FUNCTION base_channel_for_release_arch(release_in in varchar2,
- server_arch_in in varchar2, org_id_in in number := -1,
- user_id_in in number := null) RETURN number;
-
- FUNCTION base_channel_rel_archid(release_in in varchar2,
- server_arch_id_in in number, org_id_in in number := -1,
- user_id_in in number := null) RETURN number;
-
- FUNCTION channel_priority(channel_id_in in number) RETURN number;
-
- PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
- PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
-
- PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
- procedure bulk_server_basechange_from(
- set_label_in in varchar2,
- set_uid_in in number,
- old_channel_id_in in number,
- new_channel_id_in in number);
-
- procedure bulk_guess_server_base(
- set_label_in in varchar2,
- set_uid_in in number);
-
- procedure bulk_guess_server_base_from(
- set_label_in in varchar2,
- set_uid_in in number,
- channel_id_in in number);
-
- PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server in number := 0 );
-
- FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
-
- function channel_family_current_members(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- return number;
-
- PROCEDURE update_family_counts(channel_family_id_in IN NUMBER, org_id_in IN NUMBER);
- FUNCTION family_for_channel(channel_id_in IN NUMBER) RETURN NUMBER;
-
- FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
-
- procedure entitle_customer(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
- procedure set_family_maxmembers(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
- procedure unsubscribe_server_from_family(server_id_in in number, channel_family_id_in in number);
-
- procedure delete_server_channels(server_id_in in number);
- procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)');
-
- function get_org_id(channel_id_in in number) return number;
- PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
-
- function get_org_access(channel_id_in in number, org_id_in in number) return number;
- PRAGMA RESTRICT_REFERENCES(get_org_access, WNDS, RNPS, WNPS);
-
- function get_cfam_org_access(cfam_id_in in number, org_id_in in number) return number;
-
- function user_role_check_debug(channel_id_in in number, user_id_in in number, role_in in varchar2, reason_out out varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(user_role_check_debug, WNDS, RNPS, WNPS);
-
- function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(user_role_check, WNDS, RNPS, WNPS);
-
- function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(loose_user_role_check, WNDS, RNPS, WNPS);
-
- function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(direct_user_role_check, WNDS, RNPS, WNPS);
-
- function shared_user_role_check(channel_id in number, user_id in number, role in varchar2)
- RETURN NUMBER;
- PRAGMA RESTRICT_REFERENCES(shared_user_role_check, WNDS, RNPS, WNPS);
-
- function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
- RETURN NUMBER;
-
- PROCEDURE update_channel ( channel_id_in in number, invalidate_ss in number := 0,
- date_to_use in date := sysdate );
-
- PROCEDURE update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate );
-
- PROCEDURE update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate );
-
-
- PRAGMA RESTRICT_REFERENCES(org_channel_setting, WNDS, RNPS, WNPS);
-
-END rhn_channel;
-/
-SHOW ERRORS
-
---
--- Revision 1.37 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.36 2004/03/26 18:11:32 rbb
--- Bugzilla: 114057
---
--- Add a script to determine channel priority.
---
--- Revision 1.35 2004/02/17 20:16:52 pjones
--- bugzilla: none -- add cvs tags into the package as long as we're touching
--- it anyway
---
--- Revision 1.34 2003/11/13 18:13:09 cturner
--- pragmas can now return now that rhn_user pragmas are fixed
---
--- Revision 1.32 2003/09/22 21:00:40 cturner
--- add method for easy acl check
---
--- Revision 1.31 2003/09/17 22:14:11 misa
--- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
---
--- Revision 1.30 2003/07/24 16:44:16 misa
--- bugzilla: none A function more usable on the rhnapp side
---
--- Revision 1.29 2003/07/24 14:00:17 misa
--- bugzilla: none PRAGMA RESTRICT_REFERENCES good
---
--- Revision 1.28 2003/07/23 21:59:19 cturner
--- rework how rhnUserChannel works; move to plsql for speed and maintenance
---
--- Revision 1.27 2003/07/21 17:49:12 pjones
--- bugzilla: none
---
--- add optional user for subscribe_server
---
--- Revision 1.26 2002/12/19 18:13:42 misa
--- Added caller with a default value
---
--- Revision 1.25 2002/12/11 22:18:46 pjones
--- rhnChannelNewestPackage
---
--- Revision 1.24 2002/11/21 22:08:11 pjones
--- make unsubscribe_channels have a "unsubscribe_children_in number := 0"
--- argument so that you can tell it to unsubscribe children.
---
--- Also, make it raise an exception instead of silent failure in the
--- other case.
---
--- Revision 1.23 2002/11/18 17:20:50 pjones
--- this should have gone back too
---
--- Revision 1.22 2002/11/13 23:16:18 pjones
--- lookup_*_arch()
---
--- Revision 1.21 2002/10/07 20:01:59 rnorwood
--- guess base channel for ssm and single system
---
--- Revision 1.20 2002/10/02 19:21:03 bretm
--- o 3rd party channel schema changes, no more clobs...
---
--- Revision 1.19 2002/09/20 19:21:58 bretm
--- o more 3rd party channel stuff...
---
--- Revision 1.18 2002/06/12 22:33:03 pjones
--- procedure bulk_guess_server_base_from(
--- set_label_in in varchar2,
--- set_uid_in in number,
--- channel_id_in in number);
---
--- for bretm
---
--- Revision 1.17 2002/06/12 22:12:25 pjones
--- procedure bulk_guess_server_base(
--- set_label_in in varchar2,
--- set_uid_in in number);
---
--- for bretm
---
--- Revision 1.16 2002/06/12 19:37:55 pjones
--- bulk_server_basechange_from(
--- set_label_in in varchar2,
--- set_uid_in in number,
--- old_channel_id_in in number,
--- new_channel_id_in in number
--- );
---
--- for bretm
---
--- Revision 1.15 2002/05/10 22:08:22 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/122-rhn_channel.pkb.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/122-rhn_channel.pkb.sql
deleted file mode 100644
index 974c897..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/122-rhn_channel.pkb.sql
+++ /dev/null
@@ -1,1398 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_channel
-IS
- body_version varchar2(100) := '';
-
- -- Cursor that fetches all the possible base channels for a
- -- (server_arch_id, release, org_id) combination
- cursor base_channel_cursor(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number
- ) return rhnChannel%ROWTYPE is
- select distinct c.*
- from rhnDistChannelMap dcm,
- rhnServerChannelArchCompat scac,
- rhnChannel c,
- rhnChannelPermissions cp
- where cp.org_id = org_id_in
- and cp.channel_id = c.id
- and c.parent_channel is null
- and c.id = dcm.channel_id
- and c.channel_arch_id = dcm.channel_arch_id
- and dcm.release = release_in
- and scac.server_arch_id = server_arch_id_in
- and scac.channel_arch_id = c.channel_arch_id;
-
- FUNCTION get_license_path(channel_id_in IN NUMBER)
- RETURN VARCHAR2
- IS
- license_val VARCHAR2(1000);
- BEGIN
- SELECT CFL.license_path INTO license_val
- FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
- WHERE CFM.channel_id = channel_id_in
- AND CFM.channel_family_id = CFL.channel_family_id;
-
- RETURN license_val;
-
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END get_license_path;
-
-
- PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
- IS
- channel_family_id_val NUMBER;
- BEGIN
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- IF rhn_channel.get_license_path(channel_id_in) IS NULL
- THEN
- rhn_exception.raise_exception('channel_consent_no_license');
- END IF;
-
- INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
- VALUES (channel_family_id_val, user_id_in, server_id_in);
- END license_consent;
-
- PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
- IS
- channel_parent_val rhnChannel.parent_channel%TYPE;
- parent_subscribed BOOLEAN;
- server_has_base_chan BOOLEAN;
- server_already_in_chan BOOLEAN;
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- consenting_user NUMBER;
- allowed number := 0;
- current_members_val number;
- BEGIN
- if user_id_in is not null then
- allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
- else
- allowed := 1;
- end if;
-
- if allowed = 0 then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
-
-
- SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
-
- IF channel_parent_val IS NOT NULL
- THEN
- -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
- parent_subscribed := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
- LOOP
- parent_subscribed := TRUE;
- END LOOP check_subscription;
-
- IF NOT parent_subscribed
- THEN
- RETURN;
- END IF;
- ELSE
- -- base channel
- server_has_base_chan := FALSE;
- FOR base IN server_base_subscriptions(server_id_in)
- LOOP
- server_has_base_chan := TRUE;
- END LOOP base;
-
- IF server_has_base_chan
- THEN
- rhn_exception.raise_exception('channel_server_one_base');
- END IF;
- END IF;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_subscribe_no_family');
- END IF;
-
- --
- -- Use the org_id of the server only if the org_id of the channel = NULL.
- -- This is required for subscribing to shared channels.
- --
- SELECT NVL(org_id, (SELECT org_id FROM rhnServer WHERE id = server_id_in))
- INTO server_org_id_val
- FROM rhnChannel
- WHERE id = channel_id_in;
-
- select current_members
- into current_members_val
- from rhnPrivateChannelFamily
- where org_id = server_org_id_val and channel_family_id = channel_family_id_val
- for update of current_members;
-
- available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
-
- IF available_subscriptions IS NULL OR
- available_subscriptions > 0 or
- can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
- THEN
-
- IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
- THEN
- BEGIN
-
- SELECT user_id INTO consenting_user
- FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- EXCEPTION
- WHEN NO_DATA_FOUND THEN
- rhn_exception.raise_exception('channel_subscribe_no_consent');
- END;
- END IF;
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- queue_server(server_id_in, immediate_in);
- ELSE
- rhn_exception.raise_exception('channel_family_no_subscriptions');
- END IF;
-
- END subscribe_server;
-
- function can_server_consume_virt_channl(
- server_id_in in number,
- family_id_in in number )
- return number
- is
-
- cursor server_virt_families is
- select vi.virtual_system_id, cfvsl.channel_family_id
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnVirtualInstance vi
- where
- vi.virtual_system_id = server_id_in
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- and cfvsl.channel_family_id = family_id_in
- and exists (
- select 1
- from rhnServerEntitlementView sev
- where vi.host_system_id = sev.server_id
- and sev.server_group_type_id = sgtvsl.server_group_type_id );
- begin
-
- for server_virt_family in server_virt_families loop
- return 1;
- end loop;
-
- return 0;
-
- end;
-
-
- PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END LOOP server;
- END bulk_subscribe_server;
-
- PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- IF rhn_server.can_change_base_channel(server.element) = 1
- THEN
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
- END IF;
- END LOOP server;
- END bulk_server_base_change;
-
- procedure bulk_server_basechange_from(
- set_label_in in varchar2,
- set_uid_in in number,
- old_channel_id_in in number,
- new_channel_id_in in number
- ) is
- cursor servers is
- select sc.server_id id
- from rhnChannel nc,
- rhnServerChannelArchCompat scac,
- rhnServer s,
- rhnChannel oc,
- rhnServerChannel sc,
- rhnSet st
- where 1=1
- -- first, find the servers we're looking for.
- and st.label = set_label_in
- and st.user_id = set_uid_in
- and st.element = sc.server_id
- -- now, filter out anything that's not in the
- -- old base channel.
- and sc.channel_id = old_channel_id_in
- and sc.channel_id = oc.id
- and oc.parent_channel is null
- -- now, see if it's compatible with the new base channel
- and nc.id = new_channel_id_in
- and nc.parent_channel is null
- and sc.server_id = s.id
- and s.server_arch_id = scac.server_arch_id
- and scac.channel_arch_id = nc.channel_arch_id;
- begin
- for s in servers loop
- insert into rhnSet (
- user_id, label, element
- ) values (
- set_uid_in,
- set_label_in || 'basechange',
- s.id
- );
- end loop channel;
- bulk_server_base_change(new_channel_id_in,
- set_label_in || 'basechange',
- set_uid_in);
- delete from rhnSet
- where label = set_label_in||'basechange'
- and user_id = set_uid_in;
- end bulk_server_basechange_from;
-
- procedure bulk_guess_server_base(
- set_label_in in varchar2,
- set_uid_in in number
- ) is
- channel_id number;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- -- anything that doesn't work, we just ignore
- begin
- if rhn_server.can_change_base_channel(server.element) = 1
- then
- channel_id := guess_server_base(TO_NUMBER(server.element));
- rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
- rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
- end if;
- exception when others then
- null;
- end;
- end loop server;
- end;
-
- function guess_server_base(
- server_id_in in number
- ) RETURN number is
- cursor server_cursor is
- select s.server_arch_id, s.release, s.org_id
- from rhnServer s
- where s.id = server_id_in;
- begin
- for s in server_cursor loop
- for channel in base_channel_cursor(s.release,
- s.server_arch_id, s.org_id)
- loop
- return channel.id;
- end loop base_channel_cursor;
- end loop server_cursor;
- -- Server not found, or no base channel applies to it
- return null;
- end;
-
- -- Private function
- function normalize_server_arch(server_arch_in in varchar2)
- return varchar2
- deterministic
- is
- suffix VARCHAR2(128) := '-redhat-linux';
- suffix_len NUMBER := length(suffix);
- begin
- if server_arch_in is NULL then
- return NULL;
- end if;
- if instr(server_arch_in, '-') > 0
- then
- -- Suffix already present
- return server_arch_in;
- end if;
- return server_arch_in || suffix;
- end normalize_server_arch;
-
- --
- --
- -- Raises:
- -- server_arch_not_found
- -- no_subscribe_permissions
- function base_channel_for_release_arch(
- release_in in varchar2,
- server_arch_in in varchar2,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- server_arch varchar2(256) := normalize_server_arch(server_arch_in);
- server_arch_id number;
- begin
- -- Look up the server arch
- begin
- select id
- into server_arch_id
- from rhnServerArch
- where label = server_arch;
- exception
- when no_data_found then
- rhn_exception.raise_exception('server_arch_not_found');
- end;
- return base_channel_rel_archid(release_in, server_arch_id,
- org_id_in, user_id_in);
- end base_channel_for_release_arch;
-
- function base_channel_rel_archid(
- release_in in varchar2,
- server_arch_id_in in number,
- org_id_in in number := -1,
- user_id_in in number := null
- ) return number is
- denied_channel_id number := null;
- valid_org_id number := org_id_in;
- valid_user_id number := user_id_in;
- channel_subscribable number;
- begin
- if org_id_in = -1 and user_id_in is not null then
- -- Get the org id from the user id
- begin
- select org_id
- into valid_org_id
- from web_contact
- where id = user_id_in;
- exception
- when no_data_found then
- -- User doesn't exist
- -- XXX Only list public stuff for now
- valid_user_id := null;
- valid_org_id := -1;
- end;
- end if;
-
- for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
- loop
- -- This row is a possible match
- if valid_user_id is null then
- -- User ID not specified, so no user to channel permissions to
- -- check
- return c.id;
- end if;
-
- -- Check user to channel permissions
- select loose_user_role_check(c.id, user_id_in, 'subscribe')
- into channel_subscribable
- from dual;
-
- if channel_subscribable = 1 then
- return c.id;
- end if;
-
- -- Base channel exists, but is not subscribable; keep trying
- denied_channel_id := c.id;
- end loop base_channel_fetch;
-
- if denied_channel_id is not null then
- rhn_exception.raise_exception('no_subscribe_permissions');
- end if;
- -- No base channel applies
- return NULL;
- end base_channel_rel_archid;
-
- procedure bulk_guess_server_base_from(
- set_label_in in varchar2,
- set_uid_in in number,
- channel_id_in in number
- ) is
- cursor channels(server_id_in in number) is
- select rsc.channel_id
- from rhnServerChannel rsc,
- rhnChannel rc
- where server_id_in = rsc.server_id
- and rsc.channel_id = rc.id
- and rc.parent_channel is null;
- begin
- for server in rhn_set.set_iterator(set_label_in, set_uid_in)
- loop
- for channel in channels(server.element)
- loop
- if channel.channel_id = channel_id_in
- then
- insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
- end if;
- end loop channel;
- end loop server;
- bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
- delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
- end;
-
-
- PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
- IS
- cursor server_channels(server_id_in in number) is
- select s.org_id, sc.channel_id, cfm.channel_family_id
- from rhnServer s,
- rhnServerChannel sc,
- rhnChannelFamilyMembers cfm
- where s.id = server_id_in
- and s.id = sc.server_id
- and sc.channel_id = cfm.channel_id;
- BEGIN
- for channel in server_channels(server_id_in)
- loop
- unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
- rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
- end loop channel;
- END clear_subscriptions;
-
- PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
- deleting_server IN NUMBER := 0 )
- IS
- channel_family_id_val NUMBER;
- server_org_id_val NUMBER;
- available_subscriptions NUMBER;
- server_already_in_chan BOOLEAN;
- cursor channel_family_is_proxy(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-proxy';
- cursor channel_family_is_satellite(channel_family_id_in in number) is
- select 1
- from rhnChannelFamily
- where id = channel_family_id_in
- and label = 'rhn-satellite';
- -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
- -- with the package-level one, we get a "cursor already open", so we need a
- -- copy on our call stack instead. GROAN.
- cursor local_chk_server_parent_memb (
- server_id_in number,
- channel_id_in number ) is
- select c.id
- from rhnChannel c,
- rhnServerChannel sc
- where 1=1
- and c.parent_channel = channel_id_in
- and c.id = sc.channel_id
- and sc.server_id = server_id_in;
- BEGIN
- FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
- LOOP
- if unsubscribe_children_in = 1 then
- unsubscribe_server(server_id_in => server_id_in,
- channel_id_in => child.id,
- immediate_in => immediate_in,
- unsubscribe_children_in => unsubscribe_children_in,
- deleting_server => deleting_server);
- else
- rhn_exception.raise_exception('channel_unsubscribe_child_exists');
- end if;
- END LOOP child;
-
- server_already_in_chan := FALSE;
-
- FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
- LOOP
- server_already_in_chan := TRUE;
- END LOOP check_subscription;
-
- IF NOT server_already_in_chan
- THEN
- RETURN;
- END IF;
-
- if deleting_server = 0 then
-
- insert into rhnServerHistory (id,server_id,summary,details) (
- select rhn_event_id_seq.nextval,
- server_id_in,
- 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
- c.label
- from rhnChannel c
- where c.id = channel_id_in
- );
-
- UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
- end if;
-
- DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
-
- if deleting_server = 0 then
- queue_server(server_id_in, immediate_in);
- end if;
-
- channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
- IF channel_family_id_val IS NULL
- THEN
- rhn_exception.raise_exception('channel_unsubscribe_no_family');
- END IF;
-
- for ignore in channel_family_is_satellite(channel_family_id_val) loop
- delete from rhnSatelliteInfo where server_id = server_id_in;
- delete from rhnSatelliteChannelFamily where server_id = server_id_in;
- end loop;
-
- for ignore in channel_family_is_proxy(channel_family_id_val) loop
- delete from rhnProxyInfo where server_id = server_id_in;
- end loop;
-
- DELETE FROM rhnChannelFamilyLicenseConsent
- WHERE channel_family_id = channel_family_id_val
- AND server_id = server_id_in;
-
- SELECT org_id INTO server_org_id_val
- FROM rhnServer
- WHERE id = server_id_in;
-
- rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
- END unsubscribe_server;
-
- PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
- IS
- BEGIN
- FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
- LOOP
- rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
- END LOOP server;
- END bulk_unsubscribe_server;
-
- FUNCTION family_for_channel(channel_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN channel_family_id_val;
- EXCEPTION
- WHEN NO_DATA_FOUND
- THEN
- RETURN NULL;
- END family_for_channel;
-
- FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- cfp channel_family_perm_cursor%ROWTYPE;
- current_members_val NUMBER;
- max_members_val NUMBER;
- found NUMBER;
- BEGIN
- IF NOT channel_family_perm_cursor%ISOPEN
- THEN
- OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
- END IF;
-
- FETCH channel_family_perm_cursor INTO cfp;
-
- WHILE channel_family_perm_cursor%FOUND
- LOOP
- found := 1;
-
- current_members_val := cfp.current_members;
- max_members_val := cfp.max_members;
-
- FETCH channel_family_perm_cursor INTO cfp;
- END LOOP;
-
- IF channel_family_perm_cursor%ISOPEN
- THEN
- CLOSE channel_family_perm_cursor;
- END IF;
-
- -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
- -- either way, there are no available subscriptions
-
- IF found IS NULL
- THEN
- RETURN 0;
- END IF;
-
- -- null max members? in that case, pass it on; NULL means infinite
- IF max_members_val IS NULL
- THEN
- RETURN NULL;
- END IF;
-
- -- otherwise, return the delta
- RETURN max_members_val - current_members_val;
- END available_family_subscriptions;
-
- -- *******************************************************************
- -- FUNCTION: channel_family_current_members
- -- Calculates and returns the actual count of systems consuming
- -- physical channel subscriptions.
- -- Called by: update_family_counts
- -- rhn_entitlements.repoll_virt_guest_entitlements
- -- *******************************************************************
- function channel_family_current_members(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- return number
- is
- current_members_count number := 0;
- begin
- select count(sc.server_id)
- into current_members_count
- from rhnChannelFamilyMembers cfm,
- rhnServerChannel sc,
- rhnServer s
- where s.org_id = org_id_in
- and s.id = sc.server_id
- and cfm.channel_family_id = channel_family_id_in
- and cfm.channel_id = sc.channel_id
- and exists (
- select 1
- from rhnChannelFamilyServerPhysical cfsp
- where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
- and cfsp.server_id = s.id
- );
-
- return current_members_count;
- end;
-
- PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
- org_id_in IN NUMBER)
- IS
- BEGIN
- update rhnPrivateChannelFamily
- set current_members = (
- channel_family_current_members(channel_family_id_in, org_id_in)
- )
- where org_id = org_id_in
- and channel_family_id = channel_family_id_in;
- END update_family_counts;
-
- FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
- org_id_in IN NUMBER)
- RETURN NUMBER
- IS
- channel_family_id_val NUMBER;
- BEGIN
- SELECT channel_family_id INTO channel_family_id_val
- FROM rhnChannelFamilyMembers
- WHERE channel_id = channel_id_in;
-
- RETURN rhn_channel.available_family_subscriptions(
- channel_family_id_val, org_id_in);
- END available_chan_subscriptions;
-
- -- *******************************************************************
- -- PROCEDURE: entitle_customer
- -- Creates a chan fam bucket, or sets max_members for an existing bucket
- -- Called by: rhn_ep.poll_customer_internal
- -- Calls: set_family_maxmembers + update_family_counts if the row
- -- already exists, else it creates it in rhnPrivateChannelFamily.
- -- *******************************************************************
- procedure entitle_customer(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor permissions is
- select 1
- from rhnPrivateChannelFamily pcf
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- begin
- for perm in permissions loop
- set_family_maxmembers(
- customer_id_in,
- channel_family_id_in,
- quantity_in
- );
- rhn_channel.update_family_counts(
- channel_family_id_in,
- customer_id_in
- );
- return;
- end loop;
-
- insert into rhnPrivateChannelFamily pcf (
- channel_family_id, org_id, max_members, current_members
- ) values (
- channel_family_id_in, customer_id_in, quantity_in, 0
- );
- end;
-
- -- *******************************************************************
- -- PROCEDURE: set_family_maxmembers
- -- Prunes an existing channel family bucket by unsubscribing the
- -- necessary servers and sets max_members.
- -- Called by: rhn_channel.entitle_customer
- -- Calls: unsubscribe_server_from_family
- -- *******************************************************************
- procedure set_family_maxmembers(customer_id_in in number,
- channel_family_id_in in number,
- quantity_in in number)
- is
- cursor servers is
- select server_id from (
- select rownum row_number, server_id, modified from (
- select rcfsp.server_id,
- rcfsp.modified
- from rhnChannelFamilyServerPhysical rcfsp
- where rcfsp.customer_id = customer_id_in
- and rcfsp.channel_family_id = channel_family_id_in
- order by modified
- )
- where rownum > quantity_in
- );
- begin
- -- prune subscribed servers
- for server in servers loop
- rhn_channel.unsubscribe_server_from_family(server.server_id,
- channel_family_id_in);
- end loop;
-
- update rhnPrivateChannelFamily pcf
- set pcf.max_members = quantity_in
- where pcf.org_id = customer_id_in
- and pcf.channel_family_id = channel_family_id_in;
- end;
-
- procedure unsubscribe_server_from_family(server_id_in in number,
- channel_family_id_in in number)
- is
- begin
- delete
- from rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and channel_id in (
- select rcfm.channel_id
- from rhnChannelFamilyMembers rcfm
- where rcfm.channel_family_id = channel_family_id_in);
- end;
-
- function get_org_id(channel_id_in in number)
- return number
- is
- org_id_out number;
- begin
- select org_id into org_id_out
- from rhnChannel
- where id = channel_id_in;
-
- return org_id_out;
- end get_org_id;
-
- function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
- return number
- is
- cursor families is
- select 1
- from rhnOrgChannelFamilyPermissions cfp
- where cfp.org_id = org_id_in;
- begin
- -- the idea: if we get past this query,
- -- the user has the role, else catch the exception and return 0
- for family in families loop
- return 1;
- end loop;
- return 0;
- end;
-
- function get_org_access(channel_id_in in number, org_id_in in number)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query,
- -- the org has access to the channel, else catch the exception and return 0
- select distinct 1 into throwaway
- from rhnChannelFamilyMembers CFM,
- rhnOrgChannelFamilyPermissions CFP
- where cfp.org_id = org_id_in
- and CFM.channel_family_id = CFP.channel_family_id
- and CFM.channel_id = channel_id_in
- and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if a user has a given role, or if such a role is inferrable
- function user_role_check_debug(channel_id_in in number,
- user_id_in in number,
- role_in in varchar2,
- reason_out out varchar2)
- return number
- is
- org_id number;
- begin
- org_id := rhn_user.get_org_id(user_id_in);
-
- -- channel might be shared
- if role_in = 'subscribe' and
- rhn_channel.shared_user_role_check(channel_id_in, user_id_in, role_in) = 1 then
- return 1;
- end if;
-
- if role_in = 'manage' and
- NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
- reason_out := 'channel_not_owned';
- return 0;
- end if;
-
- if role_in = 'subscribe' and
- rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
- reason_out := 'channel_not_available';
- return 0;
- end if;
-
- -- channel admins have all roles
- if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
- reason_out := 'channel_admin';
- return 1;
- end if;
-
- -- the subscribe permission is inferred
- -- UNLESS the not_globally_subscribable flag is set
- if role_in = 'subscribe'
- then
- if rhn_channel.org_channel_setting(channel_id_in,
- org_id,
- 'not_globally_subscribable') = 0 then
- reason_out := 'globally_subscribable';
- return 1;
- end if;
- end if;
-
- -- all other roles (manage right now) are explicitly granted
- reason_out := 'direct_permission';
- return rhn_channel.direct_user_role_check(channel_id_in,
- user_id_in, role_in);
- end;
-
- -- same as above, but with no OUT param; useful in views, etc
- function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway varchar2(256);
- begin
- return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
- end;
-
- --
- -- For multiorg phase II, this function simply checks to see if the user's
- -- has a trust relationship that includes this channel by id.
- --
- function shared_user_role_check(channel_id in number, user_id in number, role in varchar2)
- return number
- is
- n number;
- oid number;
- begin
- oid := rhn_user.get_org_id(user_id);
- select 1 into n
- from rhnSharedChannelView s
- where s.id = channel_id and s.org_trust_id = oid;
- return 1;
- exception
- when no_data_found then
- return 0;
- end;
-
- -- same as above, but returns 1 if user_id_in is null
- -- This is useful in queries where user_id is not specified
- function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- begin
- if user_id_in is null then
- return 1;
- end if;
- return user_role_check(channel_id_in, user_id_in, role_in);
- end loose_user_role_check;
-
- -- directly checks the table, no inferred permissions
- function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
- select 1 into throwaway
- from rhnChannelPermissionRole CPR,
- rhnChannelPermission CP
- where CP.user_id = user_id_in
- and CP.channel_id = channel_id_in
- and CPR.label = role_in
- and CP.role_id = CPR.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- -- check if an org has a certain setting
- function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
- return number
- is
- throwaway number;
- begin
- -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
- select 1 into throwaway
- from rhnOrgChannelSettingsType OCST,
- rhnOrgChannelSettings OCS
- where OCS.org_id = org_id_in
- and OCS.channel_id = channel_id_in
- and OCST.label = setting_in
- and OCS.setting_id = OCST.id;
-
- return 1;
- exception
- when no_data_found
- then
- return 0;
- end;
-
- FUNCTION channel_priority(channel_id_in IN number)
- RETURN number
- IS
- channel_name varchar2(64);
- priority number;
- end_of_life_val date;
- org_id_val number;
- BEGIN
-
- select name, end_of_life, org_id
- into channel_name, end_of_life_val, org_id_val
- from rhnChannel
- where id = channel_id_in;
-
- if end_of_life_val is not null then
- return -400;
- end if;
-
- if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
- priority := 1000;
- if channel_name not like '%Beta%' then
- priority := priority + 1000;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 5%' then 600
- when channel_name like '%v. 4%' then 500
- when channel_name like '%v. 3%' then 400
- when channel_name like '%v. 2%' then 300
- when channel_name like '%v. 1%' then 200
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
- when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
- when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
- when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
- when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
- when channel_name like '%Extras%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%)' then 5
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
- elsif channel_name like 'Red Hat Desktop%' then
- priority := 900;
-
- if channel_name not like '%Beta%' then
- priority := priority + 50;
- end if;
-
- priority := priority +
- case
- when channel_name like '%v. 4%' then 40
- when channel_name like '%v. 3%' then 30
- when channel_name like '%v. 2%' then 20
- when channel_name like '%v. 1%' then 10
- else 0
- end;
-
- priority := priority +
- case
- when channel_name like '%32-bit x86%' then 4
- when channel_name like '%64-bit Intel Itanium%' then 3
- when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
- else 0
- end;
-
- elsif org_id_val is not null then
- priority := 600;
- else
- priority := 500;
- end if;
-
- return -priority;
-
- end channel_priority;
-
- -- right now this only does the accounting changes; the cascade
- -- actually does the rhnServerChannel delete.
- procedure delete_server_channels(server_id_in in number)
- is
- begin
- update rhnPrivateChannelFamily
- set current_members = current_members -1
- where org_id in (
- select org_id
- from rhnServer
- where id = server_id_in
- )
- and channel_family_id in (
- select rcfm.channel_family_id
- from rhnChannelFamilyMembers rcfm,
- rhnServerChannel rsc
- where rsc.server_id = server_id_in
- and rsc.channel_id = rcfm.channel_id
- and not exists (
- select 1
- from
- rhnChannelFamilyVirtSubLevel cfvsl,
- rhnSGTypeVirtSubLevel sgtvsl,
- rhnServerEntitlementView sev,
- rhnVirtualInstance vi
- where
- -- system is a virtual instance
- vi.virtual_system_id = server_id_in
- and vi.host_system_id = sev.server_id
- -- system's host has a virt ent
- and sev.label in ('virtualization_host',
- 'virtualization_host_platform')
- and sev.server_group_type_id =
- sgtvsl.server_group_type_id
- -- the host's virt ent grants a cf virt sub level
- and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
- -- the cf is in that virt sub level
- and cfvsl.channel_family_id = rcfm.channel_family_id
- )
- );
- end;
-
- -- this could certainly be optimized to do updates if needs be
- procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
- is
- begin
- delete from rhnChannelNewestPackage where channel_id = channel_id_in;
- insert into rhnChannelNewestPackage
- ( channel_id, name_id, evr_id, package_id, package_arch_id )
- ( select channel_id,
- name_id, evr_id,
- package_id, package_arch_id
- from rhnChannelNewestPackageView
- where channel_id = channel_id_in
- );
- insert into rhnChannelNewestPackageAudit (channel_id, caller)
- values (channel_id_in, caller_in);
- update rhnChannel
- set last_modified = greatest(sysdate, last_modified + 1/86400)
- where id = channel_id_in;
- end;
-
- procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
- date_to_use in date := sysdate )
- is
-
- channel_last_modified date;
- last_modified_value date;
-
- cursor snapshots is
- select snapshot_id id
- from rhnSnapshotChannel
- where channel_id = channel_id_in;
-
- begin
-
- select last_modified
- into channel_last_modified
- from rhnChannel
- where id = channel_id_in;
-
- last_modified_value := date_to_use;
-
- if last_modified_value <= channel_last_modified then
- last_modified_value := last_modified_value + 1/86400;
- end if;
-
- update rhnChannel set last_modified = last_modified_value
- where id = channel_id_in;
-
- if invalidate_ss = 1 then
- for snapshot in snapshots loop
- update rhnSnapshot
- set invalid = lookup_snapshot_invalid_reason('channel_modified')
- where id = snapshot.id;
- end loop;
- end if;
-
- end update_channel;
-
- procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelPackage
- where package_id = package_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we want to invalidate the snapshot assocated with the channel when we
- -- do this b/c we know we've added or removed or packages
- rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
- end loop;
- end update_channels_by_package;
-
-
- procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
- is
-
- cursor channels is
- select channel_id
- from rhnChannelErrata
- where errata_id = errata_id_in
- order by channel_id;
-
- begin
- for channel in channels loop
- -- we won't invalidate snapshots, b/c just changing the errata associated with
- -- a channel shouldn't invalidate snapshots
- rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
- end loop;
- end update_channels_by_errata;
-
-END rhn_channel;
-/
-SHOW ERRORS
-
---
--- Revision 1.75 2005/03/04 00:04:19 jslagle
--- bz #147617
--- Made Red Hat Desktop sort a little better.
---
--- Revision 1.74 2005/02/22 03:24:47 jslagle
--- bz #147617
--- Improve channel_priority function to order channels better.
---
--- Revision 1.73 2004/08/16 20:39:30 pjones
--- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
---
--- Revision 1.72 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
--- Revision 1.71 2004/04/13 16:28:36 bretm
--- bugzilla: 119871
---
--- keep track of rhnServer.channels_changed through the pl/sql fns
---
--- Revision 1.70 2004/03/26 18:11:32 rbb
--- Bugzilla: 114057
---
--- Add a script to determine channel priority.
---
--- Revision 1.69 2004/02/17 20:16:52 pjones
--- bugzilla: none -- add cvs tags into the package as long as we're touching
--- it anyway
---
--- Revision 1.68 2004/02/17 20:05:38 pjones
--- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
--- with arches incompatible with the target channel
---
--- Revision 1.67 2004/02/06 02:36:10 misa
--- Changed normalize_server_arch to allow for solaris arches
---
--- Revision 1.66 2003/11/13 16:58:34 cturner
--- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
---
--- Revision 1.65 2003/10/23 20:26:24 bretm
--- bugzilla: none
---
--- note the channel label when we unsubscribe, too
---
--- Revision 1.64 2003/10/15 14:47:17 bretm
--- bugzilla: none
---
--- add the channel label to the server history summary line when we log a channel change
---
--- Revision 1.63 2003/09/24 19:25:56 pjones
--- this wasn't the right fix, put it back
---
--- Revision 1.62 2003/09/24 17:42:19 pjones
--- bugzilla: none
---
--- limit our server base channel guess to channels with available permissions
---
--- Revision 1.61 2003/09/22 21:00:40 cturner
--- add method for easy acl check
---
--- Revision 1.60 2003/09/17 22:14:11 misa
--- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
---
--- Revision 1.59 2003/08/21 13:41:17 cturner
--- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
---
--- Revision 1.58 2003/07/24 16:46:22 cturner
--- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
---
--- Revision 1.57 2003/07/24 16:44:16 misa
--- bugzilla: none A function more usable on the rhnapp side
---
--- Revision 1.56 2003/07/23 22:36:51 cturner
--- argh, max returns null even when now rows; use distinct. how revolting
---
--- Revision 1.55 2003/07/23 22:01:31 cturner
--- oops, this one can return multiple rows; eliminate that in a lazy way
---
--- Revision 1.54 2003/07/23 21:59:19 cturner
--- rework how rhnUserChannel works; move to plsql for speed and maintenance
---
--- Revision 1.53 2003/07/21 17:49:12 pjones
--- bugzilla: none
---
--- add optional user for subscribe_server
---
--- Revision 1.52 2003/07/14 22:19:29 misa
--- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
---
--- Revision 1.51 2003/06/26 22:09:04 pjones
--- bugzilla: none
---
--- log subscribe and unsubscribe
---
--- Revision 1.50 2003/06/05 19:31:15 pjones
--- bugzilla: 88278 -- make the cursor name smaller
---
--- Revision 1.49 2003/06/05 19:18:21 pjones
--- bugzilla: 88278
---
--- unsubscribe_server() opens the package-level cursor when it invokes itself,
--- so we're using a local copy instead.
---
--- Revision 1.48 2003/06/04 16:41:39 pjones
--- bugzilla: none
---
--- make bulk_guess_server_base() silently ignore unguessables
---
--- Revision 1.47 2003/06/04 16:27:03 pjones
--- bugzilla: 88822
---
--- eliminate the last outliers that remove things from channels without using
--- unsubscribe_server, I think.
---
--- Revision 1.46 2003/06/03 20:49:37 pjones
--- bugzilla: 88822
--- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
--- for the server in question
---
--- Revision 1.45 2003/06/02 20:41:45 pjones
--- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
--- problem. Basicly, if you're out of the channel for any reason, you're
--- also out of rhnProxyInfo/rhnProxyInfo
---
--- Revision 1.44 2003/03/24 15:26:28 pjones
--- bugzilla: 85812
---
--- bulk_server_base_change silently ignores servers that are satellites
--- or proxies, as requested.
---
--- Revision 1.43 2003/02/26 20:28:17 pjones
--- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
--- the old codepath is:
---
--- ep ->
--- rhn_ep.entitlement_run_me() ->
--- rhn_ep.poll_customer() ->
--- rhn_channel.entitle_customer()
---
--- which doesn't change current_members, even though it may remove servers
--- from the family.
---
--- There's another bug here: currently, we don't try to order forced
--- unsubscribes in any way; we just use
--- rhn_channel.unsubscribe_server_from_family . If there are any child
--- channel subscriptions, this will leave them subscribed. We really need
--- to iterate across the channels again, and subscribe any channel for which
--- there are no parent channel subscriptions.
---
--- Ugh.
---
--- Revision 1.42 2003/01/28 00:19:45 pjones
--- fix clear_subscriptions; AFAICT, this is only hit on the
--- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
--- it infrequent enough that it could be our "bad count" culprit.
---
--- Revision 1.41 2003/01/14 19:51:45 pjones
--- make setting current_members on rhnChannelFamilyPermissions work when
--- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/123-rhnServerActionVerify-chg-indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/123-rhnServerActionVerify-chg-indexes.sql
deleted file mode 100644
index ef5efc2..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/123-rhnServerActionVerify-chg-indexes.sql
+++ /dev/null
@@ -1,42 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-drop index rhn_sactionvm_sanec_uq;
-create unique index rhn_sactionvm_sanec_uq
- on rhnServerActionVerifyMissing(
- server_id, action_id,
- package_name_id, package_evr_id, package_arch_id,
- package_capability_id )
- tablespace [[4m_tbs]]
- storage ( freelists 16 )
- initrans 32;
-
-drop index rhn_sactionvr_sanec_uq;
-create unique index rhn_sactionvr_sanec_uq
- on rhnServerActionVerifyResult(
- server_id, action_id,
- package_name_id, package_evr_id, package_arch_id,
- package_capability_id )
- tablespace [[4m_tbs]]
- storage ( freelists 16 )
- initrans 32;
-
--- $Log$
--- Revision 1 2008/11/03
--- bugzilla: 456539 -- adding package_arch_id to indexes
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/130-delete_server.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/130-delete_server.sql
deleted file mode 100644
index 2f86807..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/130-delete_server.sql
+++ /dev/null
@@ -1,268 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
--- This deletes a server. All codepaths which delete servers should hit this
--- or delete_server_bulk()
-
-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 rhnChannelFamilyLicenseConsent 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 rhnSNPServerQueue where server_id = server_id_in;
- delete from rhnSatelliteChannelFamily 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 rhnServerMessage where server_id = server_id_in;
- -- this gets rhnServerMessage (only) on cascade; it's handled just above
- 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 rhnServerNeededPackageCache where server_id = server_id_in;
- delete from rhnServerNeededErrataCache 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 rhnTransaction 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 rhn_interface_monitoring 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);
- 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;
-
- -- 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;
-
---
--- Revision 1.25 2004/11/01 17:53:03 pjones
--- bugzilla: 136124 -- Fix the "no data found" when deleting rhn_sat_cluster
---
---
---
---
--- This deletes a list of server.
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/131-delete_server_bulk.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/131-delete_server_bulk.sql
deleted file mode 100644
index 0b96a0d..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/131-delete_server_bulk.sql
+++ /dev/null
@@ -1,40 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- Revision 1.25 2004/11/01 17:53:03 pjones
--- bugzilla: 136124 -- Fix the "no data found" when deleting rhn_sat_cluster
---
---
---
---
--- This deletes a list of server.
---
-
-create or replace
-procedure delete_server_bulk (
- user_id_in in number
-) is
- cursor systems is
- select s.element id
- from rhnSet s
- where s.user_id = user_id_in
- and s.label = 'system_list';
-begin
- for s in systems loop
- delete_server(s.id);
- end loop;
-end delete_server_bulk;
-/
-show errors;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/132-rhnActionKickstartGuest-add-kshost.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/132-rhnActionKickstartGuest-add-kshost.sql
deleted file mode 100644
index 3bc6b1e..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/132-rhnActionKickstartGuest-add-kshost.sql
+++ /dev/null
@@ -1,35 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnActionKickstartGuest
- ADD kickstart_host varchar2(256);
-
-ALTER TABLE rhnActionKickstartGuest
- ADD disk_path varchar2(256);
-
-ALTER TABLE rhnActionKickstartGuest
- ADD virt_bridge varchar2(256);
-
-ALTER TABLE rhnActionKickstartGuest
- ADD cobbler_system_name varchar2(256);
-
-show errors
-
--- $Log$
--- Revision 1 2008/10/29 7:01:05 mmccune
--- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/133-rhnKickstartVirtualizationType-update.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/133-rhnKickstartVirtualizationType-update.sql
deleted file mode 100644
index 23fbe2e..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/133-rhnKickstartVirtualizationType-update.sql
+++ /dev/null
@@ -1,43 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-update rhnKickstartVirtualizationType
- set label = 'xenpv' where label = 'para_guest';
-
-update rhnKickstartVirtualizationType
- set label = 'auto' where label = 'none';
-
-update rhnKickstartVirtualizationType
- set name = 'Auto' where label = 'auto';
-
-update rhnKickstartVirtualizationType
- set name = 'XEN Para-Virtualized Guest' where label = 'xenpv';
-
-insert into rhnKickstartVirtualizationType (id, name, label)
- values (rhn_kvt_id_seq.nextval, 'KVM Virtualized Guest', 'qemu');
-
-insert into rhnKickstartVirtualizationType (id, name, label)
- values (rhn_kvt_id_seq.nextval, 'XEN Fully-Virtualized Guest', 'xenfv');
-
-commit;
-
-show errors
-
--- $Log$
--- Revision 1 2008/10/29 7:01:05 mmccune
--- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/135-rhn_config_macro_data.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/135-rhn_config_macro_data.sql
deleted file mode 100644
index af2da9d..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/135-rhn_config_macro_data.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-
-update rhn_config_macro set definition='/usr/bin' where name='NPBIN';
-update rhn_config_macro set definition='/etc/nocpulse' where name='NPETC';
-update rhn_config_macro set definition='/var/lib/%{USER}' where name='NPHOME';
-update rhn_config_macro set definition='/var/log/%{USER}' where name='NPVAR';
-
-insert into rhn_config_macro(environment,name,definition,description,editable,last_update_user,last_update_date) values ( 'ALL', 'NPLIB', '/var/lib/%{USER}', 'Production user data directory', '0', 'system',sysdate);
-
-commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/136-rhn_config_parameter_data.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/136-rhn_config_parameter_data.sql
deleted file mode 100644
index 7ff1df2..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/136-rhn_config_parameter_data.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-update rhn_config_parameter set value='/var/lib/notification/queue/ack_queue' where name='ack_queue_dir';
-update rhn_config_parameter set value='/var/lib/notification/queue/alert_queue' where name='alert_queue_dir';
-
-update rhn_config_parameter set value='/etc/notification' where group_name='notification' and name='config_dir';
-
-
-update rhn_config_parameter set value='%{NPLIB}/trapReceiver/config' where group_name='trapReceiver' and name='config';
-update rhn_config_parameter set value='%{NPLIB}/trapReceiver/mibs' where group_name='trapReceiver' and name='cust_mibdir';
-update rhn_config_parameter set value='%{NPLIB}/trapReceiver/traps' where group_name='trapReceiver' and name='trapdir';
-update rhn_config_parameter set value='%{NPLIB}/ProbeState' where group_name='ProbeFramework' and name='databaseDirectory';
-update rhn_config_parameter set value='%{NPLIB}/.gripes.gdbm' where group_name='queues' and name='gritchdb';
-update rhn_config_parameter set value='%{NPLIB}/queue' where group_name='queues' and name='queuedir';
-update rhn_config_parameter set value='%{NPLIB}/queue/snmp/LAST_SENT' where group_name='queues' and name='snmplast';
-update rhn_config_parameter set value='%{NPLIB}/commands/.gripes.gdbm' where group_name='CommandQueue' and name='gritchdb';
-update rhn_config_parameter set value='%{NPLIB}/commands/heartbeat' where group_name='CommandQueue' and name='heartbeatFile';
-update rhn_config_parameter set value='%{NPLIB}/commands/last_completed' where group_name='CommandQueue' and name='lastCompletedFile';
-update rhn_config_parameter set value='%{NPLIB}/commands/last_started' where group_name='CommandQueue' and name='lastStartedFile';
-update rhn_config_parameter set value='%{NPLIB}/last_state_push' where group_name='current_state' and name='last_success';
-update rhn_config_parameter set value='%{NPLIB}/events.frozen' where group_name='satellite' and name='eventsFile';
-update rhn_config_parameter set value='%{NPLIB}/.gripes-probe-code.gdbm' where group_name='satellite' and name='gritchdb';
-update rhn_config_parameter set value='%{NPLIB}/scheduler.xml' where group_name='satellite' and name='schedulerConfigFile';
-update rhn_config_parameter set value='%{NPLIB}/reload.please' where group_name='satellite' and name='schedulerReloadFlagFile';
-update rhn_config_parameter set value='%{NPLIB}/commands/execute_commands.log' where group_name='CommandQueue' and name='exelog';
-
-commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/137-rhnKickstartableTree.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/137-rhnKickstartableTree.sql
deleted file mode 100644
index d28dc68..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/137-rhnKickstartableTree.sql
+++ /dev/null
@@ -1,32 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
-
-ALTER TABLE rhnKickstartableTree
-ADD cobbler_id varchar2(64);
-
-ALTER TABLE rhnKickstartableTree
-ADD cobbler_xen_id varchar2(64);
-
-show errors
-
--- $Log$
--- Revision 1 2008/12/02 16:51 jsherrill
--- Add cobbler_id column
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/138-rhnRegTokenPackages.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/138-rhnRegTokenPackages.sql
deleted file mode 100644
index 3197cb3..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/138-rhnRegTokenPackages.sql
+++ /dev/null
@@ -1,48 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
-ALTER TABLE rhnRegTokenPackages ADD id number;
-
-CREATE SEQUENCE rhn_reg_tok_pkg_id_seq;
-
-UPDATE rhnRegTokenPackages SET id = rhn_reg_tok_pkg_id_seq.nextval;
-
-ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_id_nn CHECK ("ID" IS NOT NULL);
-
-ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_id_pk primary key ( id );
-
-ALTER TABLE rhnRegTokenPackages ADD (arch_id number);
-
-ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_aid_fk FOREIGN KEY (arch_id) REFERENCES rhnPackageArch (id) ON DELETE CASCADE;
-
-DROP index rhn_reg_tok_pkg_uq;
-
-create unique index rhn_reg_tok_pkg_uq
- on rhnRegTokenPackages(id, token_id, name_id, arch_id)
- tablespace [[4m_tbs]]
- storage( freelists 16 )
- initrans 32;
-
-
-show errors
-
--- $Log$
--- Revision 1 2008/12/04 10:44 pkilambi
--- Arch support for activation key based package installs
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/139-rhnKickstartableTrees.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/139-rhnKickstartableTrees.sql
deleted file mode 100644
index c5ec44c..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/139-rhnKickstartableTrees.sql
+++ /dev/null
@@ -1,28 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-update rhnKickstartableTree set boot_image='spacewalk-koan';
-
-ALTER TABLE rhnKickstartableTree
- MODIFY( boot_image varchar2(128) default('spacewalk-koan'));
-
-show errors
--- $Log$
--- Revision 1 2008/12/04 6:38 pkilambi
--- Added support to create boot image...
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/140-rhnActionKickstart-drop-kstree_id.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/140-rhnActionKickstart-drop-kstree_id.sql
deleted file mode 100644
index 30fdc67..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/140-rhnActionKickstart-drop-kstree_id.sql
+++ /dev/null
@@ -1,28 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnActionKickstart
-DROP COLUMN kstree_id;
-
-
-show errors
-
--- $Log$
---
--- Revision 1 2008/12/05 6:56:45 paji
--- Removed the unused kstree_id column
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql
deleted file mode 100644
index 8364d46..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql
+++ /dev/null
@@ -1,28 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnActionKickstartGuest
-DROP COLUMN kstree_id;
-
-
-show errors
-
--- $Log$
---
--- Revision 1 2008/12/05 6:56:45 paji
--- Removed the unused kstree_id column
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/142-rhnSet-add-element3.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/142-rhnSet-add-element3.sql
deleted file mode 100644
index f498b78..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/142-rhnSet-add-element3.sql
+++ /dev/null
@@ -1,26 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-alter table rhnSet add element_three NUMBER;
-alter table rhnSet drop constraint rhn_set_user_label_elem_unq drop index;
-alter table rhnSet add constraint rhn_set_user_label_elem_unq
- unique(user_id, label, element, element_two, element_three);
-
-
--- $Log$
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/143-rhnServerProfilePackage-add-arch.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/143-rhnServerProfilePackage-add-arch.sql
deleted file mode 100644
index ceff184..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/143-rhnServerProfilePackage-add-arch.sql
+++ /dev/null
@@ -1,23 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-alter table rhnServerProfilePackage
-add package_arch_id number
- constraint rhn_sprofile_package_fk
- references rhnPackageArch(id);
-
-show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/144-rhnSharedChannelTreeView.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/144-rhnSharedChannelTreeView.sql
deleted file mode 100644
index 12ff3aa..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/144-rhnSharedChannelTreeView.sql
+++ /dev/null
@@ -1,66 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-CREATE OR REPLACE VIEW RHNSHAREDCHANNELTREEVIEW
-(
- ORG_ID,
- ID,
- DEPTH,
- NAME,
- PADDED_NAME,
- CHANNEL_ARCH_ID,
- LAST_MODIFIED,
- LABEL,
- PARENT_OR_SELF_LABEL,
- PARENT_OR_SELF_ID,
- END_OF_LIFE
-)
-AS
-SELECT * FROM (
- SELECT
- C.ORG_TRUST_ID AS ORG_ID,
- C.ID,
- 1 AS DEPTH,
- C.NAME,
- ' '||C.NAME AS PADDED_NAME,
- C.CHANNEL_ARCH_ID,
- C.LAST_MODIFIED,
- C.LABEL,
- C.LABEL AS PARENT_OR_SELF_LABEL,
- C.ID AS PARENT_OR_SELF_ID,
- C.END_OF_LIFE
- FROM RHNSHAREDCHANNELVIEW C
- WHERE C.PARENT_CHANNEL IS NULL
- UNION
- SELECT
- C.ORG_TRUST_ID AS ORG_ID,
- C.ID,
- 2 AS DEPTH,
- c.name,
- ''||C.NAME AS PADDED_NAME,
- C.CHANNEL_ARCH_ID,
- C.LAST_MODIFIED,
- C.LABEL,
- C.LABEL AS PARENT_OR_SELF_LABEL,
- C.ID AS PARENT_OR_SELF_ID,
- C.END_OF_LIFE
- FROM RHNSHAREDCHANNELVIEW PC,
- RHNSHAREDCHANNELVIEW C
- WHERE C.PARENT_CHANNEL = PC.ID
-) ORDER BY PARENT_OR_SELF_LABEL, PARENT_OR_SELF_ID;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/145-rhnAvailableChannels.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/145-rhnAvailableChannels.sql
deleted file mode 100644
index bc1d6b0..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/145-rhnAvailableChannels.sql
+++ /dev/null
@@ -1,85 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
--- tricky view. it explodes to a full cartesian product when
--- not queried via org_id, so DO NOT DO THAT :)
-
-create or replace view
-rhnAvailableChannels
-(
- org_id,
- channel_id,
- channel_depth,
- channel_name,
- channel_arch_id,
- padded_name,
- current_members,
- available_members,
- last_modified,
- channel_label,
- parent_or_self_label,
- parent_or_self_id
-)
-as
-SELECT
- CT.org_id,
- CT.id,
- CT.depth,
- CT.name,
- CT.channel_arch_id,
- CT.padded_name,
- (SELECT COUNT(1)
- FROM rhnServer S
- INNER JOIN rhnServerChannel SC
- ON SC.server_id = S.id
- WHERE SC.channel_id = CT.id AND
- S.org_id = CT.org_id),
- rhn_channel.available_chan_subscriptions(CT.id, CT.org_id),
- CT.last_modified,
- CT.label,
- CT.parent_or_self_label,
- CT.parent_or_self_id
-FROM
- rhnOrgChannelTreeView CT
-UNION
-SELECT
- CT.org_id,
- CT.id,
- CT.depth,
- CT.name,
- CT.channel_arch_id,
- CT.padded_name,
- (SELECT COUNT(1)
- FROM rhnServer S
- INNER JOIN rhnServerChannel SC
- ON SC.server_id = S.id
- WHERE SC.channel_id = CT.id AND
- S.org_id = CT.org_id),
- NULL,
- CT.last_modified,
- CT.label,
- CT.parent_or_self_label,
- CT.parent_or_self_id
-FROM
- rhnSharedChannelTreeView CT
-/
-
---
---
--- Revision 1.17 2004/04/14 00:09:24 pjones
--- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
--- a frequent full table scan
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/146-rhnKSData-add-type.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/146-rhnKSData-add-type.sql
deleted file mode 100644
index 6691a35..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/146-rhnKSData-add-type.sql
+++ /dev/null
@@ -1,37 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnKsData
-ADD ks_type varchar(8);
-
-UPDATE rhnKsData SET ks_type = 'wizard';
-
-ALTER TABLE rhnKsData
-MODIFY ks_type CONSTRAINT rhn_ks_type_nn NOT NULL;
-
-ALTER TABLE rhnKsData
-ADD CONSTRAINT rhn_ks_type_ck CHECK (ks_type in ('wizard', 'raw'));
-
-show errors
-
--- $Log$
--- Revision 2 2008/12/02 16:51:05.2 jsherrill
--- Add cobbler_id column
---
--- Revision 1 2008/10/01 7:01:05 mmccune
--- Removed the unused name column
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/150-rhn_org.pkb.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/150-rhn_org.pkb.sql
deleted file mode 100644
index 9ff624f..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/150-rhn_org.pkb.sql
+++ /dev/null
@@ -1,321 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_org
-IS
- body_version varchar2(100) := '';
-
- FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
- RETURN NUMBER
- IS
- server_group server_group_by_label%ROWTYPE;
- BEGIN
- OPEN server_group_by_label(org_id_in, group_label_in);
- FETCH server_group_by_label INTO server_group;
- CLOSE server_group_by_label;
-
- RETURN server_group.id;
- END find_server_group_by_type;
-
- procedure delete_org (
- org_id_in in number
- )
- is
-
- cursor users is
- select id
- from web_contact
- where org_id = org_id_in;
-
- cursor servers(org_id_in in number) is
- select id
- from rhnServer
- where org_id = org_id_in;
-
- cursor config_channels is
- select id
- from rhnConfigChannel
- where org_id = org_id_in;
-
- begin
-
- if org_id_in = 1 then
- rhn_exception.raise_exception('cannot_delete_base_org');
- end if;
-
- -- Delete all users.
- for u in users loop
- rhn_org.delete_user(u.id, 1);
- end loop;
-
- -- Delete all servers.
- for s in servers(org_id_in) loop
- delete_server(s.id);
- end loop;
-
- -- Delete all config channels.
- for c in config_channels loop
- rhn_config.delete_channel(c.id);
- end loop;
-
- -- Give the org's entitlements back to the main org.
- rhn_entitlements.remove_org_entitlements(org_id_in);
-
- -- Clean up tables where we don't have a cascading delete.
- delete from rhnChannel where org_id = org_id_in;
- delete from rhnDailySummaryQueue where org_id = org_id_in;
- delete from rhnOrgQuota where org_id = org_id_in;
- delete from rhnOrgInfo where org_id = org_id_in;
- delete from rhnFileList where org_id = org_id_in;
- delete from rhnServerGroup where org_id = org_id_in;
- delete from rhn_check_suites where customer_id = org_id_in;
- delete from rhn_command_target where customer_id = org_id_in;
- delete from rhn_contact_groups where customer_id = org_id_in;
- delete from rhn_notification_formats where customer_id = org_id_in;
- delete from rhn_probe where customer_id = org_id_in;
- delete from rhn_redirects where customer_id = org_id_in;
- delete from rhn_sat_cluster where customer_id = org_id_in;
- delete from rhn_schedules where customer_id = org_id_in;
-
- -- Delete the org.
- delete from web_customer where id = org_id_in;
-
- end delete_org;
-
- procedure delete_user(user_id_in in number, deleting_org in number := 0) is
- cursor is_admin is
- select 1
- from rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin';
- cursor servergroups_needing_admins is
- select usgp.server_group_id server_group_id
- from rhnUserServerGroupPerms usgp
- where 1=1
- and usgp.user_id = user_id_in
- and not exists (
- select 1
- from rhnUserServerGroupPerms sq_usgp
- where 1=1
- and sq_usgp.server_group_id = usgp.server_group_id
- and sq_usgp.user_id != user_id_in
- );
- cursor messages is
- select message_id id
- from rhnUserMessage
- where user_id = user_id_in;
- users number;
- our_org_id number;
- other_users number;
- other_org_admin number;
- other_user_id number;
- begin
- select wc.org_id
- into our_org_id
- from web_contact wc
- where id = user_id_in;
-
- -- find any other users
- begin
- select id, 1
- into other_user_id, other_users
- from web_contact
- where 1=1
- and org_id = our_org_id
- and id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- other_users := 0;
- end;
-
- -- now do org admin stuff
- if other_users != 0 then
- for ignore in is_admin loop
- begin
- select new_ugm.user_id
- into other_org_admin
- from rhnUserGroupMembers new_ugm,
- rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin'
- and ug.id = new_ugm.user_group_id
- and new_ugm.user_id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- -- If we're deleting the org, we don't want to raise
- -- the exception.
- if deleting_org = 0 then
- rhn_exception.raise_exception('cannot_delete_user');
- end if;
- end;
-
- for sg in servergroups_needing_admins loop
- rhn_user.add_servergroup_perm(other_org_admin,
- sg.server_group_id);
- end loop;
- end loop;
- end if;
-
- -- and now things for every user
- for message in messages loop
- delete
- from rhnUserMessage
- where user_id = user_id_in
- and message_id = message.id;
- begin
- select 1
- into users
- from rhnUserMessage
- where message_id = message.id
- and rownum = 1;
- delete
- from rhnMessage
- where id = message.id;
- exception
- when no_data_found then
- null;
- end;
- end loop;
- delete from rhn_command_queue_sessions where contact_id = user_id_in;
- delete from rhn_contact_groups
- where recid in (
- select contact_group_id
- from rhn_contact_group_members
- where member_contact_method_id in (
- select recid from rhn_contact_methods
- where contact_id = user_id_in
- )
- )
- and not exists (
- select 1
- from rhn_contact_group_members, rhn_contact_methods
- where rhn_contact_groups.recid = rhn_contact_group_members.contact_group_id
- and rhn_contact_group_members.member_contact_method_id = rhn_contact_methods.recid
- and rhn_contact_methods.contact_id <> user_id_in
- );
- delete from rhn_contact_methods where contact_id = user_id_in;
- delete from rhn_redirects where contact_id = user_id_in;
- delete from rhnUserServerPerms where user_id = user_id_in;
- delete from rhnAppInstallSession where user_id = user_id_in;
- if other_users != 0 then
- update rhnRegToken
- set user_id = nvl(other_org_admin, other_user_id)
- where org_id = our_org_id
- and user_id = user_id_in;
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- -- Just Delete the user
- else
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- end if;
- return;
- end delete_user;
-
-END rhn_org;
-/
-SHOW ERRORS
-
---
--- Revision 1.22 2004/10/29 04:50:49 pjones
--- bugzilla: 135179 -- fix org admin swapping during user deletion
---
--- Revision 1.21 2004/07/13 22:46:04 pjones
--- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
---
--- Revision 1.20 2004/07/02 22:24:38 pjones
--- bugzilla: none -- typo fix
---
--- Revision 1.19 2004/07/02 19:19:02 pjones
--- bugzilla: 125937 -- use rhn_user to grant roles to users
---
--- Revision 1.18 2004/05/28 22:21:36 pjones
--- bugzilla: none -- update for monitoring schema
---
--- Revision 1.17 2004/04/05 16:31:07 pjones
--- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
--- has a cascade problem
---
--- Revision 1.16 2004/03/15 17:10:28 pjones
--- bugzilla: 118244 -- delete servers explicitly while deleting lone users
---
--- Revision 1.15 2004/02/09 17:14:54 pjones
--- bugzilla: none -- fix log garbage
---
--- Revision 1.14 2004/01/22 19:44:42 pjones
--- bugzilla: 106562 -- fix exceptions on delete_user()
---
--- Revision 1.13 2004/01/20 17:00:48 pjones
--- bugzilla: none -- try to make delete_user() succeed when there are
--- server groups that have been snapshotted
---
--- Revision 1.12 2004/01/14 20:22:03 pjones
--- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
---
--- Revision 1.11 2003/03/20 17:08:16 pjones
--- avoid the server group members trigger that updates last_modified; it'll
--- cause a mutating table error
---
--- Revision 1.10 2003/03/17 16:31:25 pjones
--- use "on delete set null" where applicable
---
--- Revision 1.9 2003/03/15 00:31:07 pjones
--- bugzilla: none
---
--- tested wrong table for perms on a server group
---
--- Revision 1.8 2003/03/15 00:23:36 pjones
--- bugzilla: 83631
---
--- working delete_user
---
--- Revision 1.7 2003/03/03 23:39:36 pjones
--- different delete_user; this one might actually work.
---
--- Takes about 18 seconds, which seems kindof slow, but isn't
--- intolerable I don't think...
---
--- Revision 1.6 2003/03/02 18:07:00 pjones
--- make it use marty's test instead of is_satellite(); in the sat env,
--- marty's test _is_ is_satellite()
---
--- Revision 1.5 2003/02/18 16:35:45 pjones
--- delete_user
---
--- Revision 1.4 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/151-rhnServer-add-cobbler_id.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/151-rhnServer-add-cobbler_id.sql
deleted file mode 100644
index 9cf7869..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/151-rhnServer-add-cobbler_id.sql
+++ /dev/null
@@ -1,29 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
-
-ALTER TABLE rhnServer
-ADD cobbler_id varchar(64);
-
-show errors
-
--- $Log$
--- Revision 1 2009/01/06 16:51 mmccune
--- Add cobbler_id column
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/152-rhnKSInstallType-add-generic.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/152-rhnKSInstallType-add-generic.sql
deleted file mode 100644
index 122afec..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/152-rhnKSInstallType-add-generic.sql
+++ /dev/null
@@ -1,39 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-insert into rhnKSInstallType (id, label, name)
- values (rhn_ksinstalltype_id_seq.nextval,
- 'fedora_8','Fedora 8'
- );
-
-insert into rhnKSInstallType (id, label, name)
- values (rhn_ksinstalltype_id_seq.nextval,
- 'fedora_10','Fedora 10'
- );
-
-insert into rhnKSInstallType (id, label, name)
- values (rhn_ksinstalltype_id_seq.nextval,
- 'generic_rpm','Generic RPM'
- );
-
-show errors
-
--- $Log$
--- Revision 1 2009/01/06 16:51 mmccune
--- Add cobbler_id column
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/153-rhnErrata-increase-advisory.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/153-rhnErrata-increase-advisory.sql
deleted file mode 100644
index 93b6ec2..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/153-rhnErrata-increase-advisory.sql
+++ /dev/null
@@ -1,20 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnErrata MODIFY advisory varchar2(37);
-show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/154-rhnErrataTmp-increase-advisory.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/154-rhnErrataTmp-increase-advisory.sql
deleted file mode 100644
index 45ee43f..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/154-rhnErrataTmp-increase-advisory.sql
+++ /dev/null
@@ -1,20 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnErrataTmp MODIFY advisory varchar2(37);
-show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/155-rhnPackageCapability-increase-name.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/155-rhnPackageCapability-increase-name.sql
deleted file mode 100644
index 683e09a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/155-rhnPackageCapability-increase-name.sql
+++ /dev/null
@@ -1,20 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-ALTER TABLE rhnPackageCapability MODIFY name varchar2(4000);
-show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/156-rhnPackage-compat-number.sql b/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/156-rhnPackage-compat-number.sql
deleted file mode 100644
index 3cdd093..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.3-spacewalk-0.4/156-rhnPackage-compat-number.sql
+++ /dev/null
@@ -1,23 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-alter TABLE rhnPackage add (compat_new number(1) default 0);
-update rhnPackage set compat_new = compat;
-alter TABLE rhnPackage drop column compat;
-alter TABLE rhnPackage rename column compat_new to compat;
-show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/100-errata-cache.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/100-errata-cache.sql
deleted file mode 100644
index e14f723..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/100-errata-cache.sql
+++ /dev/null
@@ -1,433 +0,0 @@
-
-
-drop index rhn_snec_eid_sid_idx;
-drop index rhn_snec_sid_eid_idx;
-drop index rhn_snec_oid_eid_sid_idx;
-drop table rhnServerNeededErrataCache;
-
-
-/* Remove org id, we don't need it */
-ALTER TABLE rhnServerNeededPackageCache DROP CONSTRAINT rhn_sncp_oid_nn;
-ALTER TABLE rhnServerNeededPackageCache DROP CONSTRAINT rhn_sncp_oid_fk;
-drop index rhn_snpc_oid_idx;
-alter table rhnServerNeededPackageCache drop column org_id;
-
-/* drop old indexes */
-drop index rhn_snpc_pid_idx;
-drop index rhn_snpc_sid_idx;
-drop index rhn_snpc_eid_idx;
-
-
-/* rename table */
-alter table
- rhnServerNeededPackageCache
- rename to
- rhnServerNeededCache;
-
-
-/* create new indexes */
-create index rhn_snc_pid_idx
- on rhnServerNeededCache(package_id)
- parallel
- tablespace [[128m_tbs]]
- nologging;
-
-create index rhn_snc_sid_idx
- on rhnServerNeededCache(server_id)
- parallel
- tablespace [[128m_tbs]]
- nologging;
-
-create index rhn_snc_eid_idx
- on rhnServerNeededCache(errata_id)
- parallel
- tablespace [[128m_tbs]]
- nologging;
-
-
-create index rhn_snc_speid_idx
- on rhnServerNeededCache(server_id, package_id, errata_id)
- parallel
- tablespace [[128m_tbs]]
- nologging;
-
-
-
-create or replace view
-rhnServerNeededPackageCache
-(
- server_id,
- package_id,
- errata_id
-)
-as
-select
- server_id,
- package_id,
- max(errata_id) as errata_id
- from rhnServerNeededCache
- group by server_id, package_id;
-
-
-create or replace view
-rhnServerNeededErrataCache
-(
- server_id,
- errata_id
-)
-as
-select
- distinct server_id, errata_id
- from rhnServerNeededCache;
-
-
-CREATE OR REPLACE VIEW
-rhnServerNeededView
-(
- org_id,
- server_id,
- errata_id,
- package_id,
- package_name_id
-)
-AS
-SELECT distinct S.org_id,
- S.id,
- PE.errata_id,
- P.id,
- P.name_id
-FROM
- rhnPackage P,
- rhnServerPackageArchCompat SPAC,
- rhnPackageEVR P_EVR,
- rhnPackageEVR SP_EVR,
- rhnServerPackage SP,
- rhnChannelPackage CP,
- rhnServerChannel SC,
- rhnServer S,
- rhnErrataPackage PE,
- rhnChannelErrata EC
-WHERE
- SC.server_id = S.id
- AND SC.channel_id = CP.channel_id
- AND CP.package_id = P.id
- AND P.id = PE.package_id
- AND PE.errata_id = EC.errata_id
- AND EC.channel_id = SC.channel_id
- AND p.package_arch_id = spac.package_arch_id
- AND spac.server_arch_id = s.server_arch_id
- AND SP_EVR.id = SP.evr_id
- AND P_EVR.id = P.evr_id
- AND SP.server_id = S.id
- AND SP.name_id = P.name_id
- AND SP.evr_id != P.evr_id
- AND SP_EVR.evr < P_EVR.evr
- AND SP_EVR.evr = (SELECT MAX(PE.evr) FROM rhnServerPackage SP2, rhnPackageEvr PE WHERE PE.id = SP2.evr_id AND SP2.server_id = SP.server_id AND SP2.name_id = SP.name_id)
- UNION
-SELECT distinct S.org_id,
- S.id,
- NULL as errata_id,
- P.id,
- P.name_id
-FROM
- rhnPackage P,
- rhnServerPackageArchCompat SPAC,
- rhnPackageEVR P_EVR,
- rhnPackageEVR SP_EVR,
- rhnServerPackage SP,
- rhnChannelPackage CP,
- rhnServerChannel SC,
- rhnServer S
-WHERE
- SC.server_id = S.id
- AND SC.channel_id = CP.channel_id
- AND CP.package_id = P.id
- AND P.id not in
- ( select EP.package_id
- from rhnErrataPackage EP inner join
- rhnChannelErrata EC on EP.errata_id = EC.errata_id
- where EC.channel_id = SC.channel_id)
- AND p.package_arch_id = spac.package_arch_id
- AND spac.server_arch_id = s.server_arch_id
- AND SP_EVR.id = SP.evr_id
- AND P_EVR.id = P.evr_id
- AND SP.server_id = S.id
- AND SP.name_id = P.name_id
- AND SP.evr_id != P.evr_id
- AND SP_EVR.evr < P_EVR.evr
- AND SP_EVR.evr = (SELECT MAX(PE.evr) FROM rhnServerPackage SP2, rhnPackageEvr PE WHERE PE.id = SP2.evr_id AND SP2.server_id = SP.server_id AND SP2.name_id = SP.name_id);
-
-
-
-CREATE OR REPLACE VIEW rhnServerErrataTypeView
-(
- server_id,
- errata_id,
- errata_type
-)
-AS
-SELECT
- SNEC.server_id,
- SNEC.errata_id,
- E.advisory_type
-FROM rhnErrata E,
- rhnServerNeededErrataCache SNEC
-WHERE E.id = SNEC.errata_id
-GROUP BY SNEC.server_id, SNEC.errata_id, E.advisory_type;
-
-
-CREATE OR REPLACE PROCEDURE
-queue_server(server_id_in IN NUMBER, immediate_in IN NUMBER := 1)
-IS
- org_id_tmp NUMBER;
-BEGIN
- IF immediate_in > 0
- THEN
- DELETE FROM rhnServerNeededCache WHERE server_id = server_id_in;
- INSERT INTO rhnServerNeededCache
- (SELECT server_id, errata_id, package_id
- FROM rhnServerNeededView
- WHERE server_id = server_id_in);
-
- ELSE
- SELECT org_id INTO org_id_tmp FROM rhnServer WHERE id = server_id_in;
-
- INSERT
- INTO rhnTaskQueue
- (org_id, task_name, task_data)
- VALUES (org_id_tmp,
- 'update_server_errata_cache',
- server_id_in);
- END IF;
-END queue_server;
-
-/
-
-create or replace procedure
-delete_errata (
- errata_id_in in number
-) is
-begin
- delete from rhnServerNeededCache where errata_id = errata_id_in;
- delete from rhnPaidErrataTempCache where errata_id = errata_id_in;
- delete from rhnErrataFile where errata_id = errata_id_in;
- delete from rhnErrataPackage where errata_id = errata_id_in;
- delete from rhnErrata where id = errata_id_in;
- delete from rhnErrataTmp where id = errata_id_in;
-end delete_errata;
-/
-
-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;
- 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);
- 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 rhnChannelFamilyLicenseConsent 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 rhnSNPServerQueue where server_id = server_id_in;
- delete from rhnSatelliteChannelFamily 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 rhnServerMessage where server_id = server_id_in;
- -- this gets rhnServerMessage (only) on cascade; it's handled just above
- 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 rhnTransaction 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 rhn_interface_monitoring 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);
- 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;
-
- -- 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;
-/
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/150-rhnMultiorg-sharing.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/150-rhnMultiorg-sharing.sql
deleted file mode 100644
index 11bb033..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/150-rhnMultiorg-sharing.sql
+++ /dev/null
@@ -1,88 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-ALTER TABLE rhnPackageChangeLog
- DROP constraint rhn_pkg_changelog_pid_fk;
-
-ALTER TABLE rhnPackageChangeLog
- ADD constraint rhn_pkg_changelog_pid_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnPackageFile
- DROP constraint rhn_package_file_pid_fk;
-
-ALTER TABLE rhnPackageFile
- ADD constraint rhn_package_file_pid_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnPackageObsoletes
- DROP constraint rhn_pkg_obsoletes_package_fk;
-
-ALTER TABLE rhnPackageObsoletes
- ADD constraint rhn_pkg_obsoletes_package_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnPackageConflicts
- DROP constraint rhn_pkg_conflicts_package_fk;
-
-ALTER TABLE rhnPackageConflicts
- ADD constraint rhn_pkg_conflicts_package_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnPackageProvides
- DROP constraint rhn_pkg_provides_package_fk;
-
-ALTER TABLE rhnPackageProvides
- ADD constraint rhn_pkg_provides_package_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnPackageRequires
- DROP constraint rhn_pkg_requires_package_fk;
-
-ALTER TABLE rhnPackageRequires
- ADD constraint rhn_pkg_requires_package_fk
- foreign key (package_id)
- references rhnPackage (id)
- on delete cascade;
-
-ALTER TABLE rhnSystemMigrations
- DROP constraint rhn_sys_mig_oidto_fk;
-
-ALTER TABLE rhnSystemMigrations
- ADD constraint rhn_sys_mig_oidto_fk
- foreign key (org_id_to)
- references web_customer (id)
- on delete set null;
-
-ALTER TABLE rhnSystemMigrations
- DROP constraint rhn_sys_mig_oidfrm_fk;
-
-ALTER TABLE rhnSystemMigrations
- ADD constraint rhn_sys_mig_oidfrm_fk
- foreign key (org_id_from)
- references web_customer (id)
- on delete set null;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/151-rhn_org.pkb.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/151-rhn_org.pkb.sql
deleted file mode 100644
index 93f6ec8..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/151-rhn_org.pkb.sql
+++ /dev/null
@@ -1,344 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
---
---
-
-CREATE OR REPLACE
-PACKAGE BODY rhn_org
-IS
- body_version varchar2(100) := '';
-
- FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
- RETURN NUMBER
- IS
- server_group server_group_by_label%ROWTYPE;
- BEGIN
- OPEN server_group_by_label(org_id_in, group_label_in);
- FETCH server_group_by_label INTO server_group;
- CLOSE server_group_by_label;
-
- RETURN server_group.id;
- END find_server_group_by_type;
-
- procedure delete_org (
- org_id_in in number
- )
- is
- cursor users is
- select id
- from web_contact
- where org_id = org_id_in;
-
- cursor servers(org_id_in in number) is
- select id
- from rhnServer
- where org_id = org_id_in;
-
- cursor config_channels is
- select id
- from rhnConfigChannel
- where org_id = org_id_in;
-
- cursor custom_channels is
- select id
- from rhnChannel
- where org_id = org_id_in;
-
- cursor errata is
- select id
- from rhnErrata
- where org_id = org_id_in;
-
- begin
-
- if org_id_in = 1 then
- rhn_exception.raise_exception('cannot_delete_base_org');
- end if;
-
- -- Delete all users.
- for u in users loop
- rhn_org.delete_user(u.id, 1);
- end loop;
-
- -- Delete all servers.
- for s in servers(org_id_in) loop
- delete_server(s.id);
- end loop;
-
- -- Delete all config channels.
- for c in config_channels loop
- rhn_config.delete_channel(c.id);
- end loop;
-
- -- Delete all custom channels.
- for cc in custom_channels loop
- delete from rhnServerChannel where channel_id = cc.id;
- delete from rhnServerProfilePackage where server_profile_id in (
- select id from rhnServerProfile where base_channel = cc.id
- );
- delete from rhnServerProfile where base_channel = cc.id;
- end loop;
-
- -- Delete all errata packages
- for e in errata loop
- delete from rhnErrataPackage where errata_id = e.id;
- end loop;
-
- -- Give the org's entitlements back to the main org.
- rhn_entitlements.remove_org_entitlements(org_id_in);
-
- -- Clean up tables where we don't have a cascading delete.
- delete from rhnChannel where org_id = org_id_in;
- delete from rhnDailySummaryQueue where org_id = org_id_in;
- delete from rhnOrgQuota where org_id = org_id_in;
- delete from rhnOrgInfo where org_id = org_id_in;
- delete from rhnFileList where org_id = org_id_in;
- delete from rhnServerGroup where org_id = org_id_in;
- delete from rhn_check_suites where customer_id = org_id_in;
- delete from rhn_command_target where customer_id = org_id_in;
- delete from rhn_contact_groups where customer_id = org_id_in;
- delete from rhn_notification_formats where customer_id = org_id_in;
- delete from rhn_probe where customer_id = org_id_in;
- delete from rhn_redirects where customer_id = org_id_in;
- delete from rhn_sat_cluster where customer_id = org_id_in;
- delete from rhn_schedules where customer_id = org_id_in;
-
- -- Delete the org.
- delete from web_customer where id = org_id_in;
-
- end delete_org;
-
- procedure delete_user(user_id_in in number, deleting_org in number := 0) is
- cursor is_admin is
- select 1
- from rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin';
- cursor servergroups_needing_admins is
- select usgp.server_group_id server_group_id
- from rhnUserServerGroupPerms usgp
- where 1=1
- and usgp.user_id = user_id_in
- and not exists (
- select 1
- from rhnUserServerGroupPerms sq_usgp
- where 1=1
- and sq_usgp.server_group_id = usgp.server_group_id
- and sq_usgp.user_id != user_id_in
- );
- cursor messages is
- select message_id id
- from rhnUserMessage
- where user_id = user_id_in;
- users number;
- our_org_id number;
- other_users number;
- other_org_admin number;
- other_user_id number;
- begin
- select wc.org_id
- into our_org_id
- from web_contact wc
- where id = user_id_in;
-
- -- find any other users
- begin
- select id, 1
- into other_user_id, other_users
- from web_contact
- where 1=1
- and org_id = our_org_id
- and id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- other_users := 0;
- end;
-
- -- now do org admin stuff
- if other_users != 0 then
- for ignore in is_admin loop
- begin
- select new_ugm.user_id
- into other_org_admin
- from rhnUserGroupMembers new_ugm,
- rhnUserGroupType ugt,
- rhnUserGroup ug,
- rhnUserGroupMembers ugm
- where ugm.user_id = user_id_in
- and ugm.user_group_id = ug.id
- and ug.group_type = ugt.id
- and ugt.label = 'org_admin'
- and ug.id = new_ugm.user_group_id
- and new_ugm.user_id != user_id_in
- and rownum = 1;
- exception
- when no_data_found then
- -- If we're deleting the org, we don't want to raise
- -- the exception.
- if deleting_org = 0 then
- rhn_exception.raise_exception('cannot_delete_user');
- end if;
- end;
-
- for sg in servergroups_needing_admins loop
- rhn_user.add_servergroup_perm(other_org_admin,
- sg.server_group_id);
- end loop;
- end loop;
- end if;
-
- -- and now things for every user
- for message in messages loop
- delete
- from rhnUserMessage
- where user_id = user_id_in
- and message_id = message.id;
- begin
- select 1
- into users
- from rhnUserMessage
- where message_id = message.id
- and rownum = 1;
- delete
- from rhnMessage
- where id = message.id;
- exception
- when no_data_found then
- null;
- end;
- end loop;
- delete from rhn_command_queue_sessions where contact_id = user_id_in;
- delete from rhn_contact_groups
- where recid in (
- select contact_group_id
- from rhn_contact_group_members
- where member_contact_method_id in (
- select recid from rhn_contact_methods
- where contact_id = user_id_in
- )
- )
- and not exists (
- select 1
- from rhn_contact_group_members, rhn_contact_methods
- where rhn_contact_groups.recid = rhn_contact_group_members.contact_group_id
- and rhn_contact_group_members.member_contact_method_id = rhn_contact_methods.recid
- and rhn_contact_methods.contact_id <> user_id_in
- );
- delete from rhn_contact_methods where contact_id = user_id_in;
- delete from rhn_redirects where contact_id = user_id_in;
- delete from rhnUserServerPerms where user_id = user_id_in;
- delete from rhnAppInstallSession where user_id = user_id_in;
- if other_users != 0 then
- update rhnRegToken
- set user_id = nvl(other_org_admin, other_user_id)
- where org_id = our_org_id
- and user_id = user_id_in;
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- -- Just Delete the user
- else
- begin
- delete from web_contact where id = user_id_in;
- exception
- when others then
- rhn_exception.raise_exception('cannot_delete_user');
- end;
- end if;
- return;
- end delete_user;
-
-END rhn_org;
-/
-SHOW ERRORS
-
---
--- Revision 1.22 2004/10/29 04:50:49 pjones
--- bugzilla: 135179 -- fix org admin swapping during user deletion
---
--- Revision 1.21 2004/07/13 22:46:04 pjones
--- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
---
--- Revision 1.20 2004/07/02 22:24:38 pjones
--- bugzilla: none -- typo fix
---
--- Revision 1.19 2004/07/02 19:19:02 pjones
--- bugzilla: 125937 -- use rhn_user to grant roles to users
---
--- Revision 1.18 2004/05/28 22:21:36 pjones
--- bugzilla: none -- update for monitoring schema
---
--- Revision 1.17 2004/04/05 16:31:07 pjones
--- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
--- has a cascade problem
---
--- Revision 1.16 2004/03/15 17:10:28 pjones
--- bugzilla: 118244 -- delete servers explicitly while deleting lone users
---
--- Revision 1.15 2004/02/09 17:14:54 pjones
--- bugzilla: none -- fix log garbage
---
--- Revision 1.14 2004/01/22 19:44:42 pjones
--- bugzilla: 106562 -- fix exceptions on delete_user()
---
--- Revision 1.13 2004/01/20 17:00:48 pjones
--- bugzilla: none -- try to make delete_user() succeed when there are
--- server groups that have been snapshotted
---
--- Revision 1.12 2004/01/14 20:22:03 pjones
--- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
---
--- Revision 1.11 2003/03/20 17:08:16 pjones
--- avoid the server group members trigger that updates last_modified; it'll
--- cause a mutating table error
---
--- Revision 1.10 2003/03/17 16:31:25 pjones
--- use "on delete set null" where applicable
---
--- Revision 1.9 2003/03/15 00:31:07 pjones
--- bugzilla: none
---
--- tested wrong table for perms on a server group
---
--- Revision 1.8 2003/03/15 00:23:36 pjones
--- bugzilla: 83631
---
--- working delete_user
---
--- Revision 1.7 2003/03/03 23:39:36 pjones
--- different delete_user; this one might actually work.
---
--- Takes about 18 seconds, which seems kindof slow, but isn't
--- intolerable I don't think...
---
--- Revision 1.6 2003/03/02 18:07:00 pjones
--- make it use marty's test instead of is_satellite(); in the sat env,
--- marty's test _is_ is_satellite()
---
--- Revision 1.5 2003/02/18 16:35:45 pjones
--- delete_user
---
--- Revision 1.4 2002/05/10 22:08:23 pjones
--- id/log
---
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/152-rhnSsmOperation.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/152-rhnSsmOperation.sql
deleted file mode 100644
index f72a8e8..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/152-rhnSsmOperation.sql
+++ /dev/null
@@ -1,50 +0,0 @@
-create table
-rhnSsmOperation
-(
- id number
- constraint rhn_ssmop_id_nn not null
- constraint rhn_ssmop_id_pk primary key
- using index tablespace [[4m_tbs]],
- user_id number
- constraint rhn_ssmop_user_nn not null
- constraint rhn_ssmop_user_fk
- references rhnUser(id)
- on delete cascade,
- description varchar2(256)
- constraint rhn_ssmop_desc_nn not null,
- status varchar2(32)
- constraint rhn_ssmop_st_nn not null,
- started date
- constraint rhn_ssmop_strt_nn not null,
- modified date default (sysdate)
- constraint rhn_ssmop_mod_nn not null
-)
-;
-
-
-create sequence rhn_ss_op_seq;
-
-create or replace trigger
-rhn_ssmop_mod_trig
-before insert or update on rhnSsmOperation
-for each row
-begin
- :new.modified := sysdate;
-end;
-/
-show errors
-
-create table
-rhnSsmOperationServer
-(
- operation_id number
- constraint rhn_ssmops_ssmop_fk
- references rhnSsmOperation(id)
- on delete cascade,
- server_id number
- constraint rhn_ssmops_ser_fk
- references rhnServer(id)
- on delete cascade
-)
-;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/153-rhnPackage-pathidx.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/153-rhnPackage-pathidx.sql
deleted file mode 100644
index 26b1c44..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/153-rhnPackage-pathidx.sql
+++ /dev/null
@@ -1,24 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
-CREATE INDEX rhn_package_path_idx
-ON rhnPackage(id, path);
-
-
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/160-rhnSourceRPM.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/160-rhnSourceRPM.sql
deleted file mode 100644
index daff06a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/160-rhnSourceRPM.sql
+++ /dev/null
@@ -1,13 +0,0 @@
---
--- Double the package name from
--- 128 -> 256 to resolve customer issue with custom
--- package names.
---
-
-ALTER TABLE rhnSourceRpm
-MODIFY
- name VARCHAR2(256);
-
-ALTER TABLE rhnPackageName
-MODIFY
- name VARCHAR2(256);
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/161-rhnKickstartVirtualizationType-update.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/161-rhnKickstartVirtualizationType-update.sql
deleted file mode 100644
index 5322ea9..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/161-rhnKickstartVirtualizationType-update.sql
+++ /dev/null
@@ -1,44 +0,0 @@
---
--- Copyright (c) 2008 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-
-
--- move all auto -> xenpv
-update rhnKickstartDefaults set virtualization_type =
- (select id from rhnkickstartvirtualizationtype
- where label = 'qemu')
-where virtualization_type = (select id from rhnkickstartvirtualizationtype
- where label = 'auto');
-
-update rhnKickstartSession set virtualization_type =
- (select id from rhnkickstartvirtualizationtype
- where label = 'qemu')
-where virtualization_type = (select id from rhnkickstartvirtualizationtype
- where label = 'auto');
-
-
-
-delete from rhnKickstartVirtualizationType
- where label = 'auto';
-
-commit;
-
-show errors
-
--- $Log$
--- Revision 1 2008/10/29 7:01:05 mmccune
--- add get rid of auto
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/162-rhnRepoRegenQueue.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/162-rhnRepoRegenQueue.sql
deleted file mode 100644
index f891c39..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/162-rhnRepoRegenQueue.sql
+++ /dev/null
@@ -1,29 +0,0 @@
-create table
-rhnRepoRegenQueue
-(
- id number
- constraint rhn_reporegenq_id_nn not null enable
- constraint rhn_reporegenq_id_pk primary key,
- channel_label varchar2(128)
- constraint rhn_reporegenq_chan_label_nn not null enable,
- client varchar2(128),
- reason varchar2(128),
- force char(1),
- bypass_filters char(1),
- next_action date default (sysdate),
- created date default (sysdate)
- constraint rhn_reporegenq_created_nn not null enable,
- modified date default (sysdate)
- constraint rhn_reporegenq_modified_nn not null enable
- );
-
-create sequence rhn_repo_regen_queue_id_seq start with 101;
-
-create or replace trigger rhn_repo_regen_queue_mod_trig
-before insert or update on rhnRepoRegenQueue
-for each row
-begin
- :new.modified := sysdate;
-end;
-/
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/163-rhn_config_parameter_data.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/163-rhn_config_parameter_data.sql
deleted file mode 100644
index d3e0b9e..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/163-rhn_config_parameter_data.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-
-UPDATE rhn_config_parameter SET value='/var/log/nocpulse/enqueue.log'
- WHERE group_name='notification' AND name='enqueue_log';
-UPDATE rhn_config_parameter SET value='/var/log/nocpulse/ack_handler.log'
- WHERE group_name='notification' AND name='ack_handler_log';
-UPDATE rhn_config_parameter SET value='--cd=/var/log/nocpulse --dir=/var/log/nocpulse/archive /var/log/nocpulse/ack_handler.log enqueue.log generate_config.log notifserver.log.save notifserver-error.log --recreate=ticketlog'
- WHERE group_name='notification' AND name='archive_params';
-
-commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/170-rhnErrataNotificationQueue.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/170-rhnErrataNotificationQueue.sql
deleted file mode 100644
index ee1edee..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/170-rhnErrataNotificationQueue.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-ALTER TABLE rhnErrataNotificationQueue
- MODIFY
- next_action default(sysdate);
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/180-rhnServerGroup_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/180-rhnServerGroup_indexes.sql
deleted file mode 100644
index 0f09f8d..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/180-rhnServerGroup_indexes.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-
-alter index rhn_sg_id_oid_name_idx noparallel;
-alter index rhn_sg_oid_id_name_idx noparallel;
-alter index rhn_sg_type_id_idx noparallel;
-alter index rhn_sg_oid_type_id_idx noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/181-rhnServerGroupMembers_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/181-rhnServerGroupMembers_indexes.sql
deleted file mode 100644
index 1c6392f..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/181-rhnServerGroupMembers_indexes.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-alter index rhn_sgmembers_sgid_sid_idx noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/182-rhnServerNeededCache_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/182-rhnServerNeededCache_indexes.sql
deleted file mode 100644
index b412919..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/182-rhnServerNeededCache_indexes.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter index rhn_snc_pid_idx noparallel;
-alter index rhn_snc_sid_idx noparallel;
-alter index rhn_snc_eid_idx noparallel;
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/183-rhnServerPackage_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/183-rhnServerPackage_indexes.sql
deleted file mode 100644
index de11c00..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/183-rhnServerPackage_indexes.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-alter index rhn_sp_snep_idx noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/184-rhnUserGroup_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/184-rhnUserGroup_indexes.sql
deleted file mode 100644
index 2cbb43a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/184-rhnUserGroup_indexes.sql
+++ /dev/null
@@ -1,6 +0,0 @@
-
-alter index rhn_ug_id_name_org noparallel;
-alter index rhn_ug_org_id_name_idx noparallel;
-alter index rhn_ug_org_id_type_idx noparallel;
-alter index rhn_ug_org_id_gtype_idx noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/185-rhnUserGroupMembers_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/185-rhnUserGroupMembers_indexes.sql
deleted file mode 100644
index e4d3e23..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/185-rhnUserGroupMembers_indexes.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter index rhn_ugmembers_uid_ugid_uq noparallel;
-alter index rhn_ugmembers_ugid_uid_idx noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/186-web_contact_indexes.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/186-web_contact_indexes.sql
deleted file mode 100644
index 2843486..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/186-web_contact_indexes.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-
-alter index web_contact_oid_id noparallel;
-alter index web_contact_id_oid_cust_luc noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/187-web_user_site_info_index.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/187-web_user_site_info_index.sql
deleted file mode 100644
index 871953f..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/187-web_user_site_info_index.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-
-alter index web_user_site_info_wuid noparallel;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/188-rhnUserInfo_data.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/188-rhnUserInfo_data.sql
deleted file mode 100644
index 2f661a0..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/188-rhnUserInfo_data.sql
+++ /dev/null
@@ -1,19 +0,0 @@
---
--- Copyright (c) 2009 Red Hat, Inc.
---
--- This software is licensed to you under the GNU General Public License,
--- version 2 (GPLv2). There is NO WARRANTY for this software, express or
--- implied, including the implied warranties of MERCHANTABILITY or FITNESS
--- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
--- along with this software; if not, see
--- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
---
--- Red Hat trademarks are not licensed under GPLv2. No permission is
--- granted to use or replicate Red Hat trademarks that are incorporated
--- in this software or its documentation.
---
---
--- $Id$
---
-update rhnUserInfo set page_size=25 where page_size=20;
-
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/189-rhnReleaseChannelMap-unique.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/189-rhnReleaseChannelMap-unique.sql
deleted file mode 100644
index a081459..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/189-rhnReleaseChannelMap-unique.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-ALTER TABLE rhnReleaseChannelMap
-ADD CONSTRAINT rhn_rcm_pva_def_uniq
-UNIQUE (product, version, channel_arch_id, is_default);
diff --git a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/99-rhnPackage-Copyright.sql b/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/99-rhnPackage-Copyright.sql
deleted file mode 100644
index 9330afc..0000000
--- a/schema/spacewalk/upgrade/spacewalk-0.4-spacewalk-0.5/99-rhnPackage-Copyright.sql
+++ /dev/null
@@ -1,9 +0,0 @@
---
--- Double the copyright from
--- 64 -> 128 to resolve rhnpush
--- for centos packages
---
-
-ALTER TABLE rhnPackage
-MODIFY
- COPYRIGHT VARCHAR2(128);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/100-rhnCpuArch-i86pc.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/100-rhnCpuArch-i86pc.sql
new file mode 100644
index 0000000..8ab903b
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/100-rhnCpuArch-i86pc.sql
@@ -0,0 +1,9 @@
+insert into rhnCpuArch (id, label, name) (
+ select rhn_cpu_arch_id_seq.nextval, 'i86pc', 'i86pc'
+ from dual
+ where not exists (
+ select 1
+ from rhnCpuArch
+ where label = 'i86pc' and name = 'i86pc')
+);
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/101-rhnKickstartPackage-position.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/101-rhnKickstartPackage-position.sql
new file mode 100644
index 0000000..7f7bdac
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/101-rhnKickstartPackage-position.sql
@@ -0,0 +1,12 @@
+
+alter table rhnKickstartPackage
+add position number;
+
+update rhnKickstartPackage
+set position = 0;
+
+commit;
+
+alter table rhnKickstartPackage
+modify position not null;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/102-rhnIndexerWork-last_modified.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/102-rhnIndexerWork-last_modified.sql
new file mode 100644
index 0000000..9e15cb9
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/102-rhnIndexerWork-last_modified.sql
@@ -0,0 +1,8 @@
+
+alter table rhnIndexerWork
+add last_modified date default (sysdate) not null;
+
+commit;
+
+
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-drop-rhn-clean-current-state.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-drop-rhn-clean-current-state.sql
new file mode 100644
index 0000000..e5a8926
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-drop-rhn-clean-current-state.sql
@@ -0,0 +1 @@
+drop procedure RHN_CLEAN_CURRENT_STATE;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-rhn_config_parameter_data-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-rhn_config_parameter_data-move_opt.sql
new file mode 100644
index 0000000..87bc4d6
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/103-rhn_config_parameter_data-move_opt.sql
@@ -0,0 +1,13 @@
+
+update rhn_config_parameter set value=replace(value, '/opt/nocpulse/TSDBLocalQueue', '/var/log/nocpulse/TSDBLocalQueue');
+update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/var/', '/var/lib/nocpulse/');
+update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/etc', '/etc/nocpulse');
+update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/bin/', '/usr/bin/');
+update rhn_config_parameter set value=replace(value, '/opt/home/nocpulse/.ssh', '/var/lib/nocpulse/.ssh');
+update rhn_config_parameter set value=replace(value, '/opt/notification/queue', '/var/lib/nocpulse/queue');
+update rhn_config_parameter set value=replace(value, '/opt/notification/var', '/var/log/nocpulse');
+update rhn_config_parameter set value=replace(value, '/opt/notification/etc', '/etc/nocpulse');
+update rhn_config_parameter set value=replace(value, '/opt/notification/tmp', '/var/tmp');
+update rhn_config_parameter set value=replace(value, '/opt/notification', '/var/lib/nocpulse');
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-drop-is-user-org-admin.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-drop-is-user-org-admin.sql
new file mode 100644
index 0000000..47031e7
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-drop-is-user-org-admin.sql
@@ -0,0 +1 @@
+drop function is_user_org_admin;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-rhn_command-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-rhn_command-move_opt.sql
new file mode 100644
index 0000000..784c5a0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/104-rhn_command-move_opt.sql
@@ -0,0 +1,4 @@
+
+alter table rhn_command
+modify command_class default '/var/lib/nocpulse/libexec';
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/105-rhn_command_queue_commands-move_opt.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/105-rhn_command_queue_commands-move_opt.sql
new file mode 100644
index 0000000..3748aeb
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/105-rhn_command_queue_commands-move_opt.sql
@@ -0,0 +1,3 @@
+
+update rhn_command_queue_commands set command_line=replace(command_line, '/opt/home/nocpulse/bin/', '/usr/bin/');
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/110-rhn_contact_groups-cleanup.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/110-rhn_contact_groups-cleanup.sql
new file mode 100644
index 0000000..411cc72
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3/110-rhn_contact_groups-cleanup.sql
@@ -0,0 +1,8 @@
+
+delete from rhn_contact_groups
+where not exists (
+ select 1
+ from rhn_contact_group_members
+ where rhn_contact_groups.recid = contact_group_id
+ );
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/112-rhnKSData-drop-name.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/112-rhnKSData-drop-name.sql
new file mode 100644
index 0000000..33bc74e
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/112-rhnKSData-drop-name.sql
@@ -0,0 +1,35 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnKSData
+DROP CONSTRAINT rhn_ks_oid_name_uq;
+
+ALTER TABLE rhnKSData
+DROP COLUMN name;
+
+ALTER TABLE rhnKsData
+ADD cobbler_id varchar(64);
+
+show errors
+
+-- $Log$
+-- Revision 2 2008/12/02 16:51:05.2 jsherrill
+-- Add cobbler_id column
+--
+-- Revision 1 2008/10/01 7:01:05 mmccune
+-- Removed the unused name column
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/113-rhnActionKickstart-add-kshost.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/113-rhnActionKickstart-add-kshost.sql
new file mode 100644
index 0000000..a281877
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/113-rhnActionKickstart-add-kshost.sql
@@ -0,0 +1,27 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+ALTER TABLE rhnActionKickstart
+ ADD kickstart_host varchar2(256);
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/10/29 7:01:05 mmccune
+-- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/114-rhnChannelTrust.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/114-rhnChannelTrust.sql
new file mode 100644
index 0000000..c4ee3a1
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/114-rhnChannelTrust.sql
@@ -0,0 +1,51 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnChannelTrust
+(
+ channel_id number
+ constraint rhn_channel_trust_cid_nn not null
+ constraint rhn_channel_trust_cid_fk
+ references rhnChannel(id)
+ on delete cascade,
+ org_trust_id number
+ constraint rhn_channel_trust_otid_nn not null
+ constraint rhn_channel_trust_otid_fk
+ references web_customer(id)
+ on delete cascade,
+ created date default (sysdate)
+ constraint rhn_channel_trust_created_nn not null,
+ modified date default (sysdate)
+ constraint rhn_channel_trust_modified_nn not null
+)
+ storage( pctincrease 1 freelists 16)
+ enable row movement
+ initrans 32;
+
+create unique index rhn_channel_trust_cid_uq
+ on rhnChannelTrust(channel_id,org_trust_id)
+ tablespace [[2m_tbs]]
+ storage( pctincrease 1 freelists 16)
+ initrans 32;
+
+create index rhn_channel_trust_org_trust
+ on rhnChannelTrust(org_trust_id)
+ tablespace [[2m_tbs]]
+ storage( pctincrease 1 freelists 16)
+ initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/115-rhnChannel-add-maint-columns.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/115-rhnChannel-add-maint-columns.sql
new file mode 100644
index 0000000..ad73ba9
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/115-rhnChannel-add-maint-columns.sql
@@ -0,0 +1,54 @@
+--
+-- 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.
+--
+--
+--
+--
+ALTER TABLE rhnChannel
+ADD channel_access varchar2(10) default 'private';
+
+ALTER TABLE rhnChannel
+ADD maint_name varchar2(128);
+
+ALTER TABLE rhnChannel
+ADD maint_email varchar2(128);
+
+ALTER TABLE rhnChannel
+ADD maint_phone varchar2(128);
+
+ALTER TABLE rhnChannel
+ADD support_policy varchar2(256);
+
+
+
+create index rhn_channel_access_idx
+ on rhnChannel(channel_access)
+ tablespace [[64k_tbs]]
+ storage ( freelists 16 )
+ initrans 32
+ nologging;
+
+create or replace trigger rhn_channel_access_trig
+after update on rhnChannel
+for each row
+begin
+ if :old.channel_access = 'protected' and
+ :new.channel_access != 'protected'
+ then
+ delete from rhnChannelTrust where channel_id = :old.id;
+ end if;
+end;
+/
+show errors
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/116-rhnTrustedOrgs.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/116-rhnTrustedOrgs.sql
new file mode 100644
index 0000000..2f4e8fa
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/116-rhnTrustedOrgs.sql
@@ -0,0 +1,45 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnTrustedOrgs
+(
+ org_id number
+ constraint rhn_trusted_orgs_oid_nn not null
+ constraint rhn_trusted_orgs_oid_fk
+ references web_customer(id)
+ on delete cascade,
+ org_trust_id number
+ constraint rhn_trusted_orgs_otid_nn not null
+ constraint rhn_trusted_orgs_otid_fk
+ references web_customer(id)
+ on delete cascade,
+ created date default (sysdate)
+ constraint rhn_trusted_orgs_created_nn not null,
+ modified date default (sysdate)
+ constraint rhn_trusted_orgs_modified_nn not null
+)
+ storage( pctincrease 1 freelists 16)
+ enable row movement
+ initrans 32;
+
+create unique index rhn_trusted_orgs_oid_uq
+ on rhnTrustedOrgs(org_id,org_trust_id)
+ tablespace [[2m_tbs]]
+ storage( pctincrease 1 freelists 16)
+ initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/117-rhnAllowTrust.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/117-rhnAllowTrust.sql
new file mode 100644
index 0000000..da05422
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/117-rhnAllowTrust.sql
@@ -0,0 +1,42 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnAllowTrust
+(
+ org_id number
+ constraint rhn_allow_trust_oid_nn not null
+ constraint rhn_allow_trust_oid_fk
+ references web_customer(id)
+ on delete cascade,
+ channel_flag char(1) default('N')
+ constraint rhn_allow_trust_channelflg_nn not null
+ constraint rhn_allow_trust_channelflg_ck
+ check (channel_flag in ('N','Y')),
+ migration_flag char(1) default('N')
+ constraint rhn_allow_trust_migrflg_nn not null
+ constraint rhn_allow_trust_migrflg_ck
+ check (migration_flag in ('N','Y')),
+ created date default (sysdate)
+ constraint rhn_allow_trust_created_nn not null,
+ modified date default (sysdate)
+ constraint rhn_allow_trust_modified_nn not null
+)
+ storage( pctincrease 1 freelists 16)
+ enable row movement
+ initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/118-rhnSystemMigrations.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/118-rhnSystemMigrations.sql
new file mode 100644
index 0000000..39084c2
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/118-rhnSystemMigrations.sql
@@ -0,0 +1,51 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+create table
+rhnSystemMigrations
+(
+ org_id_to number
+ constraint rhn_sys_mig_oidto_nn not null
+ constraint rhn_sys_mig_oidto_fk
+ references web_customer(id),
+ org_id_from number
+ constraint rhn_sys_mig_oidfrm_nn not null
+ constraint rhn_sys_mig_oidfrm_fk
+ references web_customer(id),
+ server_id number
+ constraint rhn_sys_mig_sid_nn not null
+ constraint rhn_sys_mig_sid_fk
+ references rhnServer(id)
+ on delete cascade,
+ migrated date default (sysdate)
+ constraint rhn_sys_mig_migrated_nn not null
+)
+ storage ( pctincrease 1 freelists 16 )
+ enable row movement
+ initrans 32;
+
+create index rsm_org_id_to_idx
+ on rhnSystemMigrations ( org_id_to )
+ storage ( freelists 16 )
+ initrans 32;
+
+
+create index rsm_org_id_from_idx
+ on rhnSystemMigrations ( org_id_from )
+ storage ( freelists 16 )
+ initrans 32;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/119-rhnSharedChannelView.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/119-rhnSharedChannelView.sql
new file mode 100644
index 0000000..bced9fb
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/119-rhnSharedChannelView.sql
@@ -0,0 +1,55 @@
+CREATE OR REPLACE VIEW RHNSHAREDCHANNELVIEW
+AS
+SELECT
+ CH.ID,
+ CH.PARENT_CHANNEL,
+ CH.ORG_ID,
+ CH.CHANNEL_ARCH_ID,
+ CH.LABEL,
+ CH.BASEDIR,
+ CH.NAME,
+ CH.SUMMARY,
+ CH.DESCRIPTION,
+ CH.PRODUCT_NAME_ID,
+ CH.GPG_KEY_URL,
+ CH.GPG_KEY_ID,
+ CH.GPG_KEY_FP,
+ CH.END_OF_LIFE,
+ CH.RECEIVING_UPDATES,
+ CH.LAST_MODIFIED,
+ CH.CHANNEL_PRODUCT_ID,
+ CH.CREATED,
+ CH.MODIFIED,
+ CH.CHANNEL_ACCESS,
+ TR.ORG_TRUST_ID
+FROM RHNCHANNEL CH,
+ RHNTRUSTEDORGS TR
+WHERE CH.ORG_ID = TR.ORG_ID AND
+ CH.CHANNEL_ACCESS = 'public'
+UNION
+SELECT
+ CH.ID,
+ CH.PARENT_CHANNEL,
+ CH.ORG_ID,
+ CH.CHANNEL_ARCH_ID,
+ CH.LABEL,
+ CH.BASEDIR,
+ CH.NAME,
+ CH.SUMMARY,
+ CH.DESCRIPTION,
+ CH.PRODUCT_NAME_ID,
+ CH.GPG_KEY_URL,
+ CH.GPG_KEY_ID,
+ CH.GPG_KEY_FP,
+ CH.END_OF_LIFE,
+ CH.RECEIVING_UPDATES,
+ CH.LAST_MODIFIED,
+ CH.CHANNEL_PRODUCT_ID,
+ CH.CREATED,
+ CH.MODIFIED,
+ CH.CHANNEL_ACCESS,
+ TR.ORG_TRUST_ID
+FROM RHNCHANNEL CH,
+ RHNCHANNELTRUST TR
+WHERE CH.ID = TR.CHANNEL_ID
+/
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/120-rhnUserChannel.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/120-rhnUserChannel.sql
new file mode 100644
index 0000000..7164afc
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/120-rhnUserChannel.sql
@@ -0,0 +1,66 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+create or replace view rhnUserChannel
+as
+select
+ cfp.user_id,
+ cfp.org_id,
+ cfm.channel_id,
+ 'manage' role
+from rhnChannelFamilyMembers cfm,
+ rhnUserChannelFamilyPerms cfp
+where
+ cfp.channel_family_id = cfm.channel_family_id and
+ rhn_channel.user_role_check(cfm.channel_id, cfp.user_id, 'manage') = 1
+union all
+select
+ cfp.user_id,
+ cfp.org_id,
+ cfm.channel_id,
+ 'subscribe' role
+from rhnChannelFamilyMembers cfm,
+ rhnUserChannelFamilyPerms cfp
+where
+ cfp.channel_family_id = cfm.channel_family_id and
+ rhn_channel.user_role_check(cfm.channel_id, cfp.user_id, 'subscribe') = 1
+union all
+select
+ w.id as user_id,
+ w.org_id,
+ s.id as channel_id,
+ 'subscribe' role
+from rhnSharedChannelView s,
+ web_contact w
+where
+ w.org_id = s.org_trust_id and
+ rhn_channel.user_role_check(s.id, w.id, 'subscribe') = 1;
+
+--
+--
+-- Revision 1.15 2004/04/28 14:57:02 pjones
+-- bugzilla: 119698 -- Go back to a split version of this, like in 1.13. We
+-- don't need the distinct though; nothing can show up in either table twice.
+--
+-- Revision 1.13 2004/04/14 15:58:39 pjones
+-- bugzilla: none -- make rhnUserChannel work without org_id... (duh...)
+--
+-- Revision 1.12 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/121-rhn_channel.pks.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/121-rhn_channel.pks.sql
new file mode 100644
index 0000000..7783451
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/121-rhn_channel.pks.sql
@@ -0,0 +1,250 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE
+PACKAGE rhn_channel
+IS
+ version varchar2(100) := '';
+
+ CURSOR server_base_subscriptions(server_id_in NUMBER) IS
+ SELECT C.id
+ FROM rhnChannel C, rhnServerChannel SC
+ WHERE C.id = SC.channel_id
+ AND SC.server_id = server_id_in
+ AND C.parent_channel IS NULL;
+
+ CURSOR check_server_subscription(server_id_in NUMBER, channel_id_in NUMBER) IS
+ SELECT channel_id
+ FROM rhnServerChannel
+ WHERE server_id = server_id_in
+ AND channel_id = channel_id_in;
+
+ CURSOR check_server_parent_membership(server_id_in NUMBER, channel_id_in NUMBER) IS
+ SELECT C.id
+ FROM rhnChannel C, rhnServerChannel SC
+ WHERE C.parent_channel = channel_id_in
+ AND C.id = SC.channel_id
+ AND SC.server_id = server_id_in;
+
+ CURSOR channel_family_perm_cursor(channel_family_id_in NUMBER, org_id_in NUMBER) IS
+ SELECT *
+ FROM rhnOrgChannelFamilyPermissions
+ WHERE channel_family_id = channel_family_id_in
+ AND org_id = org_id_in;
+
+ PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER);
+ FUNCTION get_license_path(channel_id_in IN NUMBER) RETURN VARCHAR2;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server in number := 0 );
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in number := null);
+
+ function can_server_consume_virt_channl(
+ server_id_in IN NUMBER,
+ family_id_in in number)
+ return number;
+
+ FUNCTION guess_server_base(server_id_in IN NUMBER) RETURN NUMBER;
+
+ FUNCTION base_channel_for_release_arch(release_in in varchar2,
+ server_arch_in in varchar2, org_id_in in number := -1,
+ user_id_in in number := null) RETURN number;
+
+ FUNCTION base_channel_rel_archid(release_in in varchar2,
+ server_arch_id_in in number, org_id_in in number := -1,
+ user_id_in in number := null) RETURN number;
+
+ FUNCTION channel_priority(channel_id_in in number) RETURN number;
+
+ PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+ PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+
+ PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER);
+ procedure bulk_server_basechange_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ old_channel_id_in in number,
+ new_channel_id_in in number);
+
+ procedure bulk_guess_server_base(
+ set_label_in in varchar2,
+ set_uid_in in number);
+
+ procedure bulk_guess_server_base_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ channel_id_in in number);
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server in number := 0 );
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
+
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number;
+
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER, org_id_in IN NUMBER);
+ FUNCTION family_for_channel(channel_id_in IN NUMBER) RETURN NUMBER;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER, org_id_in IN NUMBER) RETURN NUMBER;
+
+ procedure entitle_customer(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
+ procedure set_family_maxmembers(customer_id_in in number, channel_family_id_in in number, quantity_in in number);
+ procedure unsubscribe_server_from_family(server_id_in in number, channel_family_id_in in number);
+
+ procedure delete_server_channels(server_id_in in number);
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)');
+
+ function get_org_id(channel_id_in in number) return number;
+ PRAGMA RESTRICT_REFERENCES(get_org_id, WNDS, RNPS, WNPS);
+
+ function get_org_access(channel_id_in in number, org_id_in in number) return number;
+ PRAGMA RESTRICT_REFERENCES(get_org_access, WNDS, RNPS, WNPS);
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number) return number;
+
+ function user_role_check_debug(channel_id_in in number, user_id_in in number, role_in in varchar2, reason_out out varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(user_role_check_debug, WNDS, RNPS, WNPS);
+
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(user_role_check, WNDS, RNPS, WNPS);
+
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(loose_user_role_check, WNDS, RNPS, WNPS);
+
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(direct_user_role_check, WNDS, RNPS, WNPS);
+
+ function shared_user_role_check(channel_id in number, user_id in number, role in varchar2)
+ RETURN NUMBER;
+ PRAGMA RESTRICT_REFERENCES(shared_user_role_check, WNDS, RNPS, WNPS);
+
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ RETURN NUMBER;
+
+ PROCEDURE update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate );
+
+ PROCEDURE update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate );
+
+ PROCEDURE update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate );
+
+
+ PRAGMA RESTRICT_REFERENCES(org_channel_setting, WNDS, RNPS, WNPS);
+
+END rhn_channel;
+/
+SHOW ERRORS
+
+--
+-- Revision 1.37 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.36 2004/03/26 18:11:32 rbb
+-- Bugzilla: 114057
+--
+-- Add a script to determine channel priority.
+--
+-- Revision 1.35 2004/02/17 20:16:52 pjones
+-- bugzilla: none -- add cvs tags into the package as long as we're touching
+-- it anyway
+--
+-- Revision 1.34 2003/11/13 18:13:09 cturner
+-- pragmas can now return now that rhn_user pragmas are fixed
+--
+-- Revision 1.32 2003/09/22 21:00:40 cturner
+-- add method for easy acl check
+--
+-- Revision 1.31 2003/09/17 22:14:11 misa
+-- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
+--
+-- Revision 1.30 2003/07/24 16:44:16 misa
+-- bugzilla: none A function more usable on the rhnapp side
+--
+-- Revision 1.29 2003/07/24 14:00:17 misa
+-- bugzilla: none PRAGMA RESTRICT_REFERENCES good
+--
+-- Revision 1.28 2003/07/23 21:59:19 cturner
+-- rework how rhnUserChannel works; move to plsql for speed and maintenance
+--
+-- Revision 1.27 2003/07/21 17:49:12 pjones
+-- bugzilla: none
+--
+-- add optional user for subscribe_server
+--
+-- Revision 1.26 2002/12/19 18:13:42 misa
+-- Added caller with a default value
+--
+-- Revision 1.25 2002/12/11 22:18:46 pjones
+-- rhnChannelNewestPackage
+--
+-- Revision 1.24 2002/11/21 22:08:11 pjones
+-- make unsubscribe_channels have a "unsubscribe_children_in number := 0"
+-- argument so that you can tell it to unsubscribe children.
+--
+-- Also, make it raise an exception instead of silent failure in the
+-- other case.
+--
+-- Revision 1.23 2002/11/18 17:20:50 pjones
+-- this should have gone back too
+--
+-- Revision 1.22 2002/11/13 23:16:18 pjones
+-- lookup_*_arch()
+--
+-- Revision 1.21 2002/10/07 20:01:59 rnorwood
+-- guess base channel for ssm and single system
+--
+-- Revision 1.20 2002/10/02 19:21:03 bretm
+-- o 3rd party channel schema changes, no more clobs...
+--
+-- Revision 1.19 2002/09/20 19:21:58 bretm
+-- o more 3rd party channel stuff...
+--
+-- Revision 1.18 2002/06/12 22:33:03 pjones
+-- procedure bulk_guess_server_base_from(
+-- set_label_in in varchar2,
+-- set_uid_in in number,
+-- channel_id_in in number);
+--
+-- for bretm
+--
+-- Revision 1.17 2002/06/12 22:12:25 pjones
+-- procedure bulk_guess_server_base(
+-- set_label_in in varchar2,
+-- set_uid_in in number);
+--
+-- for bretm
+--
+-- Revision 1.16 2002/06/12 19:37:55 pjones
+-- bulk_server_basechange_from(
+-- set_label_in in varchar2,
+-- set_uid_in in number,
+-- old_channel_id_in in number,
+-- new_channel_id_in in number
+-- );
+--
+-- for bretm
+--
+-- Revision 1.15 2002/05/10 22:08:22 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/122-rhn_channel.pkb.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/122-rhn_channel.pkb.sql
new file mode 100644
index 0000000..974c897
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/122-rhn_channel.pkb.sql
@@ -0,0 +1,1398 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_channel
+IS
+ body_version varchar2(100) := '';
+
+ -- Cursor that fetches all the possible base channels for a
+ -- (server_arch_id, release, org_id) combination
+ cursor base_channel_cursor(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number
+ ) return rhnChannel%ROWTYPE is
+ select distinct c.*
+ from rhnDistChannelMap dcm,
+ rhnServerChannelArchCompat scac,
+ rhnChannel c,
+ rhnChannelPermissions cp
+ where cp.org_id = org_id_in
+ and cp.channel_id = c.id
+ and c.parent_channel is null
+ and c.id = dcm.channel_id
+ and c.channel_arch_id = dcm.channel_arch_id
+ and dcm.release = release_in
+ and scac.server_arch_id = server_arch_id_in
+ and scac.channel_arch_id = c.channel_arch_id;
+
+ FUNCTION get_license_path(channel_id_in IN NUMBER)
+ RETURN VARCHAR2
+ IS
+ license_val VARCHAR2(1000);
+ BEGIN
+ SELECT CFL.license_path INTO license_val
+ FROM rhnChannelFamilyLicense CFL, rhnChannelFamilyMembers CFM
+ WHERE CFM.channel_id = channel_id_in
+ AND CFM.channel_family_id = CFL.channel_family_id;
+
+ RETURN license_val;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END get_license_path;
+
+
+ PROCEDURE license_consent(channel_id_in IN NUMBER, user_id_in IN NUMBER, server_id_in IN NUMBER)
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_consent_no_license');
+ END IF;
+
+ INSERT INTO rhnChannelFamilyLicenseConsent (channel_family_id, user_id, server_id)
+ VALUES (channel_family_id_val, user_id_in, server_id_in);
+ END license_consent;
+
+ PROCEDURE subscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, user_id_in in number := null)
+ IS
+ channel_parent_val rhnChannel.parent_channel%TYPE;
+ parent_subscribed BOOLEAN;
+ server_has_base_chan BOOLEAN;
+ server_already_in_chan BOOLEAN;
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ consenting_user NUMBER;
+ allowed number := 0;
+ current_members_val number;
+ BEGIN
+ if user_id_in is not null then
+ allowed := rhn_channel.user_role_check(channel_id_in, user_id_in, 'subscribe');
+ else
+ allowed := 1;
+ end if;
+
+ if allowed = 0 then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+
+
+ SELECT parent_channel INTO channel_parent_val FROM rhnChannel WHERE id = channel_id_in;
+
+ IF channel_parent_val IS NOT NULL
+ THEN
+ -- child channel; if attempting to cross-subscribe a child to the wrong base, silently ignore
+ parent_subscribed := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_parent_val)
+ LOOP
+ parent_subscribed := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT parent_subscribed
+ THEN
+ RETURN;
+ END IF;
+ ELSE
+ -- base channel
+ server_has_base_chan := FALSE;
+ FOR base IN server_base_subscriptions(server_id_in)
+ LOOP
+ server_has_base_chan := TRUE;
+ END LOOP base;
+
+ IF server_has_base_chan
+ THEN
+ rhn_exception.raise_exception('channel_server_one_base');
+ END IF;
+ END IF;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_subscribe_no_family');
+ END IF;
+
+ --
+ -- Use the org_id of the server only if the org_id of the channel = NULL.
+ -- This is required for subscribing to shared channels.
+ --
+ SELECT NVL(org_id, (SELECT org_id FROM rhnServer WHERE id = server_id_in))
+ INTO server_org_id_val
+ FROM rhnChannel
+ WHERE id = channel_id_in;
+
+ select current_members
+ into current_members_val
+ from rhnPrivateChannelFamily
+ where org_id = server_org_id_val and channel_family_id = channel_family_id_val
+ for update of current_members;
+
+ available_subscriptions := rhn_channel.available_family_subscriptions(channel_family_id_val, server_org_id_val);
+
+ IF available_subscriptions IS NULL OR
+ available_subscriptions > 0 or
+ can_server_consume_virt_channl(server_id_in, channel_family_id_val) = 1
+ THEN
+
+ IF rhn_channel.get_license_path(channel_id_in) IS NOT NULL
+ THEN
+ BEGIN
+
+ SELECT user_id INTO consenting_user
+ FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ EXCEPTION
+ WHEN NO_DATA_FOUND THEN
+ rhn_exception.raise_exception('channel_subscribe_no_consent');
+ END;
+ END IF;
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'subscribed to channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ INSERT INTO rhnServerChannel (server_id, channel_id) VALUES (server_id_in, channel_id_in);
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ queue_server(server_id_in, immediate_in);
+ ELSE
+ rhn_exception.raise_exception('channel_family_no_subscriptions');
+ END IF;
+
+ END subscribe_server;
+
+ function can_server_consume_virt_channl(
+ server_id_in in number,
+ family_id_in in number )
+ return number
+ is
+
+ cursor server_virt_families is
+ select vi.virtual_system_id, cfvsl.channel_family_id
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnVirtualInstance vi
+ where
+ vi.virtual_system_id = server_id_in
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ and cfvsl.channel_family_id = family_id_in
+ and exists (
+ select 1
+ from rhnServerEntitlementView sev
+ where vi.host_system_id = sev.server_id
+ and sev.server_group_type_id = sgtvsl.server_group_type_id );
+ begin
+
+ for server_virt_family in server_virt_families loop
+ return 1;
+ end loop;
+
+ return 0;
+
+ end;
+
+
+ PROCEDURE bulk_subscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END LOOP server;
+ END bulk_subscribe_server;
+
+ PROCEDURE bulk_server_base_change(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ IF rhn_server.can_change_base_channel(server.element) = 1
+ THEN
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(server.element, channel_id_in, 0, set_uid_in);
+ END IF;
+ END LOOP server;
+ END bulk_server_base_change;
+
+ procedure bulk_server_basechange_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ old_channel_id_in in number,
+ new_channel_id_in in number
+ ) is
+ cursor servers is
+ select sc.server_id id
+ from rhnChannel nc,
+ rhnServerChannelArchCompat scac,
+ rhnServer s,
+ rhnChannel oc,
+ rhnServerChannel sc,
+ rhnSet st
+ where 1=1
+ -- first, find the servers we're looking for.
+ and st.label = set_label_in
+ and st.user_id = set_uid_in
+ and st.element = sc.server_id
+ -- now, filter out anything that's not in the
+ -- old base channel.
+ and sc.channel_id = old_channel_id_in
+ and sc.channel_id = oc.id
+ and oc.parent_channel is null
+ -- now, see if it's compatible with the new base channel
+ and nc.id = new_channel_id_in
+ and nc.parent_channel is null
+ and sc.server_id = s.id
+ and s.server_arch_id = scac.server_arch_id
+ and scac.channel_arch_id = nc.channel_arch_id;
+ begin
+ for s in servers loop
+ insert into rhnSet (
+ user_id, label, element
+ ) values (
+ set_uid_in,
+ set_label_in || 'basechange',
+ s.id
+ );
+ end loop channel;
+ bulk_server_base_change(new_channel_id_in,
+ set_label_in || 'basechange',
+ set_uid_in);
+ delete from rhnSet
+ where label = set_label_in||'basechange'
+ and user_id = set_uid_in;
+ end bulk_server_basechange_from;
+
+ procedure bulk_guess_server_base(
+ set_label_in in varchar2,
+ set_uid_in in number
+ ) is
+ channel_id number;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ -- anything that doesn't work, we just ignore
+ begin
+ if rhn_server.can_change_base_channel(server.element) = 1
+ then
+ channel_id := guess_server_base(TO_NUMBER(server.element));
+ rhn_channel.clear_subscriptions(TO_NUMBER(server.element));
+ rhn_channel.subscribe_server(TO_NUMBER(server.element), channel_id, 0, set_uid_in);
+ end if;
+ exception when others then
+ null;
+ end;
+ end loop server;
+ end;
+
+ function guess_server_base(
+ server_id_in in number
+ ) RETURN number is
+ cursor server_cursor is
+ select s.server_arch_id, s.release, s.org_id
+ from rhnServer s
+ where s.id = server_id_in;
+ begin
+ for s in server_cursor loop
+ for channel in base_channel_cursor(s.release,
+ s.server_arch_id, s.org_id)
+ loop
+ return channel.id;
+ end loop base_channel_cursor;
+ end loop server_cursor;
+ -- Server not found, or no base channel applies to it
+ return null;
+ end;
+
+ -- Private function
+ function normalize_server_arch(server_arch_in in varchar2)
+ return varchar2
+ deterministic
+ is
+ suffix VARCHAR2(128) := '-redhat-linux';
+ suffix_len NUMBER := length(suffix);
+ begin
+ if server_arch_in is NULL then
+ return NULL;
+ end if;
+ if instr(server_arch_in, '-') > 0
+ then
+ -- Suffix already present
+ return server_arch_in;
+ end if;
+ return server_arch_in || suffix;
+ end normalize_server_arch;
+
+ --
+ --
+ -- Raises:
+ -- server_arch_not_found
+ -- no_subscribe_permissions
+ function base_channel_for_release_arch(
+ release_in in varchar2,
+ server_arch_in in varchar2,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ server_arch varchar2(256) := normalize_server_arch(server_arch_in);
+ server_arch_id number;
+ begin
+ -- Look up the server arch
+ begin
+ select id
+ into server_arch_id
+ from rhnServerArch
+ where label = server_arch;
+ exception
+ when no_data_found then
+ rhn_exception.raise_exception('server_arch_not_found');
+ end;
+ return base_channel_rel_archid(release_in, server_arch_id,
+ org_id_in, user_id_in);
+ end base_channel_for_release_arch;
+
+ function base_channel_rel_archid(
+ release_in in varchar2,
+ server_arch_id_in in number,
+ org_id_in in number := -1,
+ user_id_in in number := null
+ ) return number is
+ denied_channel_id number := null;
+ valid_org_id number := org_id_in;
+ valid_user_id number := user_id_in;
+ channel_subscribable number;
+ begin
+ if org_id_in = -1 and user_id_in is not null then
+ -- Get the org id from the user id
+ begin
+ select org_id
+ into valid_org_id
+ from web_contact
+ where id = user_id_in;
+ exception
+ when no_data_found then
+ -- User doesn't exist
+ -- XXX Only list public stuff for now
+ valid_user_id := null;
+ valid_org_id := -1;
+ end;
+ end if;
+
+ for c in base_channel_cursor(release_in, server_arch_id_in, valid_org_id)
+ loop
+ -- This row is a possible match
+ if valid_user_id is null then
+ -- User ID not specified, so no user to channel permissions to
+ -- check
+ return c.id;
+ end if;
+
+ -- Check user to channel permissions
+ select loose_user_role_check(c.id, user_id_in, 'subscribe')
+ into channel_subscribable
+ from dual;
+
+ if channel_subscribable = 1 then
+ return c.id;
+ end if;
+
+ -- Base channel exists, but is not subscribable; keep trying
+ denied_channel_id := c.id;
+ end loop base_channel_fetch;
+
+ if denied_channel_id is not null then
+ rhn_exception.raise_exception('no_subscribe_permissions');
+ end if;
+ -- No base channel applies
+ return NULL;
+ end base_channel_rel_archid;
+
+ procedure bulk_guess_server_base_from(
+ set_label_in in varchar2,
+ set_uid_in in number,
+ channel_id_in in number
+ ) is
+ cursor channels(server_id_in in number) is
+ select rsc.channel_id
+ from rhnServerChannel rsc,
+ rhnChannel rc
+ where server_id_in = rsc.server_id
+ and rsc.channel_id = rc.id
+ and rc.parent_channel is null;
+ begin
+ for server in rhn_set.set_iterator(set_label_in, set_uid_in)
+ loop
+ for channel in channels(server.element)
+ loop
+ if channel.channel_id = channel_id_in
+ then
+ insert into rhnSet (user_id, label, element) values (set_uid_in, set_label_in || 'baseguess', server.element);
+ end if;
+ end loop channel;
+ end loop server;
+ bulk_guess_server_base(set_label_in||'baseguess',set_uid_in);
+ delete from rhnSet where label = set_label_in||'baseguess' and user_id = set_uid_in;
+ end;
+
+
+ PROCEDURE clear_subscriptions(server_id_in IN NUMBER, deleting_server IN NUMBER := 0 )
+ IS
+ cursor server_channels(server_id_in in number) is
+ select s.org_id, sc.channel_id, cfm.channel_family_id
+ from rhnServer s,
+ rhnServerChannel sc,
+ rhnChannelFamilyMembers cfm
+ where s.id = server_id_in
+ and s.id = sc.server_id
+ and sc.channel_id = cfm.channel_id;
+ BEGIN
+ for channel in server_channels(server_id_in)
+ loop
+ unsubscribe_server(server_id_in, channel.channel_id, 1, 1, deleting_server);
+ rhn_channel.update_family_counts(channel.channel_family_id, channel.org_id);
+ end loop channel;
+ END clear_subscriptions;
+
+ PROCEDURE unsubscribe_server(server_id_in IN NUMBER, channel_id_in NUMBER, immediate_in NUMBER := 1, unsubscribe_children_in number := 0,
+ deleting_server IN NUMBER := 0 )
+ IS
+ channel_family_id_val NUMBER;
+ server_org_id_val NUMBER;
+ available_subscriptions NUMBER;
+ server_already_in_chan BOOLEAN;
+ cursor channel_family_is_proxy(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-proxy';
+ cursor channel_family_is_satellite(channel_family_id_in in number) is
+ select 1
+ from rhnChannelFamily
+ where id = channel_family_id_in
+ and label = 'rhn-satellite';
+ -- this is *EXACTLY* like check_server_parent_membership, but if we recurse
+ -- with the package-level one, we get a "cursor already open", so we need a
+ -- copy on our call stack instead. GROAN.
+ cursor local_chk_server_parent_memb (
+ server_id_in number,
+ channel_id_in number ) is
+ select c.id
+ from rhnChannel c,
+ rhnServerChannel sc
+ where 1=1
+ and c.parent_channel = channel_id_in
+ and c.id = sc.channel_id
+ and sc.server_id = server_id_in;
+ BEGIN
+ FOR child IN local_chk_server_parent_memb(server_id_in, channel_id_in)
+ LOOP
+ if unsubscribe_children_in = 1 then
+ unsubscribe_server(server_id_in => server_id_in,
+ channel_id_in => child.id,
+ immediate_in => immediate_in,
+ unsubscribe_children_in => unsubscribe_children_in,
+ deleting_server => deleting_server);
+ else
+ rhn_exception.raise_exception('channel_unsubscribe_child_exists');
+ end if;
+ END LOOP child;
+
+ server_already_in_chan := FALSE;
+
+ FOR check_subscription IN check_server_subscription(server_id_in, channel_id_in)
+ LOOP
+ server_already_in_chan := TRUE;
+ END LOOP check_subscription;
+
+ IF NOT server_already_in_chan
+ THEN
+ RETURN;
+ END IF;
+
+ if deleting_server = 0 then
+
+ insert into rhnServerHistory (id,server_id,summary,details) (
+ select rhn_event_id_seq.nextval,
+ server_id_in,
+ 'unsubscribed from channel ' || SUBSTR(c.label, 0, 106),
+ c.label
+ from rhnChannel c
+ where c.id = channel_id_in
+ );
+
+ UPDATE rhnServer SET channels_changed = sysdate WHERE id = server_id_in;
+ end if;
+
+ DELETE FROM rhnServerChannel WHERE server_id = server_id_in AND channel_id = channel_id_in;
+
+ if deleting_server = 0 then
+ queue_server(server_id_in, immediate_in);
+ end if;
+
+ channel_family_id_val := rhn_channel.family_for_channel(channel_id_in);
+ IF channel_family_id_val IS NULL
+ THEN
+ rhn_exception.raise_exception('channel_unsubscribe_no_family');
+ END IF;
+
+ for ignore in channel_family_is_satellite(channel_family_id_val) loop
+ delete from rhnSatelliteInfo where server_id = server_id_in;
+ delete from rhnSatelliteChannelFamily where server_id = server_id_in;
+ end loop;
+
+ for ignore in channel_family_is_proxy(channel_family_id_val) loop
+ delete from rhnProxyInfo where server_id = server_id_in;
+ end loop;
+
+ DELETE FROM rhnChannelFamilyLicenseConsent
+ WHERE channel_family_id = channel_family_id_val
+ AND server_id = server_id_in;
+
+ SELECT org_id INTO server_org_id_val
+ FROM rhnServer
+ WHERE id = server_id_in;
+
+ rhn_channel.update_family_counts(channel_family_id_val, server_org_id_val);
+ END unsubscribe_server;
+
+ PROCEDURE bulk_unsubscribe_server(channel_id_in IN NUMBER, set_label_in IN VARCHAR2, set_uid_in IN NUMBER)
+ IS
+ BEGIN
+ FOR server IN rhn_set.set_iterator(set_label_in, set_uid_in)
+ LOOP
+ rhn_channel.unsubscribe_server(server.element, channel_id_in, 0);
+ END LOOP server;
+ END bulk_unsubscribe_server;
+
+ FUNCTION family_for_channel(channel_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN channel_family_id_val;
+ EXCEPTION
+ WHEN NO_DATA_FOUND
+ THEN
+ RETURN NULL;
+ END family_for_channel;
+
+ FUNCTION available_family_subscriptions(channel_family_id_in IN NUMBER, org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ cfp channel_family_perm_cursor%ROWTYPE;
+ current_members_val NUMBER;
+ max_members_val NUMBER;
+ found NUMBER;
+ BEGIN
+ IF NOT channel_family_perm_cursor%ISOPEN
+ THEN
+ OPEN channel_family_perm_cursor(channel_family_id_in, org_id_in);
+ END IF;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+
+ WHILE channel_family_perm_cursor%FOUND
+ LOOP
+ found := 1;
+
+ current_members_val := cfp.current_members;
+ max_members_val := cfp.max_members;
+
+ FETCH channel_family_perm_cursor INTO cfp;
+ END LOOP;
+
+ IF channel_family_perm_cursor%ISOPEN
+ THEN
+ CLOSE channel_family_perm_cursor;
+ END IF;
+
+ -- not found: either the channel fam doesn't have an entry in cfp, or the org doesn't have access to it.
+ -- either way, there are no available subscriptions
+
+ IF found IS NULL
+ THEN
+ RETURN 0;
+ END IF;
+
+ -- null max members? in that case, pass it on; NULL means infinite
+ IF max_members_val IS NULL
+ THEN
+ RETURN NULL;
+ END IF;
+
+ -- otherwise, return the delta
+ RETURN max_members_val - current_members_val;
+ END available_family_subscriptions;
+
+ -- *******************************************************************
+ -- FUNCTION: channel_family_current_members
+ -- Calculates and returns the actual count of systems consuming
+ -- physical channel subscriptions.
+ -- Called by: update_family_counts
+ -- rhn_entitlements.repoll_virt_guest_entitlements
+ -- *******************************************************************
+ function channel_family_current_members(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ return number
+ is
+ current_members_count number := 0;
+ begin
+ select count(sc.server_id)
+ into current_members_count
+ from rhnChannelFamilyMembers cfm,
+ rhnServerChannel sc,
+ rhnServer s
+ where s.org_id = org_id_in
+ and s.id = sc.server_id
+ and cfm.channel_family_id = channel_family_id_in
+ and cfm.channel_id = sc.channel_id
+ and exists (
+ select 1
+ from rhnChannelFamilyServerPhysical cfsp
+ where cfsp.CHANNEL_FAMILY_ID = channel_family_id_in
+ and cfsp.server_id = s.id
+ );
+
+ return current_members_count;
+ end;
+
+ PROCEDURE update_family_counts(channel_family_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ IS
+ BEGIN
+ update rhnPrivateChannelFamily
+ set current_members = (
+ channel_family_current_members(channel_family_id_in, org_id_in)
+ )
+ where org_id = org_id_in
+ and channel_family_id = channel_family_id_in;
+ END update_family_counts;
+
+ FUNCTION available_chan_subscriptions(channel_id_in IN NUMBER,
+ org_id_in IN NUMBER)
+ RETURN NUMBER
+ IS
+ channel_family_id_val NUMBER;
+ BEGIN
+ SELECT channel_family_id INTO channel_family_id_val
+ FROM rhnChannelFamilyMembers
+ WHERE channel_id = channel_id_in;
+
+ RETURN rhn_channel.available_family_subscriptions(
+ channel_family_id_val, org_id_in);
+ END available_chan_subscriptions;
+
+ -- *******************************************************************
+ -- PROCEDURE: entitle_customer
+ -- Creates a chan fam bucket, or sets max_members for an existing bucket
+ -- Called by: rhn_ep.poll_customer_internal
+ -- Calls: set_family_maxmembers + update_family_counts if the row
+ -- already exists, else it creates it in rhnPrivateChannelFamily.
+ -- *******************************************************************
+ procedure entitle_customer(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor permissions is
+ select 1
+ from rhnPrivateChannelFamily pcf
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ begin
+ for perm in permissions loop
+ set_family_maxmembers(
+ customer_id_in,
+ channel_family_id_in,
+ quantity_in
+ );
+ rhn_channel.update_family_counts(
+ channel_family_id_in,
+ customer_id_in
+ );
+ return;
+ end loop;
+
+ insert into rhnPrivateChannelFamily pcf (
+ channel_family_id, org_id, max_members, current_members
+ ) values (
+ channel_family_id_in, customer_id_in, quantity_in, 0
+ );
+ end;
+
+ -- *******************************************************************
+ -- PROCEDURE: set_family_maxmembers
+ -- Prunes an existing channel family bucket by unsubscribing the
+ -- necessary servers and sets max_members.
+ -- Called by: rhn_channel.entitle_customer
+ -- Calls: unsubscribe_server_from_family
+ -- *******************************************************************
+ procedure set_family_maxmembers(customer_id_in in number,
+ channel_family_id_in in number,
+ quantity_in in number)
+ is
+ cursor servers is
+ select server_id from (
+ select rownum row_number, server_id, modified from (
+ select rcfsp.server_id,
+ rcfsp.modified
+ from rhnChannelFamilyServerPhysical rcfsp
+ where rcfsp.customer_id = customer_id_in
+ and rcfsp.channel_family_id = channel_family_id_in
+ order by modified
+ )
+ where rownum > quantity_in
+ );
+ begin
+ -- prune subscribed servers
+ for server in servers loop
+ rhn_channel.unsubscribe_server_from_family(server.server_id,
+ channel_family_id_in);
+ end loop;
+
+ update rhnPrivateChannelFamily pcf
+ set pcf.max_members = quantity_in
+ where pcf.org_id = customer_id_in
+ and pcf.channel_family_id = channel_family_id_in;
+ end;
+
+ procedure unsubscribe_server_from_family(server_id_in in number,
+ channel_family_id_in in number)
+ is
+ begin
+ delete
+ from rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and channel_id in (
+ select rcfm.channel_id
+ from rhnChannelFamilyMembers rcfm
+ where rcfm.channel_family_id = channel_family_id_in);
+ end;
+
+ function get_org_id(channel_id_in in number)
+ return number
+ is
+ org_id_out number;
+ begin
+ select org_id into org_id_out
+ from rhnChannel
+ where id = channel_id_in;
+
+ return org_id_out;
+ end get_org_id;
+
+ function get_cfam_org_access(cfam_id_in in number, org_id_in in number)
+ return number
+ is
+ cursor families is
+ select 1
+ from rhnOrgChannelFamilyPermissions cfp
+ where cfp.org_id = org_id_in;
+ begin
+ -- the idea: if we get past this query,
+ -- the user has the role, else catch the exception and return 0
+ for family in families loop
+ return 1;
+ end loop;
+ return 0;
+ end;
+
+ function get_org_access(channel_id_in in number, org_id_in in number)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query,
+ -- the org has access to the channel, else catch the exception and return 0
+ select distinct 1 into throwaway
+ from rhnChannelFamilyMembers CFM,
+ rhnOrgChannelFamilyPermissions CFP
+ where cfp.org_id = org_id_in
+ and CFM.channel_family_id = CFP.channel_family_id
+ and CFM.channel_id = channel_id_in
+ and (CFP.max_members > 0 or CFP.max_members is null or CFP.org_id = 1);
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if a user has a given role, or if such a role is inferrable
+ function user_role_check_debug(channel_id_in in number,
+ user_id_in in number,
+ role_in in varchar2,
+ reason_out out varchar2)
+ return number
+ is
+ org_id number;
+ begin
+ org_id := rhn_user.get_org_id(user_id_in);
+
+ -- channel might be shared
+ if role_in = 'subscribe' and
+ rhn_channel.shared_user_role_check(channel_id_in, user_id_in, role_in) = 1 then
+ return 1;
+ end if;
+
+ if role_in = 'manage' and
+ NVL(rhn_channel.get_org_id(channel_id_in), -1) <> org_id then
+ reason_out := 'channel_not_owned';
+ return 0;
+ end if;
+
+ if role_in = 'subscribe' and
+ rhn_channel.get_org_access(channel_id_in, org_id) = 0 then
+ reason_out := 'channel_not_available';
+ return 0;
+ end if;
+
+ -- channel admins have all roles
+ if rhn_user.check_role_implied(user_id_in, 'channel_admin') = 1 then
+ reason_out := 'channel_admin';
+ return 1;
+ end if;
+
+ -- the subscribe permission is inferred
+ -- UNLESS the not_globally_subscribable flag is set
+ if role_in = 'subscribe'
+ then
+ if rhn_channel.org_channel_setting(channel_id_in,
+ org_id,
+ 'not_globally_subscribable') = 0 then
+ reason_out := 'globally_subscribable';
+ return 1;
+ end if;
+ end if;
+
+ -- all other roles (manage right now) are explicitly granted
+ reason_out := 'direct_permission';
+ return rhn_channel.direct_user_role_check(channel_id_in,
+ user_id_in, role_in);
+ end;
+
+ -- same as above, but with no OUT param; useful in views, etc
+ function user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway varchar2(256);
+ begin
+ return rhn_channel.user_role_check_debug(channel_id_in, user_id_in, role_in, throwaway);
+ end;
+
+ --
+ -- For multiorg phase II, this function simply checks to see if the user's
+ -- has a trust relationship that includes this channel by id.
+ --
+ function shared_user_role_check(channel_id in number, user_id in number, role in varchar2)
+ return number
+ is
+ n number;
+ oid number;
+ begin
+ oid := rhn_user.get_org_id(user_id);
+ select 1 into n
+ from rhnSharedChannelView s
+ where s.id = channel_id and s.org_trust_id = oid;
+ return 1;
+ exception
+ when no_data_found then
+ return 0;
+ end;
+
+ -- same as above, but returns 1 if user_id_in is null
+ -- This is useful in queries where user_id is not specified
+ function loose_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ begin
+ if user_id_in is null then
+ return 1;
+ end if;
+ return user_role_check(channel_id_in, user_id_in, role_in);
+ end loose_user_role_check;
+
+ -- directly checks the table, no inferred permissions
+ function direct_user_role_check(channel_id_in in number, user_id_in in number, role_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the user has the role, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnChannelPermissionRole CPR,
+ rhnChannelPermission CP
+ where CP.user_id = user_id_in
+ and CP.channel_id = channel_id_in
+ and CPR.label = role_in
+ and CP.role_id = CPR.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ -- check if an org has a certain setting
+ function org_channel_setting(channel_id_in in number, org_id_in in number, setting_in in varchar2)
+ return number
+ is
+ throwaway number;
+ begin
+ -- the idea: if we get past this query, the org has the setting, else catch the exception and return 0
+ select 1 into throwaway
+ from rhnOrgChannelSettingsType OCST,
+ rhnOrgChannelSettings OCS
+ where OCS.org_id = org_id_in
+ and OCS.channel_id = channel_id_in
+ and OCST.label = setting_in
+ and OCS.setting_id = OCST.id;
+
+ return 1;
+ exception
+ when no_data_found
+ then
+ return 0;
+ end;
+
+ FUNCTION channel_priority(channel_id_in IN number)
+ RETURN number
+ IS
+ channel_name varchar2(64);
+ priority number;
+ end_of_life_val date;
+ org_id_val number;
+ BEGIN
+
+ select name, end_of_life, org_id
+ into channel_name, end_of_life_val, org_id_val
+ from rhnChannel
+ where id = channel_id_in;
+
+ if end_of_life_val is not null then
+ return -400;
+ end if;
+
+ if channel_name like 'Red Hat Enterprise Linux%' or channel_name like 'RHEL%' then
+ priority := 1000;
+ if channel_name not like '%Beta%' then
+ priority := priority + 1000;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 5%' then 600
+ when channel_name like '%v. 4%' then 500
+ when channel_name like '%v. 3%' then 400
+ when channel_name like '%v. 2%' then 300
+ when channel_name like '%v. 1%' then 200
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like 'Red Hat Enterprise Linux (v. 5%' then 60
+ when (channel_name like '%AS%' and channel_name not like '%Extras%') then 50
+ when (channel_name like '%ES%' and channel_name not like '%Extras%') then 40
+ when (channel_name like '%WS%' and channel_name not like '%Extras%') then 30
+ when (channel_name like '%Desktop%' and channel_name not like '%Extras%') then 20
+ when channel_name like '%Extras%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%)' then 5
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+ elsif channel_name like 'Red Hat Desktop%' then
+ priority := 900;
+
+ if channel_name not like '%Beta%' then
+ priority := priority + 50;
+ end if;
+
+ priority := priority +
+ case
+ when channel_name like '%v. 4%' then 40
+ when channel_name like '%v. 3%' then 30
+ when channel_name like '%v. 2%' then 20
+ when channel_name like '%v. 1%' then 10
+ else 0
+ end;
+
+ priority := priority +
+ case
+ when channel_name like '%32-bit x86%' then 4
+ when channel_name like '%64-bit Intel Itanium%' then 3
+ when channel_name like '%64-bit AMD64/Intel EM64T%' then 2
+ else 0
+ end;
+
+ elsif org_id_val is not null then
+ priority := 600;
+ else
+ priority := 500;
+ end if;
+
+ return -priority;
+
+ end channel_priority;
+
+ -- right now this only does the accounting changes; the cascade
+ -- actually does the rhnServerChannel delete.
+ procedure delete_server_channels(server_id_in in number)
+ is
+ begin
+ update rhnPrivateChannelFamily
+ set current_members = current_members -1
+ where org_id in (
+ select org_id
+ from rhnServer
+ where id = server_id_in
+ )
+ and channel_family_id in (
+ select rcfm.channel_family_id
+ from rhnChannelFamilyMembers rcfm,
+ rhnServerChannel rsc
+ where rsc.server_id = server_id_in
+ and rsc.channel_id = rcfm.channel_id
+ and not exists (
+ select 1
+ from
+ rhnChannelFamilyVirtSubLevel cfvsl,
+ rhnSGTypeVirtSubLevel sgtvsl,
+ rhnServerEntitlementView sev,
+ rhnVirtualInstance vi
+ where
+ -- system is a virtual instance
+ vi.virtual_system_id = server_id_in
+ and vi.host_system_id = sev.server_id
+ -- system's host has a virt ent
+ and sev.label in ('virtualization_host',
+ 'virtualization_host_platform')
+ and sev.server_group_type_id =
+ sgtvsl.server_group_type_id
+ -- the host's virt ent grants a cf virt sub level
+ and sgtvsl.virt_sub_level_id = cfvsl.virt_sub_level_id
+ -- the cf is in that virt sub level
+ and cfvsl.channel_family_id = rcfm.channel_family_id
+ )
+ );
+ end;
+
+ -- this could certainly be optimized to do updates if needs be
+ procedure refresh_newest_package(channel_id_in in number, caller_in in varchar2 := '(unknown)')
+ is
+ begin
+ delete from rhnChannelNewestPackage where channel_id = channel_id_in;
+ insert into rhnChannelNewestPackage
+ ( channel_id, name_id, evr_id, package_id, package_arch_id )
+ ( select channel_id,
+ name_id, evr_id,
+ package_id, package_arch_id
+ from rhnChannelNewestPackageView
+ where channel_id = channel_id_in
+ );
+ insert into rhnChannelNewestPackageAudit (channel_id, caller)
+ values (channel_id_in, caller_in);
+ update rhnChannel
+ set last_modified = greatest(sysdate, last_modified + 1/86400)
+ where id = channel_id_in;
+ end;
+
+ procedure update_channel ( channel_id_in in number, invalidate_ss in number := 0,
+ date_to_use in date := sysdate )
+ is
+
+ channel_last_modified date;
+ last_modified_value date;
+
+ cursor snapshots is
+ select snapshot_id id
+ from rhnSnapshotChannel
+ where channel_id = channel_id_in;
+
+ begin
+
+ select last_modified
+ into channel_last_modified
+ from rhnChannel
+ where id = channel_id_in;
+
+ last_modified_value := date_to_use;
+
+ if last_modified_value <= channel_last_modified then
+ last_modified_value := last_modified_value + 1/86400;
+ end if;
+
+ update rhnChannel set last_modified = last_modified_value
+ where id = channel_id_in;
+
+ if invalidate_ss = 1 then
+ for snapshot in snapshots loop
+ update rhnSnapshot
+ set invalid = lookup_snapshot_invalid_reason('channel_modified')
+ where id = snapshot.id;
+ end loop;
+ end if;
+
+ end update_channel;
+
+ procedure update_channels_by_package ( package_id_in in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelPackage
+ where package_id = package_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we want to invalidate the snapshot assocated with the channel when we
+ -- do this b/c we know we've added or removed or packages
+ rhn_channel.update_channel ( channel.channel_id, 1, date_to_use );
+ end loop;
+ end update_channels_by_package;
+
+
+ procedure update_channels_by_errata ( errata_id_in number, date_to_use in date := sysdate )
+ is
+
+ cursor channels is
+ select channel_id
+ from rhnChannelErrata
+ where errata_id = errata_id_in
+ order by channel_id;
+
+ begin
+ for channel in channels loop
+ -- we won't invalidate snapshots, b/c just changing the errata associated with
+ -- a channel shouldn't invalidate snapshots
+ rhn_channel.update_channel ( channel.channel_id, 0, date_to_use );
+ end loop;
+ end update_channels_by_errata;
+
+END rhn_channel;
+/
+SHOW ERRORS
+
+--
+-- Revision 1.75 2005/03/04 00:04:19 jslagle
+-- bz #147617
+-- Made Red Hat Desktop sort a little better.
+--
+-- Revision 1.74 2005/02/22 03:24:47 jslagle
+-- bz #147617
+-- Improve channel_priority function to order channels better.
+--
+-- Revision 1.73 2004/08/16 20:39:30 pjones
+-- bugzilla: 129889 -- make bulk_server_basechange_from() actually work.
+--
+-- Revision 1.72 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
+-- Revision 1.71 2004/04/13 16:28:36 bretm
+-- bugzilla: 119871
+--
+-- keep track of rhnServer.channels_changed through the pl/sql fns
+--
+-- Revision 1.70 2004/03/26 18:11:32 rbb
+-- Bugzilla: 114057
+--
+-- Add a script to determine channel priority.
+--
+-- Revision 1.69 2004/02/17 20:16:52 pjones
+-- bugzilla: none -- add cvs tags into the package as long as we're touching
+-- it anyway
+--
+-- Revision 1.68 2004/02/17 20:05:38 pjones
+-- bugzilla: 115782 -- make bulk_server_basechange_from() filter out servers
+-- with arches incompatible with the target channel
+--
+-- Revision 1.67 2004/02/06 02:36:10 misa
+-- Changed normalize_server_arch to allow for solaris arches
+--
+-- Revision 1.66 2003/11/13 16:58:34 cturner
+-- make use of new rhn_user.check_role_implied call; pragmas broke, removed them for now since I have no idea how to fix them
+--
+-- Revision 1.65 2003/10/23 20:26:24 bretm
+-- bugzilla: none
+--
+-- note the channel label when we unsubscribe, too
+--
+-- Revision 1.64 2003/10/15 14:47:17 bretm
+-- bugzilla: none
+--
+-- add the channel label to the server history summary line when we log a channel change
+--
+-- Revision 1.63 2003/09/24 19:25:56 pjones
+-- this wasn't the right fix, put it back
+--
+-- Revision 1.62 2003/09/24 17:42:19 pjones
+-- bugzilla: none
+--
+-- limit our server base channel guess to channels with available permissions
+--
+-- Revision 1.61 2003/09/22 21:00:40 cturner
+-- add method for easy acl check
+--
+-- Revision 1.60 2003/09/17 22:14:11 misa
+-- bugzilla: 103639 Changes to allow me to move the base channel guess into plsql
+--
+-- Revision 1.59 2003/08/21 13:41:17 cturner
+-- bugzilla: 99187. properly test for satellite and proxy in bulk_guess_server_base; reorg code for better reuse
+--
+-- Revision 1.58 2003/07/24 16:46:22 cturner
+-- bugzilla: 100723, the perm check was returning duplicates, so now it just calls the function it should have called anyway
+--
+-- Revision 1.57 2003/07/24 16:44:16 misa
+-- bugzilla: none A function more usable on the rhnapp side
+--
+-- Revision 1.56 2003/07/23 22:36:51 cturner
+-- argh, max returns null even when now rows; use distinct. how revolting
+--
+-- Revision 1.55 2003/07/23 22:01:31 cturner
+-- oops, this one can return multiple rows; eliminate that in a lazy way
+--
+-- Revision 1.54 2003/07/23 21:59:19 cturner
+-- rework how rhnUserChannel works; move to plsql for speed and maintenance
+--
+-- Revision 1.53 2003/07/21 17:49:12 pjones
+-- bugzilla: none
+--
+-- add optional user for subscribe_server
+--
+-- Revision 1.52 2003/07/14 22:19:29 misa
+-- bugzilla: none Updating guess_base_channel to work more like the rhnapp server code
+--
+-- Revision 1.51 2003/06/26 22:09:04 pjones
+-- bugzilla: none
+--
+-- log subscribe and unsubscribe
+--
+-- Revision 1.50 2003/06/05 19:31:15 pjones
+-- bugzilla: 88278 -- make the cursor name smaller
+--
+-- Revision 1.49 2003/06/05 19:18:21 pjones
+-- bugzilla: 88278
+--
+-- unsubscribe_server() opens the package-level cursor when it invokes itself,
+-- so we're using a local copy instead.
+--
+-- Revision 1.48 2003/06/04 16:41:39 pjones
+-- bugzilla: none
+--
+-- make bulk_guess_server_base() silently ignore unguessables
+--
+-- Revision 1.47 2003/06/04 16:27:03 pjones
+-- bugzilla: 88822
+--
+-- eliminate the last outliers that remove things from channels without using
+-- unsubscribe_server, I think.
+--
+-- Revision 1.46 2003/06/03 20:49:37 pjones
+-- bugzilla: 88822
+-- unsubscribing from rhn-satellite now clears rhnSatelliteChannelFamily
+-- for the server in question
+--
+-- Revision 1.45 2003/06/02 20:41:45 pjones
+-- bugzilla: none - fix rhnProxyInfo/rhnSatelliteInfo channel unsubscribe
+-- problem. Basicly, if you're out of the channel for any reason, you're
+-- also out of rhnProxyInfo/rhnProxyInfo
+--
+-- Revision 1.44 2003/03/24 15:26:28 pjones
+-- bugzilla: 85812
+--
+-- bulk_server_base_change silently ignores servers that are satellites
+-- or proxies, as requested.
+--
+-- Revision 1.43 2003/02/26 20:28:17 pjones
+-- rhn_channel.update_family_counts() in rhn_channel.entitle_customer()
+-- the old codepath is:
+--
+-- ep ->
+-- rhn_ep.entitlement_run_me() ->
+-- rhn_ep.poll_customer() ->
+-- rhn_channel.entitle_customer()
+--
+-- which doesn't change current_members, even though it may remove servers
+-- from the family.
+--
+-- There's another bug here: currently, we don't try to order forced
+-- unsubscribes in any way; we just use
+-- rhn_channel.unsubscribe_server_from_family . If there are any child
+-- channel subscriptions, this will leave them subscribed. We really need
+-- to iterate across the channels again, and subscribe any channel for which
+-- there are no parent channel subscriptions.
+--
+-- Ugh.
+--
+-- Revision 1.42 2003/01/28 00:19:45 pjones
+-- fix clear_subscriptions; AFAICT, this is only hit on the
+-- bulk_server_base_change / bulk_server_base_guess codepaths, which puts
+-- it infrequent enough that it could be our "bad count" culprit.
+--
+-- Revision 1.41 2003/01/14 19:51:45 pjones
+-- make setting current_members on rhnChannelFamilyPermissions work when
+-- a server is in more than one channel in a single family.
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/123-rhnServerActionVerify-chg-indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/123-rhnServerActionVerify-chg-indexes.sql
new file mode 100644
index 0000000..ef5efc2
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/123-rhnServerActionVerify-chg-indexes.sql
@@ -0,0 +1,42 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+drop index rhn_sactionvm_sanec_uq;
+create unique index rhn_sactionvm_sanec_uq
+ on rhnServerActionVerifyMissing(
+ server_id, action_id,
+ package_name_id, package_evr_id, package_arch_id,
+ package_capability_id )
+ tablespace [[4m_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+
+drop index rhn_sactionvr_sanec_uq;
+create unique index rhn_sactionvr_sanec_uq
+ on rhnServerActionVerifyResult(
+ server_id, action_id,
+ package_name_id, package_evr_id, package_arch_id,
+ package_capability_id )
+ tablespace [[4m_tbs]]
+ storage ( freelists 16 )
+ initrans 32;
+
+-- $Log$
+-- Revision 1 2008/11/03
+-- bugzilla: 456539 -- adding package_arch_id to indexes
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/130-delete_server.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/130-delete_server.sql
new file mode 100644
index 0000000..2f86807
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/130-delete_server.sql
@@ -0,0 +1,268 @@
+--
+-- 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.
+--
+--
+--
+-- This deletes a server. All codepaths which delete servers should hit this
+-- or delete_server_bulk()
+
+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 rhnChannelFamilyLicenseConsent 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 rhnSNPServerQueue where server_id = server_id_in;
+ delete from rhnSatelliteChannelFamily 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 rhnServerMessage where server_id = server_id_in;
+ -- this gets rhnServerMessage (only) on cascade; it's handled just above
+ 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 rhnServerNeededPackageCache where server_id = server_id_in;
+ delete from rhnServerNeededErrataCache 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 rhnTransaction 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 rhn_interface_monitoring 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);
+ 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;
+
+ -- 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;
+
+--
+-- Revision 1.25 2004/11/01 17:53:03 pjones
+-- bugzilla: 136124 -- Fix the "no data found" when deleting rhn_sat_cluster
+--
+--
+--
+--
+-- This deletes a list of server.
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/131-delete_server_bulk.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/131-delete_server_bulk.sql
new file mode 100644
index 0000000..0b96a0d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/131-delete_server_bulk.sql
@@ -0,0 +1,40 @@
+--
+-- 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.
+--
+--
+-- Revision 1.25 2004/11/01 17:53:03 pjones
+-- bugzilla: 136124 -- Fix the "no data found" when deleting rhn_sat_cluster
+--
+--
+--
+--
+-- This deletes a list of server.
+--
+
+create or replace
+procedure delete_server_bulk (
+ user_id_in in number
+) is
+ cursor systems is
+ select s.element id
+ from rhnSet s
+ where s.user_id = user_id_in
+ and s.label = 'system_list';
+begin
+ for s in systems loop
+ delete_server(s.id);
+ end loop;
+end delete_server_bulk;
+/
+show errors;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/132-rhnActionKickstartGuest-add-kshost.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/132-rhnActionKickstartGuest-add-kshost.sql
new file mode 100644
index 0000000..3bc6b1e
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/132-rhnActionKickstartGuest-add-kshost.sql
@@ -0,0 +1,35 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnActionKickstartGuest
+ ADD kickstart_host varchar2(256);
+
+ALTER TABLE rhnActionKickstartGuest
+ ADD disk_path varchar2(256);
+
+ALTER TABLE rhnActionKickstartGuest
+ ADD virt_bridge varchar2(256);
+
+ALTER TABLE rhnActionKickstartGuest
+ ADD cobbler_system_name varchar2(256);
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/10/29 7:01:05 mmccune
+-- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/133-rhnKickstartVirtualizationType-update.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/133-rhnKickstartVirtualizationType-update.sql
new file mode 100644
index 0000000..23fbe2e
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/133-rhnKickstartVirtualizationType-update.sql
@@ -0,0 +1,43 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+update rhnKickstartVirtualizationType
+ set label = 'xenpv' where label = 'para_guest';
+
+update rhnKickstartVirtualizationType
+ set label = 'auto' where label = 'none';
+
+update rhnKickstartVirtualizationType
+ set name = 'Auto' where label = 'auto';
+
+update rhnKickstartVirtualizationType
+ set name = 'XEN Para-Virtualized Guest' where label = 'xenpv';
+
+insert into rhnKickstartVirtualizationType (id, name, label)
+ values (rhn_kvt_id_seq.nextval, 'KVM Virtualized Guest', 'qemu');
+
+insert into rhnKickstartVirtualizationType (id, name, label)
+ values (rhn_kvt_id_seq.nextval, 'XEN Fully-Virtualized Guest', 'xenfv');
+
+commit;
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/10/29 7:01:05 mmccune
+-- add new kickstart_host for koan usage
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/135-rhn_config_macro_data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/135-rhn_config_macro_data.sql
new file mode 100644
index 0000000..af2da9d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/135-rhn_config_macro_data.sql
@@ -0,0 +1,9 @@
+
+update rhn_config_macro set definition='/usr/bin' where name='NPBIN';
+update rhn_config_macro set definition='/etc/nocpulse' where name='NPETC';
+update rhn_config_macro set definition='/var/lib/%{USER}' where name='NPHOME';
+update rhn_config_macro set definition='/var/log/%{USER}' where name='NPVAR';
+
+insert into rhn_config_macro(environment,name,definition,description,editable,last_update_user,last_update_date) values ( 'ALL', 'NPLIB', '/var/lib/%{USER}', 'Production user data directory', '0', 'system',sysdate);
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/136-rhn_config_parameter_data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/136-rhn_config_parameter_data.sql
new file mode 100644
index 0000000..7ff1df2
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/136-rhn_config_parameter_data.sql
@@ -0,0 +1,27 @@
+
+
+update rhn_config_parameter set value='/var/lib/notification/queue/ack_queue' where name='ack_queue_dir';
+update rhn_config_parameter set value='/var/lib/notification/queue/alert_queue' where name='alert_queue_dir';
+
+update rhn_config_parameter set value='/etc/notification' where group_name='notification' and name='config_dir';
+
+
+update rhn_config_parameter set value='%{NPLIB}/trapReceiver/config' where group_name='trapReceiver' and name='config';
+update rhn_config_parameter set value='%{NPLIB}/trapReceiver/mibs' where group_name='trapReceiver' and name='cust_mibdir';
+update rhn_config_parameter set value='%{NPLIB}/trapReceiver/traps' where group_name='trapReceiver' and name='trapdir';
+update rhn_config_parameter set value='%{NPLIB}/ProbeState' where group_name='ProbeFramework' and name='databaseDirectory';
+update rhn_config_parameter set value='%{NPLIB}/.gripes.gdbm' where group_name='queues' and name='gritchdb';
+update rhn_config_parameter set value='%{NPLIB}/queue' where group_name='queues' and name='queuedir';
+update rhn_config_parameter set value='%{NPLIB}/queue/snmp/LAST_SENT' where group_name='queues' and name='snmplast';
+update rhn_config_parameter set value='%{NPLIB}/commands/.gripes.gdbm' where group_name='CommandQueue' and name='gritchdb';
+update rhn_config_parameter set value='%{NPLIB}/commands/heartbeat' where group_name='CommandQueue' and name='heartbeatFile';
+update rhn_config_parameter set value='%{NPLIB}/commands/last_completed' where group_name='CommandQueue' and name='lastCompletedFile';
+update rhn_config_parameter set value='%{NPLIB}/commands/last_started' where group_name='CommandQueue' and name='lastStartedFile';
+update rhn_config_parameter set value='%{NPLIB}/last_state_push' where group_name='current_state' and name='last_success';
+update rhn_config_parameter set value='%{NPLIB}/events.frozen' where group_name='satellite' and name='eventsFile';
+update rhn_config_parameter set value='%{NPLIB}/.gripes-probe-code.gdbm' where group_name='satellite' and name='gritchdb';
+update rhn_config_parameter set value='%{NPLIB}/scheduler.xml' where group_name='satellite' and name='schedulerConfigFile';
+update rhn_config_parameter set value='%{NPLIB}/reload.please' where group_name='satellite' and name='schedulerReloadFlagFile';
+update rhn_config_parameter set value='%{NPLIB}/commands/execute_commands.log' where group_name='CommandQueue' and name='exelog';
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/137-rhnKickstartableTree.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/137-rhnKickstartableTree.sql
new file mode 100644
index 0000000..d28dc68
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/137-rhnKickstartableTree.sql
@@ -0,0 +1,32 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+
+ALTER TABLE rhnKickstartableTree
+ADD cobbler_id varchar2(64);
+
+ALTER TABLE rhnKickstartableTree
+ADD cobbler_xen_id varchar2(64);
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/12/02 16:51 jsherrill
+-- Add cobbler_id column
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/138-rhnRegTokenPackages.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/138-rhnRegTokenPackages.sql
new file mode 100644
index 0000000..3197cb3
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/138-rhnRegTokenPackages.sql
@@ -0,0 +1,48 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+ALTER TABLE rhnRegTokenPackages ADD id number;
+
+CREATE SEQUENCE rhn_reg_tok_pkg_id_seq;
+
+UPDATE rhnRegTokenPackages SET id = rhn_reg_tok_pkg_id_seq.nextval;
+
+ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_id_nn CHECK ("ID" IS NOT NULL);
+
+ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_id_pk primary key ( id );
+
+ALTER TABLE rhnRegTokenPackages ADD (arch_id number);
+
+ALTER TABLE rhnRegTokenPackages ADD CONSTRAINT rhn_reg_tok_pkg_aid_fk FOREIGN KEY (arch_id) REFERENCES rhnPackageArch (id) ON DELETE CASCADE;
+
+DROP index rhn_reg_tok_pkg_uq;
+
+create unique index rhn_reg_tok_pkg_uq
+ on rhnRegTokenPackages(id, token_id, name_id, arch_id)
+ tablespace [[4m_tbs]]
+ storage( freelists 16 )
+ initrans 32;
+
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/12/04 10:44 pkilambi
+-- Arch support for activation key based package installs
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/139-rhnKickstartableTrees.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/139-rhnKickstartableTrees.sql
new file mode 100644
index 0000000..c5ec44c
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/139-rhnKickstartableTrees.sql
@@ -0,0 +1,28 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+update rhnKickstartableTree set boot_image='spacewalk-koan';
+
+ALTER TABLE rhnKickstartableTree
+ MODIFY( boot_image varchar2(128) default('spacewalk-koan'));
+
+show errors
+-- $Log$
+-- Revision 1 2008/12/04 6:38 pkilambi
+-- Added support to create boot image...
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/140-rhnActionKickstart-drop-kstree_id.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/140-rhnActionKickstart-drop-kstree_id.sql
new file mode 100644
index 0000000..30fdc67
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/140-rhnActionKickstart-drop-kstree_id.sql
@@ -0,0 +1,28 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnActionKickstart
+DROP COLUMN kstree_id;
+
+
+show errors
+
+-- $Log$
+--
+-- Revision 1 2008/12/05 6:56:45 paji
+-- Removed the unused kstree_id column
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql
new file mode 100644
index 0000000..8364d46
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/141-rhnActionKickstartGuest-drop-kstree_id.sql
@@ -0,0 +1,28 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnActionKickstartGuest
+DROP COLUMN kstree_id;
+
+
+show errors
+
+-- $Log$
+--
+-- Revision 1 2008/12/05 6:56:45 paji
+-- Removed the unused kstree_id column
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/142-rhnSet-add-element3.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/142-rhnSet-add-element3.sql
new file mode 100644
index 0000000..f498b78
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/142-rhnSet-add-element3.sql
@@ -0,0 +1,26 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+alter table rhnSet add element_three NUMBER;
+alter table rhnSet drop constraint rhn_set_user_label_elem_unq drop index;
+alter table rhnSet add constraint rhn_set_user_label_elem_unq
+ unique(user_id, label, element, element_two, element_three);
+
+
+-- $Log$
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/143-rhnServerProfilePackage-add-arch.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/143-rhnServerProfilePackage-add-arch.sql
new file mode 100644
index 0000000..ceff184
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/143-rhnServerProfilePackage-add-arch.sql
@@ -0,0 +1,23 @@
+--
+-- 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.
+--
+--
+--
+--
+alter table rhnServerProfilePackage
+add package_arch_id number
+ constraint rhn_sprofile_package_fk
+ references rhnPackageArch(id);
+
+show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/144-rhnSharedChannelTreeView.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/144-rhnSharedChannelTreeView.sql
new file mode 100644
index 0000000..12ff3aa
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/144-rhnSharedChannelTreeView.sql
@@ -0,0 +1,66 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE VIEW RHNSHAREDCHANNELTREEVIEW
+(
+ ORG_ID,
+ ID,
+ DEPTH,
+ NAME,
+ PADDED_NAME,
+ CHANNEL_ARCH_ID,
+ LAST_MODIFIED,
+ LABEL,
+ PARENT_OR_SELF_LABEL,
+ PARENT_OR_SELF_ID,
+ END_OF_LIFE
+)
+AS
+SELECT * FROM (
+ SELECT
+ C.ORG_TRUST_ID AS ORG_ID,
+ C.ID,
+ 1 AS DEPTH,
+ C.NAME,
+ ' '||C.NAME AS PADDED_NAME,
+ C.CHANNEL_ARCH_ID,
+ C.LAST_MODIFIED,
+ C.LABEL,
+ C.LABEL AS PARENT_OR_SELF_LABEL,
+ C.ID AS PARENT_OR_SELF_ID,
+ C.END_OF_LIFE
+ FROM RHNSHAREDCHANNELVIEW C
+ WHERE C.PARENT_CHANNEL IS NULL
+ UNION
+ SELECT
+ C.ORG_TRUST_ID AS ORG_ID,
+ C.ID,
+ 2 AS DEPTH,
+ c.name,
+ ''||C.NAME AS PADDED_NAME,
+ C.CHANNEL_ARCH_ID,
+ C.LAST_MODIFIED,
+ C.LABEL,
+ C.LABEL AS PARENT_OR_SELF_LABEL,
+ C.ID AS PARENT_OR_SELF_ID,
+ C.END_OF_LIFE
+ FROM RHNSHAREDCHANNELVIEW PC,
+ RHNSHAREDCHANNELVIEW C
+ WHERE C.PARENT_CHANNEL = PC.ID
+) ORDER BY PARENT_OR_SELF_LABEL, PARENT_OR_SELF_ID;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/145-rhnAvailableChannels.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/145-rhnAvailableChannels.sql
new file mode 100644
index 0000000..bc1d6b0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/145-rhnAvailableChannels.sql
@@ -0,0 +1,85 @@
+--
+-- 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.
+--
+--
+--
+-- tricky view. it explodes to a full cartesian product when
+-- not queried via org_id, so DO NOT DO THAT :)
+
+create or replace view
+rhnAvailableChannels
+(
+ org_id,
+ channel_id,
+ channel_depth,
+ channel_name,
+ channel_arch_id,
+ padded_name,
+ current_members,
+ available_members,
+ last_modified,
+ channel_label,
+ parent_or_self_label,
+ parent_or_self_id
+)
+as
+SELECT
+ CT.org_id,
+ CT.id,
+ CT.depth,
+ CT.name,
+ CT.channel_arch_id,
+ CT.padded_name,
+ (SELECT COUNT(1)
+ FROM rhnServer S
+ INNER JOIN rhnServerChannel SC
+ ON SC.server_id = S.id
+ WHERE SC.channel_id = CT.id AND
+ S.org_id = CT.org_id),
+ rhn_channel.available_chan_subscriptions(CT.id, CT.org_id),
+ CT.last_modified,
+ CT.label,
+ CT.parent_or_self_label,
+ CT.parent_or_self_id
+FROM
+ rhnOrgChannelTreeView CT
+UNION
+SELECT
+ CT.org_id,
+ CT.id,
+ CT.depth,
+ CT.name,
+ CT.channel_arch_id,
+ CT.padded_name,
+ (SELECT COUNT(1)
+ FROM rhnServer S
+ INNER JOIN rhnServerChannel SC
+ ON SC.server_id = S.id
+ WHERE SC.channel_id = CT.id AND
+ S.org_id = CT.org_id),
+ NULL,
+ CT.last_modified,
+ CT.label,
+ CT.parent_or_self_label,
+ CT.parent_or_self_id
+FROM
+ rhnSharedChannelTreeView CT
+/
+
+--
+--
+-- Revision 1.17 2004/04/14 00:09:24 pjones
+-- bugzilla: 120761 -- split rhnChannelPermissions into two tables, eliminating
+-- a frequent full table scan
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/146-rhnKSData-add-type.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/146-rhnKSData-add-type.sql
new file mode 100644
index 0000000..6691a35
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/146-rhnKSData-add-type.sql
@@ -0,0 +1,37 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnKsData
+ADD ks_type varchar(8);
+
+UPDATE rhnKsData SET ks_type = 'wizard';
+
+ALTER TABLE rhnKsData
+MODIFY ks_type CONSTRAINT rhn_ks_type_nn NOT NULL;
+
+ALTER TABLE rhnKsData
+ADD CONSTRAINT rhn_ks_type_ck CHECK (ks_type in ('wizard', 'raw'));
+
+show errors
+
+-- $Log$
+-- Revision 2 2008/12/02 16:51:05.2 jsherrill
+-- Add cobbler_id column
+--
+-- Revision 1 2008/10/01 7:01:05 mmccune
+-- Removed the unused name column
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/150-rhn_org.pkb.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/150-rhn_org.pkb.sql
new file mode 100644
index 0000000..9ff624f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/150-rhn_org.pkb.sql
@@ -0,0 +1,321 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_org
+IS
+ body_version varchar2(100) := '';
+
+ FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
+ RETURN NUMBER
+ IS
+ server_group server_group_by_label%ROWTYPE;
+ BEGIN
+ OPEN server_group_by_label(org_id_in, group_label_in);
+ FETCH server_group_by_label INTO server_group;
+ CLOSE server_group_by_label;
+
+ RETURN server_group.id;
+ END find_server_group_by_type;
+
+ procedure delete_org (
+ org_id_in in number
+ )
+ is
+
+ cursor users is
+ select id
+ from web_contact
+ where org_id = org_id_in;
+
+ cursor servers(org_id_in in number) is
+ select id
+ from rhnServer
+ where org_id = org_id_in;
+
+ cursor config_channels is
+ select id
+ from rhnConfigChannel
+ where org_id = org_id_in;
+
+ begin
+
+ if org_id_in = 1 then
+ rhn_exception.raise_exception('cannot_delete_base_org');
+ end if;
+
+ -- Delete all users.
+ for u in users loop
+ rhn_org.delete_user(u.id, 1);
+ end loop;
+
+ -- Delete all servers.
+ for s in servers(org_id_in) loop
+ delete_server(s.id);
+ end loop;
+
+ -- Delete all config channels.
+ for c in config_channels loop
+ rhn_config.delete_channel(c.id);
+ end loop;
+
+ -- Give the org's entitlements back to the main org.
+ rhn_entitlements.remove_org_entitlements(org_id_in);
+
+ -- Clean up tables where we don't have a cascading delete.
+ delete from rhnChannel where org_id = org_id_in;
+ delete from rhnDailySummaryQueue where org_id = org_id_in;
+ delete from rhnOrgQuota where org_id = org_id_in;
+ delete from rhnOrgInfo where org_id = org_id_in;
+ delete from rhnFileList where org_id = org_id_in;
+ delete from rhnServerGroup where org_id = org_id_in;
+ delete from rhn_check_suites where customer_id = org_id_in;
+ delete from rhn_command_target where customer_id = org_id_in;
+ delete from rhn_contact_groups where customer_id = org_id_in;
+ delete from rhn_notification_formats where customer_id = org_id_in;
+ delete from rhn_probe where customer_id = org_id_in;
+ delete from rhn_redirects where customer_id = org_id_in;
+ delete from rhn_sat_cluster where customer_id = org_id_in;
+ delete from rhn_schedules where customer_id = org_id_in;
+
+ -- Delete the org.
+ delete from web_customer where id = org_id_in;
+
+ end delete_org;
+
+ procedure delete_user(user_id_in in number, deleting_org in number := 0) is
+ cursor is_admin is
+ select 1
+ from rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin';
+ cursor servergroups_needing_admins is
+ select usgp.server_group_id server_group_id
+ from rhnUserServerGroupPerms usgp
+ where 1=1
+ and usgp.user_id = user_id_in
+ and not exists (
+ select 1
+ from rhnUserServerGroupPerms sq_usgp
+ where 1=1
+ and sq_usgp.server_group_id = usgp.server_group_id
+ and sq_usgp.user_id != user_id_in
+ );
+ cursor messages is
+ select message_id id
+ from rhnUserMessage
+ where user_id = user_id_in;
+ users number;
+ our_org_id number;
+ other_users number;
+ other_org_admin number;
+ other_user_id number;
+ begin
+ select wc.org_id
+ into our_org_id
+ from web_contact wc
+ where id = user_id_in;
+
+ -- find any other users
+ begin
+ select id, 1
+ into other_user_id, other_users
+ from web_contact
+ where 1=1
+ and org_id = our_org_id
+ and id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ other_users := 0;
+ end;
+
+ -- now do org admin stuff
+ if other_users != 0 then
+ for ignore in is_admin loop
+ begin
+ select new_ugm.user_id
+ into other_org_admin
+ from rhnUserGroupMembers new_ugm,
+ rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin'
+ and ug.id = new_ugm.user_group_id
+ and new_ugm.user_id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ -- If we're deleting the org, we don't want to raise
+ -- the exception.
+ if deleting_org = 0 then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end if;
+ end;
+
+ for sg in servergroups_needing_admins loop
+ rhn_user.add_servergroup_perm(other_org_admin,
+ sg.server_group_id);
+ end loop;
+ end loop;
+ end if;
+
+ -- and now things for every user
+ for message in messages loop
+ delete
+ from rhnUserMessage
+ where user_id = user_id_in
+ and message_id = message.id;
+ begin
+ select 1
+ into users
+ from rhnUserMessage
+ where message_id = message.id
+ and rownum = 1;
+ delete
+ from rhnMessage
+ where id = message.id;
+ exception
+ when no_data_found then
+ null;
+ end;
+ end loop;
+ delete from rhn_command_queue_sessions where contact_id = user_id_in;
+ delete from rhn_contact_groups
+ where recid in (
+ select contact_group_id
+ from rhn_contact_group_members
+ where member_contact_method_id in (
+ select recid from rhn_contact_methods
+ where contact_id = user_id_in
+ )
+ )
+ and not exists (
+ select 1
+ from rhn_contact_group_members, rhn_contact_methods
+ where rhn_contact_groups.recid = rhn_contact_group_members.contact_group_id
+ and rhn_contact_group_members.member_contact_method_id = rhn_contact_methods.recid
+ and rhn_contact_methods.contact_id <> user_id_in
+ );
+ delete from rhn_contact_methods where contact_id = user_id_in;
+ delete from rhn_redirects where contact_id = user_id_in;
+ delete from rhnUserServerPerms where user_id = user_id_in;
+ delete from rhnAppInstallSession where user_id = user_id_in;
+ if other_users != 0 then
+ update rhnRegToken
+ set user_id = nvl(other_org_admin, other_user_id)
+ where org_id = our_org_id
+ and user_id = user_id_in;
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ -- Just Delete the user
+ else
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ end if;
+ return;
+ end delete_user;
+
+END rhn_org;
+/
+SHOW ERRORS
+
+--
+-- Revision 1.22 2004/10/29 04:50:49 pjones
+-- bugzilla: 135179 -- fix org admin swapping during user deletion
+--
+-- Revision 1.21 2004/07/13 22:46:04 pjones
+-- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
+--
+-- Revision 1.20 2004/07/02 22:24:38 pjones
+-- bugzilla: none -- typo fix
+--
+-- Revision 1.19 2004/07/02 19:19:02 pjones
+-- bugzilla: 125937 -- use rhn_user to grant roles to users
+--
+-- Revision 1.18 2004/05/28 22:21:36 pjones
+-- bugzilla: none -- update for monitoring schema
+--
+-- Revision 1.17 2004/04/05 16:31:07 pjones
+-- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
+-- has a cascade problem
+--
+-- Revision 1.16 2004/03/15 17:10:28 pjones
+-- bugzilla: 118244 -- delete servers explicitly while deleting lone users
+--
+-- Revision 1.15 2004/02/09 17:14:54 pjones
+-- bugzilla: none -- fix log garbage
+--
+-- Revision 1.14 2004/01/22 19:44:42 pjones
+-- bugzilla: 106562 -- fix exceptions on delete_user()
+--
+-- Revision 1.13 2004/01/20 17:00:48 pjones
+-- bugzilla: none -- try to make delete_user() succeed when there are
+-- server groups that have been snapshotted
+--
+-- Revision 1.12 2004/01/14 20:22:03 pjones
+-- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
+--
+-- Revision 1.11 2003/03/20 17:08:16 pjones
+-- avoid the server group members trigger that updates last_modified; it'll
+-- cause a mutating table error
+--
+-- Revision 1.10 2003/03/17 16:31:25 pjones
+-- use "on delete set null" where applicable
+--
+-- Revision 1.9 2003/03/15 00:31:07 pjones
+-- bugzilla: none
+--
+-- tested wrong table for perms on a server group
+--
+-- Revision 1.8 2003/03/15 00:23:36 pjones
+-- bugzilla: 83631
+--
+-- working delete_user
+--
+-- Revision 1.7 2003/03/03 23:39:36 pjones
+-- different delete_user; this one might actually work.
+--
+-- Takes about 18 seconds, which seems kindof slow, but isn't
+-- intolerable I don't think...
+--
+-- Revision 1.6 2003/03/02 18:07:00 pjones
+-- make it use marty's test instead of is_satellite(); in the sat env,
+-- marty's test _is_ is_satellite()
+--
+-- Revision 1.5 2003/02/18 16:35:45 pjones
+-- delete_user
+--
+-- Revision 1.4 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/151-rhnServer-add-cobbler_id.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/151-rhnServer-add-cobbler_id.sql
new file mode 100644
index 0000000..9cf7869
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/151-rhnServer-add-cobbler_id.sql
@@ -0,0 +1,29 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+
+ALTER TABLE rhnServer
+ADD cobbler_id varchar(64);
+
+show errors
+
+-- $Log$
+-- Revision 1 2009/01/06 16:51 mmccune
+-- Add cobbler_id column
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/152-rhnKSInstallType-add-generic.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/152-rhnKSInstallType-add-generic.sql
new file mode 100644
index 0000000..122afec
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/152-rhnKSInstallType-add-generic.sql
@@ -0,0 +1,39 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+insert into rhnKSInstallType (id, label, name)
+ values (rhn_ksinstalltype_id_seq.nextval,
+ 'fedora_8','Fedora 8'
+ );
+
+insert into rhnKSInstallType (id, label, name)
+ values (rhn_ksinstalltype_id_seq.nextval,
+ 'fedora_10','Fedora 10'
+ );
+
+insert into rhnKSInstallType (id, label, name)
+ values (rhn_ksinstalltype_id_seq.nextval,
+ 'generic_rpm','Generic RPM'
+ );
+
+show errors
+
+-- $Log$
+-- Revision 1 2009/01/06 16:51 mmccune
+-- Add cobbler_id column
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/153-rhnErrata-increase-advisory.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/153-rhnErrata-increase-advisory.sql
new file mode 100644
index 0000000..93b6ec2
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/153-rhnErrata-increase-advisory.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnErrata MODIFY advisory varchar2(37);
+show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/154-rhnErrataTmp-increase-advisory.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/154-rhnErrataTmp-increase-advisory.sql
new file mode 100644
index 0000000..45ee43f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/154-rhnErrataTmp-increase-advisory.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnErrataTmp MODIFY advisory varchar2(37);
+show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/155-rhnPackageCapability-increase-name.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/155-rhnPackageCapability-increase-name.sql
new file mode 100644
index 0000000..683e09a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/155-rhnPackageCapability-increase-name.sql
@@ -0,0 +1,20 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+ALTER TABLE rhnPackageCapability MODIFY name varchar2(4000);
+show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/156-rhnPackage-compat-number.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/156-rhnPackage-compat-number.sql
new file mode 100644
index 0000000..3cdd093
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4/156-rhnPackage-compat-number.sql
@@ -0,0 +1,23 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+alter TABLE rhnPackage add (compat_new number(1) default 0);
+update rhnPackage set compat_new = compat;
+alter TABLE rhnPackage drop column compat;
+alter TABLE rhnPackage rename column compat_new to compat;
+show errors
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/100-errata-cache.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/100-errata-cache.sql
new file mode 100644
index 0000000..e14f723
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/100-errata-cache.sql
@@ -0,0 +1,433 @@
+
+
+drop index rhn_snec_eid_sid_idx;
+drop index rhn_snec_sid_eid_idx;
+drop index rhn_snec_oid_eid_sid_idx;
+drop table rhnServerNeededErrataCache;
+
+
+/* Remove org id, we don't need it */
+ALTER TABLE rhnServerNeededPackageCache DROP CONSTRAINT rhn_sncp_oid_nn;
+ALTER TABLE rhnServerNeededPackageCache DROP CONSTRAINT rhn_sncp_oid_fk;
+drop index rhn_snpc_oid_idx;
+alter table rhnServerNeededPackageCache drop column org_id;
+
+/* drop old indexes */
+drop index rhn_snpc_pid_idx;
+drop index rhn_snpc_sid_idx;
+drop index rhn_snpc_eid_idx;
+
+
+/* rename table */
+alter table
+ rhnServerNeededPackageCache
+ rename to
+ rhnServerNeededCache;
+
+
+/* create new indexes */
+create index rhn_snc_pid_idx
+ on rhnServerNeededCache(package_id)
+ parallel
+ tablespace [[128m_tbs]]
+ nologging;
+
+create index rhn_snc_sid_idx
+ on rhnServerNeededCache(server_id)
+ parallel
+ tablespace [[128m_tbs]]
+ nologging;
+
+create index rhn_snc_eid_idx
+ on rhnServerNeededCache(errata_id)
+ parallel
+ tablespace [[128m_tbs]]
+ nologging;
+
+
+create index rhn_snc_speid_idx
+ on rhnServerNeededCache(server_id, package_id, errata_id)
+ parallel
+ tablespace [[128m_tbs]]
+ nologging;
+
+
+
+create or replace view
+rhnServerNeededPackageCache
+(
+ server_id,
+ package_id,
+ errata_id
+)
+as
+select
+ server_id,
+ package_id,
+ max(errata_id) as errata_id
+ from rhnServerNeededCache
+ group by server_id, package_id;
+
+
+create or replace view
+rhnServerNeededErrataCache
+(
+ server_id,
+ errata_id
+)
+as
+select
+ distinct server_id, errata_id
+ from rhnServerNeededCache;
+
+
+CREATE OR REPLACE VIEW
+rhnServerNeededView
+(
+ org_id,
+ server_id,
+ errata_id,
+ package_id,
+ package_name_id
+)
+AS
+SELECT distinct S.org_id,
+ S.id,
+ PE.errata_id,
+ P.id,
+ P.name_id
+FROM
+ rhnPackage P,
+ rhnServerPackageArchCompat SPAC,
+ rhnPackageEVR P_EVR,
+ rhnPackageEVR SP_EVR,
+ rhnServerPackage SP,
+ rhnChannelPackage CP,
+ rhnServerChannel SC,
+ rhnServer S,
+ rhnErrataPackage PE,
+ rhnChannelErrata EC
+WHERE
+ SC.server_id = S.id
+ AND SC.channel_id = CP.channel_id
+ AND CP.package_id = P.id
+ AND P.id = PE.package_id
+ AND PE.errata_id = EC.errata_id
+ AND EC.channel_id = SC.channel_id
+ AND p.package_arch_id = spac.package_arch_id
+ AND spac.server_arch_id = s.server_arch_id
+ AND SP_EVR.id = SP.evr_id
+ AND P_EVR.id = P.evr_id
+ AND SP.server_id = S.id
+ AND SP.name_id = P.name_id
+ AND SP.evr_id != P.evr_id
+ AND SP_EVR.evr < P_EVR.evr
+ AND SP_EVR.evr = (SELECT MAX(PE.evr) FROM rhnServerPackage SP2, rhnPackageEvr PE WHERE PE.id = SP2.evr_id AND SP2.server_id = SP.server_id AND SP2.name_id = SP.name_id)
+ UNION
+SELECT distinct S.org_id,
+ S.id,
+ NULL as errata_id,
+ P.id,
+ P.name_id
+FROM
+ rhnPackage P,
+ rhnServerPackageArchCompat SPAC,
+ rhnPackageEVR P_EVR,
+ rhnPackageEVR SP_EVR,
+ rhnServerPackage SP,
+ rhnChannelPackage CP,
+ rhnServerChannel SC,
+ rhnServer S
+WHERE
+ SC.server_id = S.id
+ AND SC.channel_id = CP.channel_id
+ AND CP.package_id = P.id
+ AND P.id not in
+ ( select EP.package_id
+ from rhnErrataPackage EP inner join
+ rhnChannelErrata EC on EP.errata_id = EC.errata_id
+ where EC.channel_id = SC.channel_id)
+ AND p.package_arch_id = spac.package_arch_id
+ AND spac.server_arch_id = s.server_arch_id
+ AND SP_EVR.id = SP.evr_id
+ AND P_EVR.id = P.evr_id
+ AND SP.server_id = S.id
+ AND SP.name_id = P.name_id
+ AND SP.evr_id != P.evr_id
+ AND SP_EVR.evr < P_EVR.evr
+ AND SP_EVR.evr = (SELECT MAX(PE.evr) FROM rhnServerPackage SP2, rhnPackageEvr PE WHERE PE.id = SP2.evr_id AND SP2.server_id = SP.server_id AND SP2.name_id = SP.name_id);
+
+
+
+CREATE OR REPLACE VIEW rhnServerErrataTypeView
+(
+ server_id,
+ errata_id,
+ errata_type
+)
+AS
+SELECT
+ SNEC.server_id,
+ SNEC.errata_id,
+ E.advisory_type
+FROM rhnErrata E,
+ rhnServerNeededErrataCache SNEC
+WHERE E.id = SNEC.errata_id
+GROUP BY SNEC.server_id, SNEC.errata_id, E.advisory_type;
+
+
+CREATE OR REPLACE PROCEDURE
+queue_server(server_id_in IN NUMBER, immediate_in IN NUMBER := 1)
+IS
+ org_id_tmp NUMBER;
+BEGIN
+ IF immediate_in > 0
+ THEN
+ DELETE FROM rhnServerNeededCache WHERE server_id = server_id_in;
+ INSERT INTO rhnServerNeededCache
+ (SELECT server_id, errata_id, package_id
+ FROM rhnServerNeededView
+ WHERE server_id = server_id_in);
+
+ ELSE
+ SELECT org_id INTO org_id_tmp FROM rhnServer WHERE id = server_id_in;
+
+ INSERT
+ INTO rhnTaskQueue
+ (org_id, task_name, task_data)
+ VALUES (org_id_tmp,
+ 'update_server_errata_cache',
+ server_id_in);
+ END IF;
+END queue_server;
+
+/
+
+create or replace procedure
+delete_errata (
+ errata_id_in in number
+) is
+begin
+ delete from rhnServerNeededCache where errata_id = errata_id_in;
+ delete from rhnPaidErrataTempCache where errata_id = errata_id_in;
+ delete from rhnErrataFile where errata_id = errata_id_in;
+ delete from rhnErrataPackage where errata_id = errata_id_in;
+ delete from rhnErrata where id = errata_id_in;
+ delete from rhnErrataTmp where id = errata_id_in;
+end delete_errata;
+/
+
+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;
+ 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);
+ 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 rhnChannelFamilyLicenseConsent 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 rhnSNPServerQueue where server_id = server_id_in;
+ delete from rhnSatelliteChannelFamily 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 rhnServerMessage where server_id = server_id_in;
+ -- this gets rhnServerMessage (only) on cascade; it's handled just above
+ 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 rhnTransaction 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 rhn_interface_monitoring 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);
+ 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;
+
+ -- 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;
+/
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/150-rhnMultiorg-sharing.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/150-rhnMultiorg-sharing.sql
new file mode 100644
index 0000000..11bb033
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/150-rhnMultiorg-sharing.sql
@@ -0,0 +1,88 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+ALTER TABLE rhnPackageChangeLog
+ DROP constraint rhn_pkg_changelog_pid_fk;
+
+ALTER TABLE rhnPackageChangeLog
+ ADD constraint rhn_pkg_changelog_pid_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnPackageFile
+ DROP constraint rhn_package_file_pid_fk;
+
+ALTER TABLE rhnPackageFile
+ ADD constraint rhn_package_file_pid_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnPackageObsoletes
+ DROP constraint rhn_pkg_obsoletes_package_fk;
+
+ALTER TABLE rhnPackageObsoletes
+ ADD constraint rhn_pkg_obsoletes_package_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnPackageConflicts
+ DROP constraint rhn_pkg_conflicts_package_fk;
+
+ALTER TABLE rhnPackageConflicts
+ ADD constraint rhn_pkg_conflicts_package_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnPackageProvides
+ DROP constraint rhn_pkg_provides_package_fk;
+
+ALTER TABLE rhnPackageProvides
+ ADD constraint rhn_pkg_provides_package_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnPackageRequires
+ DROP constraint rhn_pkg_requires_package_fk;
+
+ALTER TABLE rhnPackageRequires
+ ADD constraint rhn_pkg_requires_package_fk
+ foreign key (package_id)
+ references rhnPackage (id)
+ on delete cascade;
+
+ALTER TABLE rhnSystemMigrations
+ DROP constraint rhn_sys_mig_oidto_fk;
+
+ALTER TABLE rhnSystemMigrations
+ ADD constraint rhn_sys_mig_oidto_fk
+ foreign key (org_id_to)
+ references web_customer (id)
+ on delete set null;
+
+ALTER TABLE rhnSystemMigrations
+ DROP constraint rhn_sys_mig_oidfrm_fk;
+
+ALTER TABLE rhnSystemMigrations
+ ADD constraint rhn_sys_mig_oidfrm_fk
+ foreign key (org_id_from)
+ references web_customer (id)
+ on delete set null;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/151-rhn_org.pkb.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/151-rhn_org.pkb.sql
new file mode 100644
index 0000000..93f6ec8
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/151-rhn_org.pkb.sql
@@ -0,0 +1,344 @@
+--
+-- Copyright (c) 2008 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+--
+--
+
+CREATE OR REPLACE
+PACKAGE BODY rhn_org
+IS
+ body_version varchar2(100) := '';
+
+ FUNCTION find_server_group_by_type(org_id_in NUMBER, group_label_in VARCHAR2)
+ RETURN NUMBER
+ IS
+ server_group server_group_by_label%ROWTYPE;
+ BEGIN
+ OPEN server_group_by_label(org_id_in, group_label_in);
+ FETCH server_group_by_label INTO server_group;
+ CLOSE server_group_by_label;
+
+ RETURN server_group.id;
+ END find_server_group_by_type;
+
+ procedure delete_org (
+ org_id_in in number
+ )
+ is
+ cursor users is
+ select id
+ from web_contact
+ where org_id = org_id_in;
+
+ cursor servers(org_id_in in number) is
+ select id
+ from rhnServer
+ where org_id = org_id_in;
+
+ cursor config_channels is
+ select id
+ from rhnConfigChannel
+ where org_id = org_id_in;
+
+ cursor custom_channels is
+ select id
+ from rhnChannel
+ where org_id = org_id_in;
+
+ cursor errata is
+ select id
+ from rhnErrata
+ where org_id = org_id_in;
+
+ begin
+
+ if org_id_in = 1 then
+ rhn_exception.raise_exception('cannot_delete_base_org');
+ end if;
+
+ -- Delete all users.
+ for u in users loop
+ rhn_org.delete_user(u.id, 1);
+ end loop;
+
+ -- Delete all servers.
+ for s in servers(org_id_in) loop
+ delete_server(s.id);
+ end loop;
+
+ -- Delete all config channels.
+ for c in config_channels loop
+ rhn_config.delete_channel(c.id);
+ end loop;
+
+ -- Delete all custom channels.
+ for cc in custom_channels loop
+ delete from rhnServerChannel where channel_id = cc.id;
+ delete from rhnServerProfilePackage where server_profile_id in (
+ select id from rhnServerProfile where base_channel = cc.id
+ );
+ delete from rhnServerProfile where base_channel = cc.id;
+ end loop;
+
+ -- Delete all errata packages
+ for e in errata loop
+ delete from rhnErrataPackage where errata_id = e.id;
+ end loop;
+
+ -- Give the org's entitlements back to the main org.
+ rhn_entitlements.remove_org_entitlements(org_id_in);
+
+ -- Clean up tables where we don't have a cascading delete.
+ delete from rhnChannel where org_id = org_id_in;
+ delete from rhnDailySummaryQueue where org_id = org_id_in;
+ delete from rhnOrgQuota where org_id = org_id_in;
+ delete from rhnOrgInfo where org_id = org_id_in;
+ delete from rhnFileList where org_id = org_id_in;
+ delete from rhnServerGroup where org_id = org_id_in;
+ delete from rhn_check_suites where customer_id = org_id_in;
+ delete from rhn_command_target where customer_id = org_id_in;
+ delete from rhn_contact_groups where customer_id = org_id_in;
+ delete from rhn_notification_formats where customer_id = org_id_in;
+ delete from rhn_probe where customer_id = org_id_in;
+ delete from rhn_redirects where customer_id = org_id_in;
+ delete from rhn_sat_cluster where customer_id = org_id_in;
+ delete from rhn_schedules where customer_id = org_id_in;
+
+ -- Delete the org.
+ delete from web_customer where id = org_id_in;
+
+ end delete_org;
+
+ procedure delete_user(user_id_in in number, deleting_org in number := 0) is
+ cursor is_admin is
+ select 1
+ from rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin';
+ cursor servergroups_needing_admins is
+ select usgp.server_group_id server_group_id
+ from rhnUserServerGroupPerms usgp
+ where 1=1
+ and usgp.user_id = user_id_in
+ and not exists (
+ select 1
+ from rhnUserServerGroupPerms sq_usgp
+ where 1=1
+ and sq_usgp.server_group_id = usgp.server_group_id
+ and sq_usgp.user_id != user_id_in
+ );
+ cursor messages is
+ select message_id id
+ from rhnUserMessage
+ where user_id = user_id_in;
+ users number;
+ our_org_id number;
+ other_users number;
+ other_org_admin number;
+ other_user_id number;
+ begin
+ select wc.org_id
+ into our_org_id
+ from web_contact wc
+ where id = user_id_in;
+
+ -- find any other users
+ begin
+ select id, 1
+ into other_user_id, other_users
+ from web_contact
+ where 1=1
+ and org_id = our_org_id
+ and id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ other_users := 0;
+ end;
+
+ -- now do org admin stuff
+ if other_users != 0 then
+ for ignore in is_admin loop
+ begin
+ select new_ugm.user_id
+ into other_org_admin
+ from rhnUserGroupMembers new_ugm,
+ rhnUserGroupType ugt,
+ rhnUserGroup ug,
+ rhnUserGroupMembers ugm
+ where ugm.user_id = user_id_in
+ and ugm.user_group_id = ug.id
+ and ug.group_type = ugt.id
+ and ugt.label = 'org_admin'
+ and ug.id = new_ugm.user_group_id
+ and new_ugm.user_id != user_id_in
+ and rownum = 1;
+ exception
+ when no_data_found then
+ -- If we're deleting the org, we don't want to raise
+ -- the exception.
+ if deleting_org = 0 then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end if;
+ end;
+
+ for sg in servergroups_needing_admins loop
+ rhn_user.add_servergroup_perm(other_org_admin,
+ sg.server_group_id);
+ end loop;
+ end loop;
+ end if;
+
+ -- and now things for every user
+ for message in messages loop
+ delete
+ from rhnUserMessage
+ where user_id = user_id_in
+ and message_id = message.id;
+ begin
+ select 1
+ into users
+ from rhnUserMessage
+ where message_id = message.id
+ and rownum = 1;
+ delete
+ from rhnMessage
+ where id = message.id;
+ exception
+ when no_data_found then
+ null;
+ end;
+ end loop;
+ delete from rhn_command_queue_sessions where contact_id = user_id_in;
+ delete from rhn_contact_groups
+ where recid in (
+ select contact_group_id
+ from rhn_contact_group_members
+ where member_contact_method_id in (
+ select recid from rhn_contact_methods
+ where contact_id = user_id_in
+ )
+ )
+ and not exists (
+ select 1
+ from rhn_contact_group_members, rhn_contact_methods
+ where rhn_contact_groups.recid = rhn_contact_group_members.contact_group_id
+ and rhn_contact_group_members.member_contact_method_id = rhn_contact_methods.recid
+ and rhn_contact_methods.contact_id <> user_id_in
+ );
+ delete from rhn_contact_methods where contact_id = user_id_in;
+ delete from rhn_redirects where contact_id = user_id_in;
+ delete from rhnUserServerPerms where user_id = user_id_in;
+ delete from rhnAppInstallSession where user_id = user_id_in;
+ if other_users != 0 then
+ update rhnRegToken
+ set user_id = nvl(other_org_admin, other_user_id)
+ where org_id = our_org_id
+ and user_id = user_id_in;
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ -- Just Delete the user
+ else
+ begin
+ delete from web_contact where id = user_id_in;
+ exception
+ when others then
+ rhn_exception.raise_exception('cannot_delete_user');
+ end;
+ end if;
+ return;
+ end delete_user;
+
+END rhn_org;
+/
+SHOW ERRORS
+
+--
+-- Revision 1.22 2004/10/29 04:50:49 pjones
+-- bugzilla: 135179 -- fix org admin swapping during user deletion
+--
+-- Revision 1.21 2004/07/13 22:46:04 pjones
+-- bugzilla: 125938 -- nothing uses update_errata_cache() any more, remove it
+--
+-- Revision 1.20 2004/07/02 22:24:38 pjones
+-- bugzilla: none -- typo fix
+--
+-- Revision 1.19 2004/07/02 19:19:02 pjones
+-- bugzilla: 125937 -- use rhn_user to grant roles to users
+--
+-- Revision 1.18 2004/05/28 22:21:36 pjones
+-- bugzilla: none -- update for monitoring schema
+--
+-- Revision 1.17 2004/04/05 16:31:07 pjones
+-- bugzilla: 120032 -- raise "cannot_delete_user" if web_contact or web_customer
+-- has a cascade problem
+--
+-- Revision 1.16 2004/03/15 17:10:28 pjones
+-- bugzilla: 118244 -- delete servers explicitly while deleting lone users
+--
+-- Revision 1.15 2004/02/09 17:14:54 pjones
+-- bugzilla: none -- fix log garbage
+--
+-- Revision 1.14 2004/01/22 19:44:42 pjones
+-- bugzilla: 106562 -- fix exceptions on delete_user()
+--
+-- Revision 1.13 2004/01/20 17:00:48 pjones
+-- bugzilla: none -- try to make delete_user() succeed when there are
+-- server groups that have been snapshotted
+--
+-- Revision 1.12 2004/01/14 20:22:03 pjones
+-- bugzilla: 113344 -- no deleting from rhnServerGroup, use the api instead
+--
+-- Revision 1.11 2003/03/20 17:08:16 pjones
+-- avoid the server group members trigger that updates last_modified; it'll
+-- cause a mutating table error
+--
+-- Revision 1.10 2003/03/17 16:31:25 pjones
+-- use "on delete set null" where applicable
+--
+-- Revision 1.9 2003/03/15 00:31:07 pjones
+-- bugzilla: none
+--
+-- tested wrong table for perms on a server group
+--
+-- Revision 1.8 2003/03/15 00:23:36 pjones
+-- bugzilla: 83631
+--
+-- working delete_user
+--
+-- Revision 1.7 2003/03/03 23:39:36 pjones
+-- different delete_user; this one might actually work.
+--
+-- Takes about 18 seconds, which seems kindof slow, but isn't
+-- intolerable I don't think...
+--
+-- Revision 1.6 2003/03/02 18:07:00 pjones
+-- make it use marty's test instead of is_satellite(); in the sat env,
+-- marty's test _is_ is_satellite()
+--
+-- Revision 1.5 2003/02/18 16:35:45 pjones
+-- delete_user
+--
+-- Revision 1.4 2002/05/10 22:08:23 pjones
+-- id/log
+--
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/152-rhnSsmOperation.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/152-rhnSsmOperation.sql
new file mode 100644
index 0000000..f72a8e8
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/152-rhnSsmOperation.sql
@@ -0,0 +1,50 @@
+create table
+rhnSsmOperation
+(
+ id number
+ constraint rhn_ssmop_id_nn not null
+ constraint rhn_ssmop_id_pk primary key
+ using index tablespace [[4m_tbs]],
+ user_id number
+ constraint rhn_ssmop_user_nn not null
+ constraint rhn_ssmop_user_fk
+ references rhnUser(id)
+ on delete cascade,
+ description varchar2(256)
+ constraint rhn_ssmop_desc_nn not null,
+ status varchar2(32)
+ constraint rhn_ssmop_st_nn not null,
+ started date
+ constraint rhn_ssmop_strt_nn not null,
+ modified date default (sysdate)
+ constraint rhn_ssmop_mod_nn not null
+)
+;
+
+
+create sequence rhn_ss_op_seq;
+
+create or replace trigger
+rhn_ssmop_mod_trig
+before insert or update on rhnSsmOperation
+for each row
+begin
+ :new.modified := sysdate;
+end;
+/
+show errors
+
+create table
+rhnSsmOperationServer
+(
+ operation_id number
+ constraint rhn_ssmops_ssmop_fk
+ references rhnSsmOperation(id)
+ on delete cascade,
+ server_id number
+ constraint rhn_ssmops_ser_fk
+ references rhnServer(id)
+ on delete cascade
+)
+;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/153-rhnPackage-pathidx.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/153-rhnPackage-pathidx.sql
new file mode 100644
index 0000000..26b1c44
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/153-rhnPackage-pathidx.sql
@@ -0,0 +1,24 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+CREATE INDEX rhn_package_path_idx
+ON rhnPackage(id, path);
+
+
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/160-rhnSourceRPM.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/160-rhnSourceRPM.sql
new file mode 100644
index 0000000..daff06a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/160-rhnSourceRPM.sql
@@ -0,0 +1,13 @@
+--
+-- Double the package name from
+-- 128 -> 256 to resolve customer issue with custom
+-- package names.
+--
+
+ALTER TABLE rhnSourceRpm
+MODIFY
+ name VARCHAR2(256);
+
+ALTER TABLE rhnPackageName
+MODIFY
+ name VARCHAR2(256);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/161-rhnKickstartVirtualizationType-update.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/161-rhnKickstartVirtualizationType-update.sql
new file mode 100644
index 0000000..5322ea9
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/161-rhnKickstartVirtualizationType-update.sql
@@ -0,0 +1,44 @@
+--
+-- 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.
+--
+--
+-- $Id$
+--
+
+
+-- move all auto -> xenpv
+update rhnKickstartDefaults set virtualization_type =
+ (select id from rhnkickstartvirtualizationtype
+ where label = 'qemu')
+where virtualization_type = (select id from rhnkickstartvirtualizationtype
+ where label = 'auto');
+
+update rhnKickstartSession set virtualization_type =
+ (select id from rhnkickstartvirtualizationtype
+ where label = 'qemu')
+where virtualization_type = (select id from rhnkickstartvirtualizationtype
+ where label = 'auto');
+
+
+
+delete from rhnKickstartVirtualizationType
+ where label = 'auto';
+
+commit;
+
+show errors
+
+-- $Log$
+-- Revision 1 2008/10/29 7:01:05 mmccune
+-- add get rid of auto
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/162-rhnRepoRegenQueue.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/162-rhnRepoRegenQueue.sql
new file mode 100644
index 0000000..f891c39
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/162-rhnRepoRegenQueue.sql
@@ -0,0 +1,29 @@
+create table
+rhnRepoRegenQueue
+(
+ id number
+ constraint rhn_reporegenq_id_nn not null enable
+ constraint rhn_reporegenq_id_pk primary key,
+ channel_label varchar2(128)
+ constraint rhn_reporegenq_chan_label_nn not null enable,
+ client varchar2(128),
+ reason varchar2(128),
+ force char(1),
+ bypass_filters char(1),
+ next_action date default (sysdate),
+ created date default (sysdate)
+ constraint rhn_reporegenq_created_nn not null enable,
+ modified date default (sysdate)
+ constraint rhn_reporegenq_modified_nn not null enable
+ );
+
+create sequence rhn_repo_regen_queue_id_seq start with 101;
+
+create or replace trigger rhn_repo_regen_queue_mod_trig
+before insert or update on rhnRepoRegenQueue
+for each row
+begin
+ :new.modified := sysdate;
+end;
+/
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/163-rhn_config_parameter_data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/163-rhn_config_parameter_data.sql
new file mode 100644
index 0000000..d3e0b9e
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/163-rhn_config_parameter_data.sql
@@ -0,0 +1,9 @@
+
+UPDATE rhn_config_parameter SET value='/var/log/nocpulse/enqueue.log'
+ WHERE group_name='notification' AND name='enqueue_log';
+UPDATE rhn_config_parameter SET value='/var/log/nocpulse/ack_handler.log'
+ WHERE group_name='notification' AND name='ack_handler_log';
+UPDATE rhn_config_parameter SET value='--cd=/var/log/nocpulse --dir=/var/log/nocpulse/archive /var/log/nocpulse/ack_handler.log enqueue.log generate_config.log notifserver.log.save notifserver-error.log --recreate=ticketlog'
+ WHERE group_name='notification' AND name='archive_params';
+
+commit;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/170-rhnErrataNotificationQueue.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/170-rhnErrataNotificationQueue.sql
new file mode 100644
index 0000000..ee1edee
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/170-rhnErrataNotificationQueue.sql
@@ -0,0 +1,3 @@
+ALTER TABLE rhnErrataNotificationQueue
+ MODIFY
+ next_action default(sysdate);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/180-rhnServerGroup_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/180-rhnServerGroup_indexes.sql
new file mode 100644
index 0000000..0f09f8d
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/180-rhnServerGroup_indexes.sql
@@ -0,0 +1,6 @@
+
+alter index rhn_sg_id_oid_name_idx noparallel;
+alter index rhn_sg_oid_id_name_idx noparallel;
+alter index rhn_sg_type_id_idx noparallel;
+alter index rhn_sg_oid_type_id_idx noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/181-rhnServerGroupMembers_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/181-rhnServerGroupMembers_indexes.sql
new file mode 100644
index 0000000..1c6392f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/181-rhnServerGroupMembers_indexes.sql
@@ -0,0 +1,3 @@
+
+alter index rhn_sgmembers_sgid_sid_idx noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/182-rhnServerNeededCache_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/182-rhnServerNeededCache_indexes.sql
new file mode 100644
index 0000000..b412919
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/182-rhnServerNeededCache_indexes.sql
@@ -0,0 +1,4 @@
+
+alter index rhn_snc_pid_idx noparallel;
+alter index rhn_snc_sid_idx noparallel;
+alter index rhn_snc_eid_idx noparallel;
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/183-rhnServerPackage_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/183-rhnServerPackage_indexes.sql
new file mode 100644
index 0000000..de11c00
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/183-rhnServerPackage_indexes.sql
@@ -0,0 +1,3 @@
+
+alter index rhn_sp_snep_idx noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/184-rhnUserGroup_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/184-rhnUserGroup_indexes.sql
new file mode 100644
index 0000000..2cbb43a
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/184-rhnUserGroup_indexes.sql
@@ -0,0 +1,6 @@
+
+alter index rhn_ug_id_name_org noparallel;
+alter index rhn_ug_org_id_name_idx noparallel;
+alter index rhn_ug_org_id_type_idx noparallel;
+alter index rhn_ug_org_id_gtype_idx noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/185-rhnUserGroupMembers_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/185-rhnUserGroupMembers_indexes.sql
new file mode 100644
index 0000000..e4d3e23
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/185-rhnUserGroupMembers_indexes.sql
@@ -0,0 +1,4 @@
+
+alter index rhn_ugmembers_uid_ugid_uq noparallel;
+alter index rhn_ugmembers_ugid_uid_idx noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/186-web_contact_indexes.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/186-web_contact_indexes.sql
new file mode 100644
index 0000000..2843486
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/186-web_contact_indexes.sql
@@ -0,0 +1,4 @@
+
+alter index web_contact_oid_id noparallel;
+alter index web_contact_id_oid_cust_luc noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/187-web_user_site_info_index.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/187-web_user_site_info_index.sql
new file mode 100644
index 0000000..871953f
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/187-web_user_site_info_index.sql
@@ -0,0 +1,3 @@
+
+alter index web_user_site_info_wuid noparallel;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/188-rhnUserInfo_data.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/188-rhnUserInfo_data.sql
new file mode 100644
index 0000000..2f661a0
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/188-rhnUserInfo_data.sql
@@ -0,0 +1,19 @@
+--
+-- Copyright (c) 2009 Red Hat, Inc.
+--
+-- This software is licensed to you under the GNU General Public License,
+-- version 2 (GPLv2). There is NO WARRANTY for this software, express or
+-- implied, including the implied warranties of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+-- along with this software; if not, see
+-- http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+--
+-- Red Hat trademarks are not licensed under GPLv2. No permission is
+-- granted to use or replicate Red Hat trademarks that are incorporated
+-- in this software or its documentation.
+--
+--
+-- $Id$
+--
+update rhnUserInfo set page_size=25 where page_size=20;
+
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/189-rhnReleaseChannelMap-unique.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/189-rhnReleaseChannelMap-unique.sql
new file mode 100644
index 0000000..a081459
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/189-rhnReleaseChannelMap-unique.sql
@@ -0,0 +1,3 @@
+ALTER TABLE rhnReleaseChannelMap
+ADD CONSTRAINT rhn_rcm_pva_def_uniq
+UNIQUE (product, version, channel_arch_id, is_default);
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/99-rhnPackage-Copyright.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/99-rhnPackage-Copyright.sql
new file mode 100644
index 0000000..9330afc
--- /dev/null
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5/99-rhnPackage-Copyright.sql
@@ -0,0 +1,9 @@
+--
+-- Double the copyright from
+-- 64 -> 128 to resolve rhnpush
+-- for centos packages
+--
+
+ALTER TABLE rhnPackage
+MODIFY
+ COPYRIGHT VARCHAR2(128);
commit 6810efe70e00d24d33cd8becbb889a02f4410311
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 15:59:55 2009 +0200
remove symlinks from schema upgrades
These will be replaced by regular directories in next step.
diff --git a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2 b/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2
deleted file mode 120000
index f612f22..0000000
--- a/schema/spacewalk/upgrade/rhn-satellite-schema-5.1-to-spacewalk-schema-0.2
+++ /dev/null
@@ -1 +0,0 @@
-satellite-5.1-spacewalk-0.2
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3 b/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3
deleted file mode 120000
index b48bb8a..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.2-to-spacewalk-schema-0.3
+++ /dev/null
@@ -1 +0,0 @@
-spacewalk-0.2-spacewalk-0.3
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4 b/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4
deleted file mode 120000
index 64b32f3..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.3-to-spacewalk-schema-0.4
+++ /dev/null
@@ -1 +0,0 @@
-spacewalk-0.3-spacewalk-0.4
\ No newline at end of file
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5 b/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5
deleted file mode 120000
index a9f7adb..0000000
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.4-to-spacewalk-schema-0.5
+++ /dev/null
@@ -1 +0,0 @@
-spacewalk-0.4-spacewalk-0.5
\ No newline at end of file
14 years, 7 months
schema/spacewalk
by Milan Zazrivec
schema/spacewalk/common/data/rhnActionType.sql | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 832e8c85a0f65a391f3a43138f9f774c481fcec4
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 14:09:46 2009 +0200
consistent data in new & upgraded schema
diff --git a/schema/spacewalk/common/data/rhnActionType.sql b/schema/spacewalk/common/data/rhnActionType.sql
index a8043a6..018ef24 100644
--- a/schema/spacewalk/common/data/rhnActionType.sql
+++ b/schema/spacewalk/common/data/rhnActionType.sql
@@ -59,14 +59,14 @@ insert into rhnActionType values (37, 'virt.start', 'Starts up a virtual domain.
insert into rhnActionType values (38, 'virt.suspend', 'Suspends a virtual domain.', 'N', 'N');
insert into rhnActionType values (39, 'virt.resume', 'Resumes a virtual domain.', 'N', 'N');
insert into rhnActionType values (40, 'virt.reboot', 'Reboots a virtual domain.', 'N', 'N');
-insert into rhnActionType values (41, 'virt.destroy', 'Destroys a virtual Domain.', 'N', 'N');
+insert into rhnActionType values (41, 'virt.destroy', 'Destroys a virtual domain.', 'N', 'N');
insert into rhnActionType values (42, 'virt.setMemory', 'Sets the maximum memory usage for a virtual domain.', 'N', 'N');
insert into rhnActionType values (43, 'virt.schedulePoller', 'Sets when the poller should run.', 'N', 'N');
insert into rhnActionType values (44, 'kickstart_host.schedule_virt_host_pkg_install', 'Schedule a package install of host specific functionality.', 'N', 'N');
insert into rhnActionType values (45, 'kickstart_guest.schedule_virt_guest_pkg_install', 'Schedule a package install of guest specific functionality.', 'N', 'N');
insert into rhnActionType values (46, 'kickstart_host.add_tools_channel', 'Subscribes a server to the Spacewalk Tools channel associated with its base channel.', 'N', 'N');
insert into rhnActionType values (47, 'kickstart_guest.add_tools_channel', 'Subscribes a virtualization guest to the Spacewalk Tools channel associated with its base channel.', 'N', 'N');
-insert into rhnActionType values (48, 'virt.setVCPUs', 'Sets the Vcpu usage for a virtual domain.', 'N', 'N');
+insert into rhnActionType values (48, 'virt.setVCPUs', 'Sets the Vcpu usage for a virtual domain.', 'N', 'N');
commit;
insert into rhnActionType values (49, 'proxy.deactivate', 'Deactivate Proxy', 'N', 'N');
--
14 years, 7 months
spacewalk/setup
by Milan Zazrivec
spacewalk/setup/share/upgrade/rhn-update-monitoring.pl | 74 ++++++++++-------
1 file changed, 44 insertions(+), 30 deletions(-)
New commits:
commit 683cf5d33c6edb4ead618808e9844d75a4229be9
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 13:50:59 2009 +0200
update spacewalk / satellite monitoring scout ip address
diff --git a/spacewalk/setup/share/upgrade/rhn-update-monitoring.pl b/spacewalk/setup/share/upgrade/rhn-update-monitoring.pl
index 2679760..ecb538e 100755
--- a/spacewalk/setup/share/upgrade/rhn-update-monitoring.pl
+++ b/spacewalk/setup/share/upgrade/rhn-update-monitoring.pl
@@ -28,38 +28,52 @@ exit 0 unless $scout;
my ($ip, $vip) = ($scout->{IP}, $scout->{VIP});
my ($sn_id, $sc_id) = ($scout->{SAT_NODE_ID}, $scout->{ID});
-if ($ip eq '127.0.0.1' or $vip eq '127.0.0.1') {
- my $hostname = Sys::Hostname::hostname;
- my $ip_addr = RHN::Utils::find_ip_address($hostname);
+my $hostname = Sys::Hostname::hostname;
+my $ip_addr = RHN::Utils::find_ip_address($hostname);
- my $dbh = RHN::DB->connect;
+my $dbh = RHN::DB->connect;
- my $sql1 = q{
- update rhn_sat_node
- set ip = :ip,
- last_update_user = 'upgrade',
- last_update_date = sysdate
- where ip = '127.0.0.1' and
- recid = :recid
- };
- my $sql2 = q{
- update rhn_sat_cluster
- set vip = :vip,
- last_update_user = 'upgrade',
- last_update_date = sysdate
- where vip = '127.0.0.1' and
- recid = :recid
- };
+# If IP address for satellite / spacewalk scout was set to 127.0.0.1, it needs to be updated
+my $sql1 = q{
+ update rhn_sat_node
+ set ip = :ip,
+ last_update_user = 'upgrade',
+ last_update_date = sysdate
+ where ip = '127.0.0.1' and
+ recid = :recid
+};
+my $sql2 = q{
+ update rhn_sat_cluster
+ set vip = :vip,
+ last_update_user = 'upgrade',
+ last_update_date = sysdate
+ where vip = '127.0.0.1' and
+ recid = :recid
+};
- $dbh->do_h($sql1,
- ip => $ip_addr,
- recid => $sn_id,
- );
- $dbh->do_h($sql2,
- vip => $ip_addr,
- recid => $sc_id,
- );
- $dbh->commit;
-}
+# If IP address for satellite / spacewalk scout was not set, it needs to be updated
+my $sql3 = q{
+ update rhn_sat_node
+ set ip = :ip,
+ last_update_user = 'upgrade',
+ last_update_date = sysdate
+ where is null and
+ recid = :recid
+};
+my $sql4 = q{
+ update rhn_sat_cluster
+ set vip = :vip,
+ last_update_user = 'upgrade',
+ last_update_date = sysdate
+ where vip is null and
+ recid = :recid
+};
+
+$dbh->do_h($sql1, ip => $ip_addr, recid => $sn_id, );
+$dbh->do_h($sql2, vip => $ip_addr, recid => $sc_id,);
+$dbh->do_h($sql3, ip => $ip_addr, recid => $sn_id, );
+$dbh->do_h($sql4, vip => $ip_addr, recid => $sc_id,);
+
+$dbh->commit;
1;
14 years, 7 months
schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql | 8 ++++++++
1 file changed, 8 insertions(+)
New commits:
commit cd5ac3cc04b7392d4f4b166882d59e5dd24b1fc7
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 13:18:09 2009 +0200
create or replace function needs to be followed by execute
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
index 52f1fd1..594b872 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/998-postgresql-compatability-procs.sql
@@ -8,6 +8,8 @@ is
begin
return a.as_vre;
end;
+/
+show errors
create or replace function evr_t_as_vre_simple( a evr_t )
return VARCHAR2
@@ -15,6 +17,8 @@ is
begin
return a.as_vre_simple;
end;
+/
+show errors
create or replace function sequence_currval( seq_name varchar2 ) return number as
ret number;
@@ -23,6 +27,8 @@ begin
into ret;
return ret;
end;
+/
+show errors
create or replace function sequence_nextval( seq_name varchar2 ) return number as
ret number;
@@ -31,6 +37,8 @@ begin
into ret;
return ret;
end;
+/
+show errors
CREATE OR REPLACE VIEW
14 years, 7 months
schema/spacewalk
by Milan Zazrivec
schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/192-rhnChannelContentSource.sql | 1 -
1 file changed, 1 deletion(-)
New commits:
commit 61253532d3dd836494c5535a56c036be54d46c5a
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Aug 6 13:06:31 2009 +0200
remove extraneous execute after create index
diff --git a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/192-rhnChannelContentSource.sql b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/192-rhnChannelContentSource.sql
index 03ce034..393b8a8 100644
--- a/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/192-rhnChannelContentSource.sql
+++ b/schema/spacewalk/upgrade/spacewalk-schema-0.5-to-spacewalk-schema-0.6/192-rhnChannelContentSource.sql
@@ -47,6 +47,5 @@ create unique index rhn_ccs_uq
tablespace [[64k_tbs]]
;
-/
show errors
14 years, 7 months
Changes to 'refs/tags/spacewalk-setup-0.6.19-1'
by John Matthews
Tag 'spacewalk-setup-0.6.19-1' created by John Matthews <jmatthew(a)redhat.com> at 2009-08-06 01:31 +0000
Tagging package [spacewalk-setup] version [0.6.19-1] in directory [spacewalk/setup/].
Changes since spacewalk-web-0.6.19-1:
John Matthews (1):
Automatic commit of package [spacewalk-setup] release [0.6.19-1].
---
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
---
14 years, 7 months
rel-eng/packages spacewalk/setup
by John Matthews
rel-eng/packages/spacewalk-setup | 2 +-
spacewalk/setup/spacewalk-setup.spec | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit 37226cdc6da760d6afcc39ddd8657218500988c9
Author: John Matthews <jmatthew(a)redhat.com>
Date: Wed Aug 5 21:31:13 2009 -0400
Automatic commit of package [spacewalk-setup] release [0.6.19-1].
diff --git a/rel-eng/packages/spacewalk-setup b/rel-eng/packages/spacewalk-setup
index cee7d6e..c4ef016 100644
--- a/rel-eng/packages/spacewalk-setup
+++ b/rel-eng/packages/spacewalk-setup
@@ -1 +1 @@
-0.6.18-1 spacewalk/setup/
+0.6.19-1 spacewalk/setup/
diff --git a/spacewalk/setup/spacewalk-setup.spec b/spacewalk/setup/spacewalk-setup.spec
index 3df382e..33fb2cf 100644
--- a/spacewalk/setup/spacewalk-setup.spec
+++ b/spacewalk/setup/spacewalk-setup.spec
@@ -1,5 +1,5 @@
Name: spacewalk-setup
-Version: 0.6.18
+Version: 0.6.19
Release: 1%{?dist}
Summary: Initial setup tools for Red Hat Spacewalk
@@ -101,6 +101,9 @@ rm -rf %{buildroot}
%dir %{_sysconfdir}/pki/spacewalk/jabberd
%changelog
+* Wed Aug 05 2009 John Matthews <jmatthew(a)redhat.com> 0.6.19-1
+- 509474 - integration of Joshua's audit feature. (joshua.roys(a)gtri.gatech.edu)
+
* Tue Aug 04 2009 Jan Pazdziora 0.6.18-1
- 490668 - add man pages for spacewalk-setup and cobbler-setup
14 years, 7 months
Changes to 'refs/tags/spacewalk-web-0.6.19-1'
by John Matthews
Tag 'spacewalk-web-0.6.19-1' created by John Matthews <jmatthew(a)redhat.com> at 2009-08-06 01:30 +0000
Tagging package [spacewalk-web] version [0.6.19-1] in directory [web/].
Changes since spacewalk-java-0.6.41-1:
John Matthews (1):
Automatic commit of package [spacewalk-web] release [0.6.19-1].
---
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
---
14 years, 7 months
rel-eng/packages web/spacewalk-web.spec
by John Matthews
rel-eng/packages/spacewalk-web | 2 +-
web/spacewalk-web.spec | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 49a9c2c41551fcce25b7d1707d3df80ca3dba2b9
Author: John Matthews <jmatthew(a)redhat.com>
Date: Wed Aug 5 21:30:25 2009 -0400
Automatic commit of package [spacewalk-web] release [0.6.19-1].
diff --git a/rel-eng/packages/spacewalk-web b/rel-eng/packages/spacewalk-web
index 410e9fc..6416cdb 100644
--- a/rel-eng/packages/spacewalk-web
+++ b/rel-eng/packages/spacewalk-web
@@ -1 +1 @@
-0.6.18-1 web/
+0.6.19-1 web/
diff --git a/web/spacewalk-web.spec b/web/spacewalk-web.spec
index 2787ab0..933b416 100644
--- a/web/spacewalk-web.spec
+++ b/web/spacewalk-web.spec
@@ -2,7 +2,7 @@ Name: spacewalk-web
Summary: Spacewalk Web site packages
Group: Applications/Internet
License: GPLv2
-Version: 0.6.18
+Version: 0.6.19
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -317,7 +317,7 @@ rm -rf $RPM_BUILD_ROOT
# $Id$
%changelog
-* Wed Aug 05 2009 John Matthews <jmatthew(a)redhat.com> 0.6.18-1
+* Wed Aug 05 2009 John Matthews <jmatthew(a)redhat.com> 0.6.19-1
- 515580 - remove hard links to scooby.rdu (shughes(a)redhat.com)
* Tue Aug 04 2009 Jan Pazdziora 0.6.17-1
14 years, 7 months