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

Patch feature flags directly into cloud-init code since newer versions do not load feature_overrides.py anymore #1546

Merged
merged 1 commit into from
Aug 27, 2024
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ERROR_ON_USER_DATA_FAILURE = False
16 changes: 16 additions & 0 deletions images/capi/ansible/roles/providers/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
mode: "0644"
when: ansible_os_family != "Flatcar"

# `feature_overrides.py` only works on old cloud-init versions (removed in https://github.com/canonical/cloud-init/pull/4228)...
- name: Set cloudinit feature flags
ansible.builtin.copy:
src: usr/lib/python3/dist-packages/cloudinit/feature_overrides.py
Expand Down Expand Up @@ -133,6 +134,21 @@
mode: "0644"
when: ansible_os_family == "RedHat" and ansible_distribution == "RedHat" and ansible_distribution_major_version == "9"

# ...and `features.py` must be patched instead
- name: Patch cloud-init feature flags for Debian-based OS
ansible.builtin.blockinfile:
path: /usr/lib/python3/dist-packages/cloudinit/features.py
marker: "# {mark} ANSIBLE MANAGED BLOCK (by image-builder)"
block: "{{ lookup('file', 'cloud-init-features.patch') }}"
when: ansible_os_family == "Debian"

- name: Patch cloud-init feature flags for RedHat 9
ansible.builtin.blockinfile:
path: /usr/lib/python3.9/site-packages/cloudinit/features.py
marker: "# {mark} ANSIBLE MANAGED BLOCK (by image-builder)"
block: "{{ lookup('file', 'cloud-init-features.patch') }}"
when: ansible_os_family == "RedHat" and ansible_distribution == "RedHat" and ansible_distribution_major_version == "9"

- name: Ensure chrony is running
ansible.builtin.systemd:
enabled: true
Expand Down