Skip to content

Commit

Permalink
Fix for hosts without yum-utils package hitachienergy#536
Browse files Browse the repository at this point in the history
  • Loading branch information
to-bar committed Oct 10, 2019
1 parent ec1abf0 commit 1eb988c
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- sysstat
- python-setuptools
- openssl
- yum-utils
- yum-versionlock
- logrotate
- ebtables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@ enabled=1
gpgcheck=0
EOF

yum-config-manager --enable epirepo
yum makecache fast
yum repolist
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/bin/bash -eu

REPOS_LIST_FILE=/var/tmp/enabled-system-repos.txt
YUM_REPOS_BACKUP_FILE=/etc/yum.repos.d/yum.repos.d-epi-backup.tar

cat $REPOS_LIST_FILE | while read repository
do
echo "Disabling repository: $repository"
yum-config-manager --disable $repository
done
if yum-config-manager --version > /dev/null 2>&1; then
cat $REPOS_LIST_FILE | while read repository
do
echo "Disabling repository: $repository"
yum-config-manager --disable $repository
done
elif [ ! -f $YUM_REPOS_BACKUP_FILE ]; then # for hosts where yum-utils is not available
echo "Disabling all yum repositories by backup & remove files in /etc/yum.repos.d"
tar -cv --verify --directory="/" --file=$YUM_REPOS_BACKUP_FILE /etc/yum.repos.d &&
rm -f /etc/yum.repos.d/*.repo
fi
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
#!/bin/bash -eu

REPOS_LIST_FILE=/var/tmp/enabled-system-repos.txt
YUM_REPOS_BACKUP_FILE=/etc/yum.repos.d/yum.repos.d-epi-backup.tar

cat $REPOS_LIST_FILE | while read repository
do
echo "Enabling repository: $repository"
yum-config-manager --enable $repository
done
if [ -f $YUM_REPOS_BACKUP_FILE ]; then # hosts without yum-config-manager
echo "Restoring /etc/yum.repos.d/*.repo from: $YUM_REPOS_BACKUP_FILE"
if tar -xv --file $YUM_CONFIG_BACKUP_FILE_PATH --directory /etc/yum.repos.d \
--strip-components=2 etc/yum.repos.d/*.repo; then
echo "yum repositories restored"
rm -f $YUM_REPOS_BACKUP_FILE
else
echo "Extracting tar failed: $YUM_REPOS_BACKUP_FILE"
exit 2
fi
else # hosts with yum-config-manager
cat $REPOS_LIST_FILE | while read repository
do
echo "Enabling repository: $repository"
yum-config-manager --enable $repository
done
fi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ wget
xorg-x11-font-utils # for grafana
xorg-x11-server-utils # for grafana
yum-plugin-versionlock
yum-utils

[files]
https://github.com/prometheus/haproxy_exporter/releases/download/v0.10.0/haproxy_exporter-0.10.0.linux-amd64.tar.gz
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ wget
xorg-x11-font-utils # for grafana
xorg-x11-server-utils # for grafana
yum-plugin-versionlock
yum-utils

[files]
https://github.com/prometheus/haproxy_exporter/releases/download/v0.10.0/haproxy_exporter-0.10.0.linux-amd64.tar.gz
Expand Down

0 comments on commit 1eb988c

Please sign in to comment.