Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37606 - Drop old CentOS installation media #10227

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/api/v2/media_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class MediaController < V2::BaseController
PATH_INFO = <<~EOS
The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).

for example http://mirror.centos.org/centos/$version/os/$arch
for example https://mirror.stream.centos.org/$version-stream/BaseOS/$arch/os
where $arch will be substituted for the host\'s actual OS architecture and $version, $major and $minor
will be substituted for the version of the operating system.

Expand Down
2 changes: 1 addition & 1 deletion app/services/medium_providers/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module MediumProviders
# Example:
# provider = MyMediumProvider.new(centos_host)
# provider.medium_uri
# => #<URI::HTTP http://mirror.centos.org/centos/7/os/x86_64>
# => #<URI::HTTP http://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os>
class Provider
delegate :logger, :to => :Rails

Expand Down
2 changes: 1 addition & 1 deletion app/views/media/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<div class="tab-pane active" id="primary">
<%= text_f f, :name %>
<%= text_f f, :path, :size => "col-md-8", :help_block => _("The path to the medium, can be a URL or a valid NFS server (exclusive of the architecture).
for example <em>http://mirror.centos.org/centos/$version/os/$arch</em> where <strong>$arch</strong> will be substituted for the host's actual OS architecture and <strong>$version</strong>, <strong>$major</strong> and <strong>$minor</strong> will be substituted for the version of the operating system. Solaris and Debian media may also use <strong>$release</strong>.").html_safe %>
for example <em>https://mirror.stream.centos.org/$version-stream/BaseOS/$arch/os</em> where <strong>$arch</strong> will be substituted for the host's actual OS architecture and <strong>$version</strong>, <strong>$major</strong> and <strong>$minor</strong> will be substituted for the version of the operating system. Solaris and Debian media may also use <strong>$release</strong>.").html_safe %>
<span id="nfs-section" <%= display?(!required_nfs?) %>>
<%= text_f f, :media_path, :size => "col-md-8", :help_inline => _("The NFS path to the media.") %>
<%= text_f f, :config_path, :size => "col-md-8", :help_inline => _("The NFS path to the jumpstart control files.") %>
Expand Down
21 changes: 21 additions & 0 deletions db/migrate/20240813141845_rename_centos_stream_mirror_to_centos.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
class RenameCentosStreamMirrorToCentos < ActiveRecord::Migration[6.1]
OLD_NAME = "CentOS Stream 9 mirror"
NEW_NAME = "CentOS mirror"

def up
# Name column isn't unique, so we can't just rename and catch
# ActiveRecord::RecordNotUnique
old = Medium.unscoped.where(name: OLD_NAME)
return unless old.exists?

if Medium.unscoped.where(name: NEW_NAME).exists?
logger.warn("Couldn't rename medium '#{OLD_NAME}' to '#{NEW_NAME}': already exists")
else
old.update_all(name: NEW_NAME)
end
end

def down
Medium.unscoped.where(name: NEW_NAME).update_all(name: OLD_NAME)
end
end
12 changes: 1 addition & 11 deletions db/seeds.d/100-installation_media.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
Medium.without_auditing do
[
{
:name => "CentOS 7 mirror",
:os_family => "Redhat",
:path => "http://mirror.centos.org/centos/$major/os/$arch",
Copy link

@Gauravtalreja1 Gauravtalreja1 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This old CentOS mirror is still available for older CentOS versions, so can we keep both CentOS Stream and CentOS media's, since 8-stream content still exists on old mirrors?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not: mirror.centos.org no longer has any DNS records and the whole infrastructure has been retired. And I don't want to set something up pointing to vault.centos.org.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, upon checking, I discovered 8-stream has only a readme which states "This directory (and version of CentOS) is deprecated.". So, we're fine with the current approach since 8-stream is already EOL

},
{
:name => "CentOS Stream",
:os_family => "Redhat",
:path => "http://mirror.centos.org/centos/$major-stream/BaseOS/$arch/os",
},
{
:name => "CentOS Stream 9 mirror",
:name => "CentOS mirror",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this may need a DB migration to rename the existing entry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, this will definitely require a migration.

On fresh dev machine:

[2] pry(main)> Medium.where("name like '%9%'").all
=> [#<Medium:0x00007f08ff4f6aa0
  id: 3,
  name: "CentOS Stream 9 mirror",
  path: "http://mirror.stream.centos.org/$major-stream/BaseOS/$arch/os",
  created_at: Tue, 30 Jul 2024 10:43:46.058948000 UTC +00:00,
  updated_at: Tue, 30 Jul 2024 10:43:46.058948000 UTC +00:00,
  media_path: nil,
  config_path: nil,
  image_path: nil,
  os_family: "Redhat">]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also delete the Centos Stream mirror and use that in place of the Centos one we are switching to? I see Stream 9 and Stream are both in there?

2	CentOS Stream	http://mirror.centos.org/centos/$major-stream/BaseOS/$arch/os	2024-07-19 15:57:37.289
3	CentOS Stream 9 mirror	http://mirror.stream.centos.org/$major-stream/BaseOS/$arch/os	2024-07-19 15:57:37.314

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deletion is something we usually don't do. Users may have modified them to point to some internal link. That's a can of worms we prefer to keep closed

:os_family => "Redhat",
:path => "http://mirror.stream.centos.org/$major-stream/BaseOS/$arch/os",
},
Expand Down
Loading