Using set -e in all of our scripts will prevent some subtle bugs
from slipping in, and will allow us to enforce use of set -e with
tooling.
This change also adds -u and set -o pipefail in the less complex
scripts where it is unlikely to cause problems. A follow-up change
will enable those options in the complex scripts so that if it
breaks something it can be reverted easily.
Change-Id: I0ad358ccb98da7277a0ee2e9ce8fda98438675eb
When high VM churn is encountered dhcp-all-interfaces got tangled up
and leaked instances until upstart run out of filedescriptors.
This happened because we were locking on every invocation, and the
lock logic was disabling the single-interface code - so we always
probed every interface every time - and this was serialized across
every instance of dhcp-all-interfaces.
Change-Id: I4ef1fb83d978cc99d4cb9cc2666bde302c6db7d1
Corrects an issue in the config_exists function that could
cause duplicate interfaces to be configured on Ubuntu.
Previously we used 'return ifquery' directly which caused
a silent 'numberic argument required' error to go unnoticed.
This would also return 1 meaning a new interface would get
configured.
The new logic should handle things properly.
Change-Id: I625225e15113d7e184e3bcb5054df1616dec008a
Closes-bug: #1298430
Refactors dhcp-all-interfaces.sh so that if an optional
INTERFACE argument (the first argument) is passed to the script
it only inspects that single interface. If no argument is
passed then the previous default behaviour is used which
causes all interfaces to be inspected.
To avoid a collision with the previous $1 we move to using
$FLOCKED for the exec flock command which runs on distributions
using ENI.
Also sets PATH so that the commands within the script
can all be found if it isn't set properly (/sbin/ip, /bin/cat, etc.)
This is a move towards using udev rules to add these types
of interfaces automatically.
Change-Id: I3ec8fd2cc2071bfc6943c744ca619e31b71146fc
Refactors dhcp-all-interfaces.sh so that if an optional
INTERFACE argument (the first argument) is passed to the script
it only inspects that single interface. If no argument is
passed then the previous default behaviour use used which
causes all interfaces to be inspected.
Also sets PATH so that the commands within the script
can all be found if it isn't set properly (/sbin/ip, /bin/cat, etc.)
This is a move towards using udev rules to add these types
of interfaces automatically.
Change-Id: Ia482c1d3ddce0f0d8d77f9bc3ac76d6924640715
Updates dhcp-all-interfaces so that we avoid using
ifquery on Fedora to determine if an interface exists.
Adds a new config_exists function which simply looks for
the ifcfg config file on distro's that use netscripts.
Change-Id: Ie55524b83820fe4fab28cc9d3f7e08ca2e42c182
Rename generate-interfaces-file.sh to dhcp-all-interfaces.sh
so that it is easier to find/remember in the $PATH on a deployed
image.
Also, on some distros the script actually generates many files
so the previous name was a bit confusing.
Change-Id: I7152fa7c28e8ade251311da2cd5f75972423b66c