Skip to content

Commit 79e8a09

Browse files
committed
Yum or subscription-manager may fail on an unstable network
Adding retry is a workaround for mitigating random networking issues.
1 parent 2ffdfee commit 79e8a09

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

fragments/bastion-boot.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ then
153153
else
154154
verify_os_collect_config_is_installed
155155

156-
yum -y install git httpd-tools ||
156+
retry yum -y install git httpd-tools ||
157157
notify_failure "could not install httpd-tools"
158158

159159
# ensure openssl is installed on CentOS
160-
yum -y install pyOpenSSL ||
160+
retry yum -y install pyOpenSSL ||
161161
notify_failure "could not install pyOpenSSL"
162162

163163
extra_opts=""
@@ -175,7 +175,7 @@ else
175175
$OPENSHIFT_ANSIBLE_GIT_URL \
176176
$OPENSHIFT_ANSIBLE_GIT_REV
177177
else
178-
yum -y install openshift-ansible-roles openshift-ansible-playbooks \
178+
retry yum -y install openshift-ansible-roles openshift-ansible-playbooks \
179179
|| notify_failure "could not install openshift-ansible"
180180
fi
181181
fi

fragments/common_openshift_functions.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function sudo_set_secure_path() {
1717
function docker_install_and_enable() {
1818
if ! rpm -q docker
1919
then
20-
yum -y install docker || notify_failure "could not install docker"
20+
retry yum -y install docker || notify_failure "could not install docker"
2121
fi
2222
systemctl enable docker
2323
}

fragments/host-update.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ then
2828
atomic host upgrade || notify_failure "failed to run 'atomic host upgrade'"
2929
else
3030
# Update using traditional RPMs
31-
yum install -y deltarpm || notify_failure "could not install deltarpm"
32-
[ "$SYSTEM_UPDATE" = "True" ] && (yum -y update || notify_failure "could not update RPMs")
31+
retry yum install -y deltarpm || notify_failure "could not install deltarpm"
32+
[ "$SYSTEM_UPDATE" = "True" ] && (retry yum -y update || notify_failure "could not update RPMs")
3333
fi

fragments/rhn-register.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function install_sat6_ca_certs() {
4141
local SAT6_KEY_RPM_URL="https://${1}/pub/katello-ca-consumer-latest.noarch.rpm"
4242

4343
if ! rpm -q --quiet $SAT6_KEY_RPM ; then
44-
yum -y install $SAT6_KEY_RPM_URL
44+
retry yum -y install $SAT6_KEY_RPM_URL
4545
fi
4646
}
4747

@@ -67,18 +67,18 @@ fi
6767

6868
# Attach to an entitlement pool
6969
if [ -n "$POOL_ID" ]; then
70-
subscription-manager attach --pool $POOL_ID
70+
retry subscription-manager attach --pool $POOL_ID
7171
else
72-
subscription-manager attach --auto
72+
retry subscription-manager attach --auto
7373
fi
7474

7575
if [ -n "$EXTRA_POOL_IDS" ]; then
76-
subscription-manager attach --pool $EXTRA_POOL_IDS
76+
retry subscription-manager attach --pool $EXTRA_POOL_IDS
7777
fi
7878

7979
# Select the YUM repositories to use
80-
subscription-manager repos --disable="*"
81-
subscription-manager repos \
80+
retry subscription-manager repos --disable="*"
81+
retry subscription-manager repos \
8282
--enable="rhel-7-server-rpms" \
8383
--enable="rhel-7-server-extras-rpms" \
8484
--enable="rhel-7-server-optional-rpms" \

0 commit comments

Comments
 (0)