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 #36579 - Split the installer into multiple subpackages #9564

Open
wants to merge 1 commit into
base: rpm/develop
Choose a base branch
from
Open
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
157 changes: 100 additions & 57 deletions packages/foreman/foreman-installer/foreman-installer.spec
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
%global configdir %{_datadir}/%{name}/config
%global parser_cache %{_datadir}/%{name}/parser_cache
%global scenariodir %{_sysconfdir}/%{name}/scenarios.d

%global release 1
%global prereleasesource develop
%global prerelease %{?prereleasesource}
Expand All @@ -7,44 +11,80 @@ Epoch: 1
Version: 3.12.0
Release: %{?prerelease:0.}%{release}%{?prerelease:.}%{?prerelease}%{?nightly}%{?dist}
Summary: Puppet-based installer for The Foreman
Group: Applications/System
License: GPLv3+ and ASL 2.0
URL: https://theforeman.org
Source0: https://downloads.theforeman.org/%{name}/%{name}-%{version}%{?prerelease:-}%{?prerelease}.tar.bz2

BuildArch: noarch

Requires: curl
Requires: hostname
Requires: puppet-agent >= 7.0.0
Requires: rubygem(kafo) >= 7.3.0
Requires: rubygem(kafo) < 8.0.0
Requires: ruby(release)
# As a migration foreman-installer ensures the foreman scenario is installed
Copy link
Member

Choose a reason for hiding this comment

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

Two options/questions:

  • Could foreman-installer-foreman Obsolete foreman-installer and avoid this?
  • Could foreman-installer become the common package rather than a -common sub-package?

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 considered that, but I don't think you can do that.

Could foreman-installer-foreman Obsolete foreman-installer and avoid this?

Perhaps foreman-installer-scenario can have:

Provides: foreman-installer = %{epoch}:%{version}-%release
Obsoletes: foreman-installer < 1:3.8.0-somerelease

And that could replace it. I'm never sure so would need to test it out. But I think then we can't have a foreman-installer package.

I just realized we need a similar solution for katello, but there we may need to pull in both katello and foreman-proxy-content scenarios to remain compatible.

Could foreman-installer become the common package rather than a -common sub-package?

Yes, but then I fear we can't do the migration well. Perhaps we can list them as soft dependencies with Suggests, but I really don't trust that if I'm honest. Especially if we take downstream into account.

@evgeni any more ideas?

Copy link
Member

Choose a reason for hiding this comment

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

Hard no on "Suggests", that implies the package would work without the "suggested" one, but I don't think the installer will without the common bits ;-)

Can you elaborate more on your fear wrt "foreman-installer" is the "common" package? My brain suggests it should work, but its also partially in PTO mode.

And for me, to recap the plan and whether I understood it correctly:

  1. new users would just install foreman-installer-scenario-<thing> and that would make things work as needed
  2. existing foreman users would get foreman-installer-scenario-foreman and would still not have to pass --scenario and things will work as before
  3. existing katello users would get foreman-installer-scenario-katello AND foreman-installer-scenario-fpc (as we don't know, package wise, what they have deployed) and will have multiple scenarios available as before (but as they already installed, they don't need to pass --scenario anymore)
  4. existing satellite users (even if not modeled here) would get the same as katello, plus the satellite and capsule scenarios, again, with no behavioral changes.
  5. then, after a few releases, we can drop those transitional packages (the ones depending on the new foreman-installer-scenario-<thing>) and Obsolete them with the "right" <thing> package

One thing to consider: I know that we use the "is foreman-installer-katello installed" fact to differentiate between foreman and katello installs in a few places (like LEAPP), so we gotta go hunting for those and update them :)

Copy link
Member Author

Choose a reason for hiding this comment

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

new users would just install foreman-installer-scenario-<thing> and that would make things work as needed

Yes, we will modify the installation instructions. I also hope to introduce foreman-installer-scenario-foreman-proxy to provide a non-content proxy so there would be consistency.

existing foreman users would get foreman-installer-scenario-foreman and would still not have to pass --scenario and things will work as before

Correct. I hope to get to a point where dnf upgrade will ensure foreman-installer-scenario-foreman is installed when they now have foreman-installer installed.

existing katello users would get foreman-installer-scenario-katello AND foreman-installer-scenario-fpc (as we don't know, package wise, what they have deployed) and will have multiple scenarios available as before (but as they already installed, they don't need to pass --scenario anymore)

Correct, and because they have foreman-installer installed they will also get foreman-installer-scenario-foreman which they also don't need. Perhaps rich dependencies could help here.

In foreman_maintain we can suggest cleanups by looking at the symlink which scenario is active, but that's not going to work in plain dnf.

existing satellite users (even if not modeled here) would get the same as katello, plus the satellite and capsule scenarios, again, with no behavioral changes.

Correct. As above, satellite-maintain can suggest redundant packages. Though it depends on how much we want to patch downstream. In downstream we have satellite and capsule meta packages which could do the migration as well.

One thing to consider: I know that we use the "is foreman-installer-katello installed" fact to differentiate between foreman and katello installs in a few places (like LEAPP), so we gotta go hunting for those and update them :)

I don't see it show up in foreman_maintain. As for LEAPP: do we still support that? We don't support skipping over releases and we dropped EL7 a while back so by the time they get here, they should already be on EL8.

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking ahead when we will do LEAPP for 8 to 9, reusing the code :)

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 like your optimism.

Copy link
Member

Choose a reason for hiding this comment

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

Correct. As above, satellite-maintain can suggest redundant packages. Though it depends on how much we want to patch downstream. In downstream we have satellite and capsule meta packages which could do the migration as well.

My thinking basically, the fact Satellite has meta packages to represent each type means they can require the respective scenario package and do the cleanup.

In all cases, we will know what scenario is installed on the system, and can use that information to do cleanup. We could consider using this as the same opportunity to move the answer files (theforeman/foreman-installer#698) but that might be scope creep. Figured I'd throw it out there as this new packaging provides an opportunity to signal other changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

In all cases, we will know what scenario is installed on the system, and can use that information to do cleanup. We could consider using this as the same opportunity to move the answer files (theforeman/foreman-installer#698) but that might be scope creep. Figured I'd throw it out there as this new packaging provides an opportunity to signal other changes.

It is something I also thought about. I mostly worry about the additional tooling that reads it, such as foreman_maintain. Perhaps we should provide a way to output the answers, like some script or some installer output option.

Requires: %{name}-scenario-foreman = %{epoch}:%{version}-%{release}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Requires: %{name}-scenario-foreman = %{epoch}:%{version}-%{release}
Requires: (%{name}-scenario-foreman = %{epoch}:%{version}-%{release} unless (%{name}-katello or %{name}-scenario-katello or %{name}-scenario-foreman-proxy-content))

I think this should allow users to not get the foreman scenario if they already have something katello-ish


BuildRequires: asciidoc
BuildRequires: puppet-agent >= 7.0.0
BuildRequires: rubygem(rake)
BuildRequires: rubygem(kafo) >= 7.3.0
BuildRequires: rubygem(kafo) < 8.0.0
BuildRequires: puppet-agent-puppet-strings >= 1.2.0
BuildRequires: puppet-agent-puppet-strings < 5
BuildRequires: puppet-agent-puppet-strings >= 1.2.0
BuildRequires: rubygem(kafo) < 8.0.0
BuildRequires: rubygem(kafo) >= 7.3.0
BuildRequires: rubygem(rake)

%description
Complete installer for The Foreman life-cycle management system based on Puppet.

%package katello
Summary: Katello installer bits
Group: Applications/System
Provides: katello-installer-base < 3.11.0-1
Obsoletes: katello-installer-base < 3.11.0-1
%package common
Summary: Common installer bits

Requires: curl
Requires: hostname
Requires: puppet-agent >= 6.15.0
Requires: ruby(release)
Requires: rubygem(kafo) < 8.0.0
Requires: rubygem(kafo) >= 6.5.0
Requires: which

Requires: %{name} = %{epoch}:%{version}-%{release}
%description common
The common parts to all installer scenarios.

%package katello-common
Summary: Common Katello installer bits

Requires: %{name}-common = %{epoch}:%{version}-%{release}
Requires: openssl
Requires: katello-certs-tools
Requires: which

%description katello-common
All the parts needed for both both the Katello and Foreman Proxy Content
scenarios.

%package katello
Summary: Deprecated package that installs both Katello scenarios

Requires: foreman-installer-scenario-katello = %{epoch}:%{version}-%{release}
Requires: foreman-installer-scenario-foreman-proxy-content = %{epoch}:%{version}-%{release}
Comment on lines +62 to +63
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Requires: foreman-installer-scenario-katello = %{epoch}:%{version}-%{release}
Requires: foreman-installer-scenario-foreman-proxy-content = %{epoch}:%{version}-%{release}
Requires: (foreman-installer-scenario-katello = %{epoch}:%{version}-%{release} unless foreman-installer-scenario-foreman-proxy-content)
Requires: (foreman-installer-scenario-foreman-proxy-content = %{epoch}:%{version}-%{release} unless foreman-installer-scenario-katello)

but I am not sure those two would cancel themself out and you'd end with a weird result?


%description katello
Various scenarios and tools for the Katello ecosystem
Transitional meta package

%package scenario-foreman
Summary: Foreman scenario
Requires: foreman-installer-common = %{epoch}:%{version}-%{release}

%description scenario-foreman
Foreman

%package scenario-katello
Summary: Foreman and Katello scenario
Requires: foreman-installer-katello-common = %{epoch}:%{version}-%{release}

%description scenario-katello
Foreman with Katello.

%package scenario-foreman-proxy-content
Summary: Foreman Proxy Content scenario
Requires: foreman-installer-katello-common = %{epoch}:%{version}-%{release}

%description scenario-foreman-proxy-content
A content proxy for Katello.

%prep
%setup -q -n %{name}-%{version}%{?prerelease:-}%{?prerelease}
Expand All @@ -66,61 +106,64 @@ rake install \
SYSCONFDIR=%{buildroot}%{_sysconfdir} \
--trace

%post
%post scenario-foreman
foreman-installer --scenario foreman --migrations-only > /dev/null

%post katello
foreman-installer --scenario foreman-proxy-content --migrations-only > /dev/null
%post scenario-katello
foreman-installer --scenario katello --migrations-only > /dev/null

%files
%post scenario-foreman-proxy-content
foreman-installer --scenario foreman-proxy-content --migrations-only > /dev/null

%files common
%defattr(-,root,root,-)
%doc README.*
%license LICENSE
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/custom-hiera.yaml
%dir %{_sysconfdir}/%{name}/scenarios.d
%{_sysconfdir}/%{name}/scenarios.d/foreman.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/foreman-migrations-applied
%dir %{scenariodir}
%{_sbindir}/%{name}
%{_datadir}/%{name}
%{_mandir}/man8

# katello files
%exclude %{_datadir}/%{name}/config/foreman-proxy-content*
%exclude %{_datadir}/%{name}/config/katello*
%exclude %{_datadir}/%{name}/katello-certs
%exclude %{_datadir}/%{name}/parser_cache/foreman-proxy-certs.yaml
%exclude %{_datadir}/%{name}/parser_cache/foreman-proxy-content.yaml
%exclude %{_datadir}/%{name}/parser_cache/katello.yaml

%files katello
# common
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/checks
%dir %{_datadir}/%{name}/config
%{_datadir}/%{name}/config/config_header.txt
%{_datadir}/%{name}/config/foreman-hiera.yaml
%{_datadir}/%{name}/config/foreman.hiera
%{_datadir}/%{name}/hooks
%{_datadir}/%{name}/modules
%{_datadir}/%{name}/VERSION
%dir %{parser_cache}
%{_mandir}/man8/%{name}.8*

%files katello-common
%{_sbindir}/katello-certs-check

# foreman-proxy-content scenario
%{_datadir}/%{name}/config/foreman-proxy-content*
%{_datadir}/%{name}/parser_cache/foreman-proxy-content.yaml
%{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/foreman-proxy-content-migrations-applied

# katello scenario
%{_datadir}/%{name}/config/katello*
%{_datadir}/%{name}/parser_cache/katello.yaml
%{_sysconfdir}/%{name}/scenarios.d/katello.migrations
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/katello.yaml
%config(noreplace) %attr(600, root, root) %{_sysconfdir}/%{name}/scenarios.d/katello-answers.yaml
%config(noreplace) %{_sysconfdir}/%{name}/scenarios.d/katello-migrations-applied
%files scenario-foreman
%{configdir}/foreman.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-answers.yaml
%config(noreplace) %{scenariodir}/foreman-migrations-applied
%{parser_cache}/foreman.yaml
Comment on lines +142 to +146
Copy link
Member

Choose a reason for hiding this comment

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

this could become a macro files_for_scenario(name), but not sure if that'd be over-optimization or not

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 tried to write a macro but couldn't make it work. There's a good chance that's on my side but RPM documentation was insufficient.


%files scenario-katello
%{configdir}/katello.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/katello.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/katello-answers.yaml
%config(noreplace) %{scenariodir}/katello-migrations-applied
%{parser_cache}/katello.yaml

# foreman-proxy-certs-generate
%{_datadir}/%{name}/katello-certs
%{_datadir}/%{name}/parser_cache/foreman-proxy-certs.yaml
%{parser_cache}/foreman-proxy-certs.yaml
%{_sbindir}/foreman-proxy-certs-generate

%files scenario-foreman-proxy-content
%{configdir}/foreman-proxy-content.migrations
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-proxy-content.yaml
%config(noreplace) %attr(600, root, root) %{scenariodir}/foreman-proxy-content-answers.yaml
%config(noreplace) %{scenariodir}/foreman-proxy-content-migrations-applied
%{parser_cache}/foreman-proxy-content.yaml

%changelog
* Wed May 22 2024 Zach Huntington-Meath <[email protected]> - 1:3.12.0-0.1.develop
- Bump version to 3.12-develop
Expand Down