~philroche/ubuntu-on-ec2/ec2-publishing-scripts-cloud-images-rsync-module

Viewing all changes in revision 667.

  • Committer: Robert C Jennings
  • Date: 2019-01-23 22:18:46 UTC
  • mfrom: (666.1.1 ec2-publishing-scripts)
  • Revision ID: robert.jennings@canonical.com-20190123221846-9dju53vg5wp8tkbd
Merge lp:~rcj/ubuntu-on-ec2/ec2-publishing-scripts into lp:~ubuntu-on-ec2/ubuntu-on-ec2/ec2-publishing-scripts [a=rcj] [r=codyshepherd,fginther]

run-instances: Extend associate-ip timeout and correct retry logic

The timeout is proving too short in production.  This patch extends the
timeout from 30s to 60s.

Additionally the logic was running the command to retry before
evaluating the loop counter and then the code would evaluate the
retry loop counter after the loop to determine failure.  This allows
for one last execution of the command (xc2 associate-address) on the 6th
time through the while loop but the while loop does not continue because
the other condition for the while '[ $n -lt 5]' would be false.  It is
possible (and was shown in production) that the command was succeeding
but only on the 6th attempt.  The code follow the while loop looked to
see that the loop had been run 6 times and automatically failed this
despite a success.  This patch changes the while evaluation to only look
at the counter conditional before the execution of the program in the
body of the while loop where success will break out from the loop early.
This should be much cleaner and easier to spot issues.

MP: https://code.launchpad.net/~rcj/ubuntu-on-ec2/ec2-publishing-scripts/+merge/362149

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: