Skip to content

Commit

Permalink
Add foreman_ygg_migration package
Browse files Browse the repository at this point in the history
This package should get pulled in when yggdrasil >=0.4.z is installed.

When installed, it checks whether yggdrasild.service is enabled. If not, it
does nothing. If enabled, this package tweaks yggdrasil's config file to account
for the newly needed config options. Additionally, it disables the yggdrasild
service and enables yggdrasil.service.

Our worker is left to be activated through dbus.
  • Loading branch information
adamruzicka committed Oct 4, 2024
1 parent 47e3f36 commit d9b72c8
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions comps/comps-foreman-client-el8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">foreman-client-release</packagereq>
<packagereq type="default">foreman_ygg_migration</packagereq>
<packagereq type="default">foreman_ygg_worker</packagereq>
<packagereq type="default">katello-host-tools</packagereq>
<packagereq type="default">katello-host-tools-tracer</packagereq>
Expand Down
1 change: 1 addition & 0 deletions comps/comps-foreman-client-el9.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">foreman-client-release</packagereq>
<packagereq type="default">foreman_ygg_migration</packagereq>
<packagereq type="default">foreman_ygg_worker</packagereq>
<packagereq type="default">katello-host-tools</packagereq>
<packagereq type="default">katello-host-tools-tracer</packagereq>
Expand Down
1 change: 1 addition & 0 deletions comps/comps-foreman-client-rhel7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<uservisible>true</uservisible>
<packagelist>
<packagereq type="default">foreman-client-release</packagereq>
<packagereq type="default">foreman_ygg_migration</packagereq>
<packagereq type="default">foreman_ygg_worker</packagereq>
<packagereq type="default">katello-host-tools</packagereq>
<packagereq type="default">katello-host-tools-tracer</packagereq>
Expand Down
1 change: 1 addition & 0 deletions package_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ foreman_client_packages:
children:
yggdrasil_client_packages: {}
hosts:
foreman_ygg_migration: {}
foreman_ygg_worker: {}
katello-host-tools: {}
katello-pull-transport-migrate: {}
Expand Down
32 changes: 32 additions & 0 deletions packages/client/foreman_ygg_migration/foreman_ygg_migration.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Name: foreman_ygg_migration
Version: 0.0.1
Summary: A helper package to ease transition from yggdrasil 0.2.z to 0.4.z
Release: 1%{?dist}
License: MIT

Supplements: yggdrasil >= 0.4.0
Requires: yggdrasil >= 0.4.0

%description
A helper package to ease transition from yggdrasil 0.2.z to 0.4.z

%post
if systemctl is-enabled yggdrasild >/dev/null 2>/dev/null; then
grep -Pq '^server' /etc/yggdrasil/config.toml || sed -i 's/broker.*=/server =/' /etc/yggdrasil/config.toml
grep -Pq '^prefix' /etc/yggdrasil/config.toml || echo 'prefix = "yggdrasil"' >>/etc/yggdrasil/config.toml
grep -Pq '^data-host' /etc/yggdrasil/config.toml || echo 'data-host = ""' >>/etc/yggdrasil/config.toml

if grep -q FOREMAN_YGG_WORKER_WORKDIR /etc/systemd/system/yggdrasild.service.d/* 2>/dev/null; then
mkdir -p /etc/systemd/system/com.redhat.Yggdrasil1.Worker1.foreman.service.d/
cp -r /etc/systemd/system/yggdrasild.service.d/* /etc/systemd/system/com.redhat.Yggdrasil1.Worker1.foreman.service.d/
fi

systemctl disable --now yggdrasild
systemctl enable --now yggdrasil
fi

%files

%changelog
* Thu Oct 03 2024 Adam Ruzicka <[email protected]> - 0.0.1-1
- Initial packaging

0 comments on commit d9b72c8

Please sign in to comment.