From 03273de164cacb6ce2441cf2b592f0b205662f54 Mon Sep 17 00:00:00 2001 From: pjcreath Date: Wed, 14 Mar 2018 16:25:19 -0400 Subject: [PATCH 1/2] bootstrap-salt.sh: fix for silently ignored version argument on CentOS/RHEL This commit adds a warning when a pre-existing saltstack.repo on CentOS/RHEL causes the version argument to be ignored. It also allows the -F (forced overwrite) option to override this situation, overwriting the saltstack.repo file, and thus installing the specified version. Resolves #1209. --- bootstrap-salt.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index 056a256..d3951b9 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3562,7 +3562,7 @@ __install_saltstack_rhel_repository() { gpg_key="SALTSTACK-GPG-KEY.pub" repo_file="/etc/yum.repos.d/saltstack.repo" - if [ ! -s "$repo_file" ]; then + if [ ! -s "$repo_file" ] || [ "$_FORCE_OVERWRITE" -eq $BS_TRUE ]; then cat <<_eof > "$repo_file" [saltstack] name=SaltStack ${repo_rev} Release Channel for RHEL/CentOS \$releasever @@ -3576,6 +3576,9 @@ _eof fetch_url="${HTTP_VAL}://${_REPO_URL}/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" __rpm_import_gpg "${fetch_url}${gpg_key}" || return 1 + elif [ "$repo_rev" != "latest" ]; then + echowarn "saltstack.repo already exists, ignoring salt version argument." + echowarn "Use -F (forced overwrite) to install $repo_rev." fi return 0 From 056f8d8a3998651a9e2fa1ace81748499f8a97eb Mon Sep 17 00:00:00 2001 From: pjcreath Date: Fri, 16 Mar 2018 20:10:23 -0400 Subject: [PATCH 2/2] Add 'yum clean metadata' after updating the saltstack.repo file as requested. According to https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/sec-working_with_yum_cache this option "eliminates all files that yum uses to determine the remote availability of packages." --- bootstrap-salt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/bootstrap-salt.sh b/bootstrap-salt.sh index d3951b9..04f8caf 100755 --- a/bootstrap-salt.sh +++ b/bootstrap-salt.sh @@ -3576,6 +3576,7 @@ _eof fetch_url="${HTTP_VAL}://${_REPO_URL}/yum/redhat/${DISTRO_MAJOR_VERSION}/${CPU_ARCH_L}/${repo_rev}/" __rpm_import_gpg "${fetch_url}${gpg_key}" || return 1 + yum clean metadata || return 1 elif [ "$repo_rev" != "latest" ]; then echowarn "saltstack.repo already exists, ignoring salt version argument." echowarn "Use -F (forced overwrite) to install $repo_rev."