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

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Jun 27, 2024

The host mirror.centos.org is gone now that CentOS < 9 is EOL. It includes a migration to simplify the name, but doesn't include migrations to remove old entries. That is up to the user because they may have modified them and still use them.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

@ShimShtein do you want me to add this to my list of reviews to go over as part of the mentorship?

@chris1984
Copy link
Member

@ekohl did you want me to look for areas that were missed and test(provide a patch), not sure if you just didn't have time or was there another reason this was in a draft?

Copy link
Member Author

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

not sure if you just didn't have time

This, though I think it would be great to do this before Foreman 3.12.

I left a comment with what I at least know as one TODO.

},
{
: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

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

@ekohl should I update these as well or just keep them since they just relate to tests:

path { 'http://mirror.centos.org/centos/$major/os/x86_64' }

I looked through everything in VSCode and don't see anything except for test fixtures, so will make the migration and push it to your branch and wait to hear back from you on the test fixtures and tests.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

I tried pushing to your branch to add the migration and I am getting this:

[vagrant@toledodevel foreman]$ git push ewoud 37606-drop-old-installation-media
remote: Permission to ekohl/foreman.git denied to chris1984.
fatal: unable to access 'https://github.com/ekohl/foreman.git/': The requested URL returned error: 403
[vagrant@toledodevel foreman]$ git push ewoud 37606-drop-old-installation-media --force
remote: Permission to ekohl/foreman.git denied to chris1984.

@ekohl
Copy link
Member Author

ekohl commented Aug 14, 2024

I tried pushing to your branch to add the migration and I am getting this:

In GitHub you can (don't have to) allow maintainers to push to your PRs. I have that enabled, but since you're not a maintainer and I didn't grant you explicit permissions you get a permission denied.

That's why I suggested to submit a PR against my fork or open a fresh PR. If you'd like to finish the whole effort then I think the latter is easier.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

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

@ShimShtein I helped get the migration in, it looks fine to me. I checked all the areas and other than test fixtures/tests we have covered all our bases. Let me know if this looks good or if you want me to try and update the tests.

Ewoud wanted to get this in before 3.12.

@ekohl ekohl force-pushed the 37606-drop-old-installation-media branch from a0f3206 to 7b76910 Compare August 15, 2024 15:15
@ekohl ekohl marked this pull request as ready for review August 15, 2024 15:15
@ekohl
Copy link
Member Author

ekohl commented Aug 15, 2024

Rebased and squashed. I also expanded the commit message a bit to better describe what's going on.

app/services/medium_providers/provider.rb Outdated Show resolved Hide resolved
app/controllers/api/v2/media_controller.rb Outdated Show resolved Hide resolved
app/views/media/_form.html.erb Outdated Show resolved Hide resolved
@@ -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

@ekohl ekohl force-pushed the 37606-drop-old-installation-media branch from 7b76910 to 1724bfb Compare October 22, 2024 12:26
@ekohl
Copy link
Member Author

ekohl commented Oct 22, 2024

Rebased and fixed -Stream to -stream.

@@ -0,0 +1,9 @@
class RenameCentosStreamMirrorToCentos < ActiveRecord::Migration[6.1]
def up
Medium.unscoped.where(name: "CentOS Stream 9 mirror").update_all(name: "CentOS mirror")

Choose a reason for hiding this comment

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

Along with this media, should we consider updating all other CentOS mirrors which we are removing in this migration, such as CentOS 7 mirror and CentOS Stream?

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 doesn't remove old media because users may have reused that and pointed it to vault.centos.org.

I suppose users could have introduced one named CentOS mirror which may conflict. I'm not sure what's best here.

Copy link
Contributor

Choose a reason for hiding this comment

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

How about search by URL and then removing those:

Medium.unscoped.where(url: "http://mirror.centos.org/centos/$major/os/$arch")

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 don't like to surprise people and manage the data too much. I think I'll go with error handling where it ignores the rename if CentOS mirror already exists and add an upgrade warning to the release notes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Confusingly enough, the name is not a unique column so the DB allows multiple entries with the same name. I've come up with a solution that I isn't very pretty, but probably reliable.

I'd appreciate your thoughts on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

The new migration logic makes sense to me.

The host mirror.centos.org is gone now that CentOS < 9 is EOL. It
includes a migration to simplify the name, but doesn't include
migrations to remove old entries. That is up to the user because they
may have modified them and still use them.

Co-authored-by: Chris Roberts <[email protected]>
@ekohl ekohl force-pushed the 37606-drop-old-installation-media branch from 1724bfb to 66654d0 Compare October 28, 2024 17:02
@ekohl
Copy link
Member Author

ekohl commented Oct 31, 2024

@Gauravtalreja1 could you take another look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants