From 26cea075f2a0c2a8300eb8120ad8accb8cc2d2ae Mon Sep 17 00:00:00 2001
From: Mark Goddard <mark@stackhpc.com>
Date: Thu, 17 Sep 2020 14:20:02 +0100
Subject: [PATCH] Remove support for deprecated Yum variables

The variables in yum.yml and yum-cron.yml were deprecated in Ussuri.
This patch removes them, and updates the defaults in dnf.yml.

Story: 2008160
Task: 40906

Change-Id: I97cc98dd2ff726e5885fefcab17f17796d9fd453
---
 ansible/group_vars/all/dnf                    | 27 +++++--------
 ansible/group_vars/all/yum                    | 36 -----------------
 ansible/group_vars/all/yum-cron               |  6 ---
 doc/source/configuration/reference/hosts.rst  |  4 +-
 etc/kayobe/dnf.yml                            | 13 +-----
 etc/kayobe/yum-cron.yml                       | 12 ------
 etc/kayobe/yum.yml                            | 40 -------------------
 ...remove-yum-variables-0a1ab4e958c27171.yaml | 10 +++++
 8 files changed, 23 insertions(+), 125 deletions(-)
 delete mode 100644 ansible/group_vars/all/yum
 delete mode 100644 ansible/group_vars/all/yum-cron
 delete mode 100644 etc/kayobe/yum-cron.yml
 delete mode 100644 etc/kayobe/yum.yml
 create mode 100644 releasenotes/notes/remove-yum-variables-0a1ab4e958c27171.yaml

diff --git a/ansible/group_vars/all/dnf b/ansible/group_vars/all/dnf
index 8ce6193a2..31145f1a4 100644
--- a/ansible/group_vars/all/dnf
+++ b/ansible/group_vars/all/dnf
@@ -1,27 +1,24 @@
 ---
-# NOTE(mgoddard): Use Yum configuration for defaults for backwards
-# compatibility.
-
 # Yum configuration. Dict mapping Yum config option names to their values.
 # dnf_config:
 #   proxy: http://proxy.example.com
-dnf_config: "{{ yum_config }}"
+dnf_config: {}
 
 # Whether or not to use a local Yum mirror. Default value is 'false'.
-dnf_use_local_mirror: "{{ yum_use_local_mirror }}"
+dnf_use_local_mirror: false
 
 # Mirror FQDN for Yum repos. Default value is 'mirror.centos.org'.
-dnf_centos_mirror_host: "{{ yum_centos_mirror_host }}"
+dnf_centos_mirror_host: 'mirror.centos.org'
 
 # Mirror directory for Yum CentOS repos. Default value is 'centos'.
-dnf_centos_mirror_directory: "{{ yum_centos_mirror_directory }}"
+dnf_centos_mirror_directory: 'centos'
 
 # Mirror FQDN for Yum EPEL repos. Default value is
 # 'download.fedoraproject.org'.
-dnf_epel_mirror_host: "{{ yum_epel_mirror_host }}"
+dnf_epel_mirror_host: 'download.fedoraproject.org'
 
 # Mirror directory for Yum EPEL repos. Default value is 'pub/epel'.
-dnf_epel_mirror_directory: "{{ yum_epel_mirror_directory }}"
+dnf_epel_mirror_directory: 'pub/epel'
 
 # A dict of custom repositories.
 # You can see params on
@@ -33,20 +30,18 @@ dnf_epel_mirror_directory: "{{ yum_epel_mirror_directory }}"
 #     file: myrepo
 #     gpgkey: http://gpgkey
 #     gpgcheck: yes
-dnf_custom_repos: "{{ yum_custom_repos }}"
+dnf_custom_repos: {}
 
 # Whether to install the epel-release package. This affects RedHat-based
 # systems only. Default value is 'true'.
-dnf_install_epel: "{{ yum_install_epel }}"
+dnf_install_epel: true
 
 ###############################################################################
 # DNF Automatic configuration.
 
 # Whether DNF Automatic is enabled. This can be used to regularly apply
 # security updates. Default value is 'false'.
-dnf_automatic_enabled: "{{ yum_cron_enabled }}"
+dnf_automatic_enabled: false
 
-# DNF Automatic upgrade type. Default value is 'security'. Note that the
-# equivalent yum-cron variable is named slightly differently -
-# yum_automatic_update_cmd.
-dnf_automatic_upgrade_type: "{{ yum_cron_update_cmd }}"
+# DNF Automatic upgrade type. Default value is 'security'.
+dnf_automatic_upgrade_type: 'security'
diff --git a/ansible/group_vars/all/yum b/ansible/group_vars/all/yum
deleted file mode 100644
index f3fd955fe..000000000
--- a/ansible/group_vars/all/yum
+++ /dev/null
@@ -1,36 +0,0 @@
----
-# Yum configuration. Dict mapping Yum config option names to their values.
-# yum_config:
-#   proxy: http://proxy.example.com
-yum_config: {}
-
-# Whether or not to use a local Yum mirror.
-yum_use_local_mirror: false
-
-# Mirror FQDN for Yum repos.
-yum_centos_mirror_host: 'mirror.centos.org'
-
-# Mirror directory for Yum CentOS repos.
-yum_centos_mirror_directory: 'centos'
-
-# Mirror FQDN for Yum EPEL repos.
-yum_epel_mirror_host: 'download.fedoraproject.org'
-
-# Mirror directory for Yum EPEL repos.
-yum_epel_mirror_directory: 'pub/epel'
-
-# A dict of custom repositories.
-# You can see params on
-# http://docs.ansible.com/ansible/latest/modules/yum_repository_module.html.
-# For example:
-# yum_custom_repos:
-#   reponame:
-#     baseurl: http://repo
-#     file: myrepo
-#     gpgkey: http://gpgkey
-#     gpgcheck: yes
-yum_custom_repos: {}
-
-# Whether to install the epel-release package. This affects RedHat-based
-# systems only.
-yum_install_epel: true
diff --git a/ansible/group_vars/all/yum-cron b/ansible/group_vars/all/yum-cron
deleted file mode 100644
index 173ed1a36..000000000
--- a/ansible/group_vars/all/yum-cron
+++ /dev/null
@@ -1,6 +0,0 @@
----
-# Whether to enable Yum automatic updates.
-yum_cron_enabled: false
-
-# Command to use for Yum automatic updates.
-yum_cron_update_cmd: 'security'
diff --git a/doc/source/configuration/reference/hosts.rst b/doc/source/configuration/reference/hosts.rst
index 588413525..5722df25b 100644
--- a/doc/source/configuration/reference/hosts.rst
+++ b/doc/source/configuration/reference/hosts.rst
@@ -208,9 +208,7 @@ Package Repositories
   | ``dnf``
 
 Kayobe supports configuration of package repositories via DNF, via variables in
-``${KAYOBE_CONFIG_PATH}/dnf.yml``. For backwards compatibility, all variables
-in this section starting with ``dnf_`` default to the equivalently named Yum
-variable starting with ``yum_``.
+``${KAYOBE_CONFIG_PATH}/dnf.yml``.
 
 Configuration of dnf.conf
 -------------------------
diff --git a/etc/kayobe/dnf.yml b/etc/kayobe/dnf.yml
index cf52bb28f..cf09b86fd 100644
--- a/etc/kayobe/dnf.yml
+++ b/etc/kayobe/dnf.yml
@@ -4,10 +4,6 @@
 ###############################################################################
 # DNF repository configuration.
 
-# For backwards compatibility, all variables in this section default to the
-# equivalently named variables starting with 'yum_' instead of 'dnf_'.
-# The yum variables will be removed in a future release.
-
 # Yum configuration. Dict mapping Yum config option names to their values.
 # dnf_config:
 #   proxy: http://proxy.example.com
@@ -48,18 +44,11 @@
 ###############################################################################
 # DNF Automatic configuration.
 
-# For backwards compatibility, all variables in this section default to the
-# equivalently named variables starting with 'yum_cron' instead of
-# 'dnf_automatic'.  # The yum-cron variables will be removed in a future
-# release.
-
 # Whether DNF Automatic is enabled. This can be used to regularly apply
 # security updates. Default value is 'false'.
 #dnf_automatic_enabled:
 
-# DNF Automatic upgrade type. Default value is 'security'. Note that the
-# equivalent yum-cron variable is named slightly differently -
-# 'yum_cron_update_cmd'.
+# DNF Automatic upgrade type. Default value is 'security'.
 #dnf_automatic_upgrade_type:
 
 ###############################################################################
diff --git a/etc/kayobe/yum-cron.yml b/etc/kayobe/yum-cron.yml
deleted file mode 100644
index a93e8c4d5..000000000
--- a/etc/kayobe/yum-cron.yml
+++ /dev/null
@@ -1,12 +0,0 @@
----
-# DEPRECATED: Variables in this file are deprecated and will be removed in a
-# future release. Please use dnf.yml instead.
-
-# Whether to enable Yum automatic updates.
-#yum_cron_enabled: false
-# Command to use for Yum automatic updates.
-#yum_cron_update_cmd: 'security'
-
-###############################################################################
-# Dummy variable to allow Ansible to accept this file.
-workaround_ansible_issue_8743: yes
diff --git a/etc/kayobe/yum.yml b/etc/kayobe/yum.yml
deleted file mode 100644
index 31f16ce84..000000000
--- a/etc/kayobe/yum.yml
+++ /dev/null
@@ -1,40 +0,0 @@
----
-# DEPRECATED: Variables in this file are deprecated and will be removed in a
-# future release. Please use dnf.yml instead.
-
-# Yum configuration. Dict mapping Yum config option names to their values.
-# yum_config:
-#   proxy: http://proxy.example.com
-#yum_config:
-
-# Whether or not to use a local Yum mirror.
-#yum_use_local_mirror: false
-
-# Mirror FQDN for Yum repos.
-#yum_centos_mirror_host: 'mirror.centos.org'
-
-# Mirror directory for Yum CentOS repos.
-#yum_centos_mirror_directory: 'centos'
-# Mirror FQDN for Yum EPEL repos.
-#yum_epel_mirror_host: 'download.fedoraproject.org'
-# Mirror directory for Yum EPEL repos.
-#yum_epel_mirror_directory: 'pub/epel'
-# A dict of custom repositories.
-# You can see params on
-# http://docs.ansible.com/ansible/latest/modules/yum_repository_module.html.
-# For example:
-# yum_custom_repos:
-#   reponame:
-#     baseurl: http://repo
-#     file: myrepo
-#     gpgkey: http://gpgkey
-#     gpgcheck: yes
-#yum_custom_repos:
-
-# Whether to install the epel-release package. This affects RedHat-based
-# systems only.
-#yum_install_epel:
-
-###############################################################################
-# Dummy variable to allow Ansible to accept this file.
-workaround_ansible_issue_8743: yes
diff --git a/releasenotes/notes/remove-yum-variables-0a1ab4e958c27171.yaml b/releasenotes/notes/remove-yum-variables-0a1ab4e958c27171.yaml
new file mode 100644
index 000000000..2757aa59a
--- /dev/null
+++ b/releasenotes/notes/remove-yum-variables-0a1ab4e958c27171.yaml
@@ -0,0 +1,10 @@
+---
+upgrade:
+  - |
+    The Yum configuration variables in ``yum.yml`` which were deprecated in the
+    Ussuri release have been removed.  Adapt any configuration overrides to use
+    the DNF variables in ``dnf.yml`` instead.
+  - |
+    The yum-cron configuration variables in ``yum-cron.yml`` which were
+    deprecated in the Ussuri release have been removed. Adapt any configuration
+    overrides to use the DNF Automatic variables in ``dnf.yml``.