Skip to content

Commit 5d069ff

Browse files
committed
Disable Ubuntu unattended upgrade also in update component
Signed-off-by: Luca Carrogu <carrogu@amazon.com>
1 parent 01ccffe commit 5d069ff

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,10 @@ phases:
198198
grub2-mkconfig -o /boot/grub2/grub.cfg
199199
fi
200200
elif [[ ${!PLATFORM} == DEBIAN ]]; then
201-
[ ${CfnParamUpdateOsAndReboot} == false ] && flock $(apt-config shell StateDir Dir::State/d | sed -r "s/.*'(.*)\/?'$/\1/")/daily_lock systemctl stop apt-daily.timer apt-daily.service apt-daily-upgrade.timer apt-daily-upgrade.service
202-
sed -i "s/Update-Package-Lists \"1\"/Update-Package-Lists \"0\"/g" /etc/apt/apt.conf.d/20auto-upgrades
203-
sed -i "s/Unattended-Upgrade \"1\"/Unattended-Upgrade \"0\"/g" /etc/apt/apt.conf.d/20auto-upgrades
201+
if [[ "${CfnParamUpdateOsAndReboot}" == "false" ]]; then
202+
flock $(apt-config shell StateDir Dir::State/d | sed -r "s/.*'(.*)\/?'$/\1/")/daily_lock systemctl disable --now apt-daily.timer apt-daily.service apt-daily-upgrade.timer apt-daily-upgrade.service
203+
sed "/Update-Package-Lists/s/\"1\"/\"0\"/; /Unattended-Upgrade/s/\"1\"/\"0\"/;" /etc/apt/apt.conf.d/20auto-upgrades > "/etc/apt/apt.conf.d/51pcluster-unattended-upgrades"
204+
fi
204205
apt-cache search build-essential
205206
apt-get clean
206207
apt-get -y update

cli/src/pcluster/resources/imagebuilder/update_and_reboot.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ phases:
117117
yum -y install kernel-devel
118118
elif [[ ${!PLATFORM} == DEBIAN ]]; then
119119
while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done
120-
flock $(apt-config shell StateDir Dir::State/d | sed -r "s/.*'(.*)\/?'$/\1/")/daily_lock systemctl stop apt-daily.timer apt-daily.service apt-daily-upgrade.timer apt-daily-upgrade.service
120+
flock $(apt-config shell StateDir Dir::State/d | sed -r "s/.*'(.*)\/?'$/\1/")/daily_lock systemctl disable --now apt-daily.timer apt-daily.service apt-daily-upgrade.timer apt-daily-upgrade.service
121+
sed "/Update-Package-Lists/s/\"1\"/\"0\"/; /Unattended-Upgrade/s/\"1\"/\"0\"/;" /etc/apt/apt.conf.d/20auto-upgrades > "/etc/apt/apt.conf.d/51pcluster-unattended-upgrades"
121122
DEBIAN_FRONTEND=noninteractive apt-get -y update && apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" --with-new-pkgs upgrade && apt-get --purge autoremove -y
122123
apt-get -y install linux-aws
123124
fi
@@ -149,4 +150,4 @@ phases:
149150
inputs:
150151
commands:
151152
- |
152-
echo "Check the OS has been updated"
153+
echo "Check the OS has been updated"

0 commit comments

Comments
 (0)