Skip to content

Commit

Permalink
fix: rename user-defined repo filename and improve parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
some-things committed Aug 21, 2024
1 parent c37a61f commit 6809b18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bundles/redhat8.6/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ if [[ -n "${KUBERNETES_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},kubernetes"
fi

if [[ -f /etc/yum.repos.d/user-repos.repo ]]; then
USER_REPOS="$(awk -F '[][]' '/^\[.*\]/ {print $2}' /etc/yum.repos.d/user-repos.repo | paste -sd, -)"
if [[ -f /etc/yum.repos.d/additional-repos.repo ]]; then
USER_REPOS="$(/usr/libexec/platform-python3.6 -c "import configparser; config = configparser.ConfigParser(); config.read('/etc/yum.repos.d/additional-repos.repo'); print(','.join(config.sections()) if config.sections() else '')")"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${USER_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
Expand Down
4 changes: 2 additions & 2 deletions bundles/redhat8.8/bundle.sh.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ if [[ -n "${KUBERNETES_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},kubernetes"
fi

if [[ -f /etc/yum.repos.d/user-repos.repo ]]; then
USER_REPOS="$(awk -F '[][]' '/^\[.*\]/ {print $2}' /etc/yum.repos.d/user-repos.repo | paste -sd, -)"
if [[ -f /etc/yum.repos.d/additional-repos.repo ]]; then
USER_REPOS="$(/usr/libexec/platform-python3.6 -c "import configparser; config = configparser.ConfigParser(); config.read('/etc/yum.repos.d/additional-repos.repo'); print(','.join(config.sections()) if config.sections() else '')")"
if [[ -n "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
ENABLED_REPOS="${ENABLED_REPOS},${USER_REPOS}"
elif [[ -z "${ENABLED_REPOS}" ]] && [[ -n "${USER_REPOS}" ]]; then
Expand Down

0 comments on commit 6809b18

Please sign in to comment.