Skip to content

Commit

Permalink
Merge pull request #210 from nrhodes91/206-check-yum-lock-after-sleep
Browse files Browse the repository at this point in the history
Move the apply phase sleep to before pre-scripts and package manager lock checks
  • Loading branch information
rhodesn authored Feb 13, 2019
2 parents 57fba3c + 452178c commit 17af31e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 6 additions & 3 deletions auter.aptModule
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,16 @@ function apply_updates() {
if [[ "${AVAILABLE_PACKAGE_COUNT}" -gt 0 ]]; then
local PACKAGES_BEFORE
local PACKAGES_AFTER
for SCRIPT in "${PREAPPLYSCRIPTDIR}"/*; do
run_script "${SCRIPT}" "Pre-Apply"
done

# Sleep before running pre-scripts and updates
SLEEP_DELAY=$((RANDOM % MAXDELAY))
[[ ${SLEEP_DELAY} -gt 1 ]] && logit "INFO: Sleeping for ${SLEEP_DELAY} seconds"
sleep ${SLEEP_DELAY}

for SCRIPT in "${PREAPPLYSCRIPTDIR}"/*; do
run_script "${SCRIPT}" "Pre-Apply"
done

logit "INFO: Applying updates"
PACKAGES_BEFORE=$(dpkg --list)

Expand Down
8 changes: 5 additions & 3 deletions auter.yumdnfModule
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,18 @@ function apply_updates() {

# If check-update has an exit code of 100, updates are available.
if [[ "${RC}" -eq 100 ]]; then
# Sleep before continuing with pre-scripts and updates
SLEEP_DELAY=$((RANDOM % MAXDELAY))
[[ ${SLEEP_DELAY} -gt 1 ]] && logit "INFO: Sleeping for ${SLEEP_DELAY} seconds"
sleep ${SLEEP_DELAY}

# Check for yum.lock file
check_package_manager_lock

for SCRIPT in "${PREAPPLYSCRIPTDIR}"/*; do
run_script "${SCRIPT}" "Pre-Apply"
done

SLEEP_DELAY=$((RANDOM % MAXDELAY))
[[ ${SLEEP_DELAY} -gt 1 ]] && logit "INFO: Sleeping for ${SLEEP_DELAY} seconds"
sleep ${SLEEP_DELAY}
logit "INFO: Applying updates"
HISTORY_BEFORE=$(${PACKAGE_MANAGER} history list)

Expand Down

0 comments on commit 17af31e

Please sign in to comment.