Merge "Unhardcode AZ"
diff --git a/trymos/image_build/files/etc/cloud/cloud.cfg b/trymos/image_build/files/etc/cloud/cloud.cfg
index 94b618d..19f04cd 100644
--- a/trymos/image_build/files/etc/cloud/cloud.cfg
+++ b/trymos/image_build/files/etc/cloud/cloud.cfg
@@ -38,7 +38,6 @@
- grub-dpkg
- apt-pipelining
- apt-configure
- - package-update-upgrade-install
- landscape
- timezone
- puppet
diff --git a/trymos/image_build/files/usr/share/trymos/launch.sh b/trymos/image_build/files/usr/share/trymos/launch.sh
index eeefa88..08c5e38 100755
--- a/trymos/image_build/files/usr/share/trymos/launch.sh
+++ b/trymos/image_build/files/usr/share/trymos/launch.sh
@@ -106,7 +106,10 @@
local cloud_netplan_cfg="/etc/netplan/50-cloud-init.yaml"
local match_ip_line
- DEBIAN_FRONTEND=noninteractive apt -y install bridge-utils
+ function install_bridgeutils_retry {
+ DEBIAN_FRONTEND=noninteractive apt -y install bridge-utils
+ }
+ retry 20 "Failed to install bridge-utils" install_bridgeutils_retry
cat << EOF > /etc/systemd/network/10-veth-phy-br.netdev
[NetDev]
@@ -405,16 +408,39 @@
cat ${_TRYMOS_INFO_FILE}
}
+function wait_dpkg_finished {
+ local timeout=${1:-600}
+ local delay=${2:-10}
+ dpkg_lock="/var/lib/dpkg/lock-frontend"
+
+ end=$(date +%s)
+ end=$((end + timeout))
+
+ while true; do
+ if lsof ${dpkg_lock} 2>&1 > /dev/null ; then
+ sleep $delay
+ now=$(date +%s)
+ if [ $now -gt $end ] ; then
+ echo "dpkg process still running"
+ exit 1
+ fi
+ else
+ break
+ fi
+ done
+}
+
case "$NODE_TYPE" in
# Please keep the "prepare_metadata_files", "disable-rp-filter", "network_config" and "prepare_network" functions
# at the very beginning in the same order.
trymos)
+ install_required_packages
+ wait_dpkg_finished
disable_rp_filter
configure_virt_public_iface
network_config
prepare_network
prepare_docker_config
- install_required_packages
configure_ntp
configure_atop
workaround_default_forward_policy