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

Update handling of local repositories for leapp_upgrade_type custom. #228

Merged
merged 1 commit into from
Oct 9, 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
5 changes: 5 additions & 0 deletions changelogs/fragments/custom_local_repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
minor_changes:
- Consolidate analysis and upgrade custom-local-repos.yml task files to infra.leapp.common custom_local_repos.yml.
- Use infra.leapp.common custom_local_repos.yml to generate all repository files.
- Ensure leapp_upgrade_repositories.repo only has content from the current run of local_repos_leapp variable.
36 changes: 16 additions & 20 deletions roles/analysis/tasks/analysis-leapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
- satellite_organization is defined
- satellite_activation_key_leapp is defined

- name: analysis-leapp | Include custom-local-repos.yml for local_repos_pre_leapp
- name: analysis-leapp | Include custom_local_repos for local_repos_pre_leapp
vars:
__local_repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: analysis-leapp | Install packages for preupgrade analysis on RHEL 7
Expand Down Expand Up @@ -48,20 +50,12 @@
when: leapp_answerfile is defined

- name: analysis-leapp | Create /etc/leapp/files/leapp_upgrade_repositories.repo
ansible.builtin.yum_repository:
name: "{{ item.name }}"
description: "{{ item.description }}"
baseurl: "{{ item.baseurl }}"
enabled: "{{ item.enabled | default(1) }}"
gpgcheck: "{{ item.gpgcheck | default(0) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
repo_gpgcheck: "{{ item.repo_gpgcheck | default(omit) }}"
file: /etc/leapp/files/leapp_upgrade_repositories
state: present
owner: root
group: root
mode: "0644"
loop: "{{ local_repos_leapp }}"
vars:
__repos: "{{ local_repos_leapp }}"
__leapp_repo_file: /etc/leapp/files/leapp_upgrade_repositories
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when:
- leapp_upgrade_type == 'custom'
- local_repos_leapp | length > 0
Expand All @@ -83,10 +77,12 @@
poll: "{{ async_poll_interval | int }}"
failed_when: "'report has been generated' not in leapp.stdout"

- name: analysis-leapp | Include custom-local-repos.yml for local_repos_post_analysis
- name: analysis-leapp | Include custom_local_repos for local_repos_post_analysis
vars:
__local_repos: "{{ local_repos_post_analysis }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_post_analysis }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: analysis-leapp | Include check-results-file.yml
Expand Down
16 changes: 10 additions & 6 deletions roles/analysis/tasks/analysis-preupg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
failed_when: false
changed_when: true

- name: analysis-preupg | Include custom-local-repos.yml for local_repos_pre_leapp
- name: analysis-preupg | Include custom_local_repos for local_repos_pre_leapp
vars:
__local_repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: analysis-preupg | Enable requisite RHUI repos
Expand Down Expand Up @@ -75,10 +77,12 @@
that: not preupg_return_codes[preupg.rc].fail
msg: "{{ preupg_return_codes[preupg.rc].msg }}"

- name: analysis-preupg | Include custom-local-repos.yml for local_repos_post_analysis
- name: analysis-preupg | Include custom_local_repos for local_repos_post_analysis
vars:
__local_repos: "{{ local_repos_post_analysis }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_post_analysis }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: analysis-preupg | Include check-results-file.yml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
---
- name: custom-local-repos | Enable custom upgrade yum repositories
- name: custom_local_repos | Remove old /etc/leapp/files/leapp_upgrade_repositories.repo
ansible.builtin.file:
path: /etc/leapp/files/leapp_upgrade_repositories.repo
state: absent
when:
- __leapp_repo_file is defined

- name: custom_local_repos | Enable custom upgrade yum repositories
ansible.builtin.yum_repository:
name: "{{ item.name }}"
description: "{{ item.description }}"
Expand All @@ -8,11 +15,11 @@
gpgcheck: "{{ item.gpgcheck | default(0) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
repo_gpgcheck: "{{ item.repo_gpgcheck | default(omit) }}"
file: "{{ item.file | default('local') }}"
file: "{{ __leapp_repo_file | default(item.file) | default('local') }}"
state: "{{ item.state | default('present') }}"
owner: root
group: root
mode: "0644"
loop: "{{ __local_repos }}"
loop: "{{ __repos }}"

...
18 changes: 0 additions & 18 deletions roles/upgrade/tasks/custom-local-repos.yml

This file was deleted.

8 changes: 5 additions & 3 deletions roles/upgrade/tasks/leapp-post-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,12 @@
- satellite_organization is defined
- satellite_activation_key_post_leapp is defined

- name: leapp-post-upgrade | Include custom-local-repos.yml for local_repos_post_upgrade
- name: leapp-post-upgrade | Include custom_local_repos for local_repos_post_upgrade
vars:
__local_repos: "{{ local_repos_post_upgrade }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_post_upgrade }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: leapp-post-upgrade | Include update-and-reboot.yml
Expand Down
27 changes: 11 additions & 16 deletions roles/upgrade/tasks/leapp-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,24 @@
- satellite_organization is defined
- satellite_activation_key_leapp is defined

- name: leapp-upgrade | Include custom-local-repos.yml local_repos_pre_leapp
- name: leapp-upgrade | Include custom_local_repos for local_repos_pre_leapp
vars:
__local_repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: leapp-upgrade | Include update-and-reboot.yml
ansible.builtin.include_tasks: update-and-reboot.yml

- name: leapp-upgrade | Create /etc/leapp/files/leapp_upgrade_repositories.repo
ansible.builtin.yum_repository:
name: "{{ item.name }}"
description: "{{ item.description }}"
baseurl: "{{ item.baseurl }}"
enabled: "{{ item.enabled | default(1) }}"
gpgcheck: "{{ item.gpgcheck | default(0) }}"
gpgkey: "{{ item.gpgkey | default(omit) }}"
repo_gpgcheck: "{{ item.repo_gpgcheck | default(omit) }}"
file: /etc/leapp/files/leapp_upgrade_repositories
owner: root
group: root
mode: "0644"
loop: "{{ local_repos_leapp }}"
vars:
__repos: "{{ local_repos_leapp }}"
__leapp_repo_file: /etc/leapp/files/leapp_upgrade_repositories
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when:
- leapp_upgrade_type == 'custom'
- local_repos_leapp | length > 0
Expand Down
8 changes: 5 additions & 3 deletions roles/upgrade/tasks/redhat-upgrade-tool-post-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
failed_when: false
changed_when: true

- name: redhat-upgrade-tool-post-upgrade | Include custom-local-repos.yml for local_repos_post_upgrade
- name: redhat-upgrade-tool-post-upgrade | Include custom_local_repos for local_repos_post_upgrade
vars:
__local_repos: "{{ local_repos_post_upgrade }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_post_upgrade }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: redhat-upgrade-tool-post-upgrade | Include check-for-old-packages.yml
Expand Down
8 changes: 5 additions & 3 deletions roles/upgrade/tasks/redhat-upgrade-tool-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
failed_when: false
changed_when: true

- name: redhat-upgrade-tool-upgrade | Include custom-local-repos.yml local_repos_post_upgrade
- name: redhat-upgrade-tool-upgrade | Include custom_local_repos for local_repos_post_upgrade
vars:
__local_repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_tasks: custom-local-repos.yml
__repos: "{{ local_repos_pre_leapp }}"
ansible.builtin.include_role:
name: infra.leapp.common
tasks_from: custom_local_repos
when: leapp_upgrade_type == "custom"

- name: redhat-upgrade-tool-upgrade | Gather package facts
Expand Down
Loading