From c40c5c5509c6e46ac7a6a461082b769b9d1916b1 Mon Sep 17 00:00:00 2001 From: anujmaheshwari1 Date: Tue, 2 Apr 2024 08:51:09 -0700 Subject: [PATCH] chore: turn off ubuntu pro for non fips/1804 (#4221) Co-authored-by: anujmaheshwari1 --- vhdbuilder/packer/post-install-dependencies.sh | 9 ++++++--- vhdbuilder/packer/pre-install-dependencies.sh | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/vhdbuilder/packer/post-install-dependencies.sh b/vhdbuilder/packer/post-install-dependencies.sh index 637258fdbc6..0e3f4b067c3 100644 --- a/vhdbuilder/packer/post-install-dependencies.sh +++ b/vhdbuilder/packer/post-install-dependencies.sh @@ -45,9 +45,12 @@ if [[ $OS == $UBUNTU_OS_NAME ]]; then retrycmd_if_failure 10 2 60 apt-get -y autoremove --purge || exit 1 retrycmd_if_failure 10 2 60 apt-get -y clean || exit 1 - # Final step: log UA status, detach UA, and clean up - ua status - detachAndCleanUpUA + # Final step, if 18.04 or FIPS, log ua status, detach UA and clean up + if [[ "${UBUNTU_RELEASE}" == "18.04" ]] || [[ "${ENABLE_FIPS,,}" == "true" ]]; then + # 'ua status' for logging + ua status + detachAndCleanUpUA + fi fi stop_watch $capture_time "Log / Detach UA and Clean-up" false start_watch diff --git a/vhdbuilder/packer/pre-install-dependencies.sh b/vhdbuilder/packer/pre-install-dependencies.sh index e2b864dd6e0..df9b0a7dbbb 100644 --- a/vhdbuilder/packer/pre-install-dependencies.sh +++ b/vhdbuilder/packer/pre-install-dependencies.sh @@ -87,8 +87,10 @@ if [[ ${OS} == ${MARINER_OS_NAME} ]]; then installFIPS fi else - # Enable ESM on Ubuntu - autoAttachUA + # Enable ESM for 18.04 and FIPS only + if [[ "${UBUNTU_RELEASE}" == "18.04" ]] || [[ "${ENABLE_FIPS,,}" == "true" ]]; then + autoAttachUA + fi # Run apt get update to refresh repo list # Run apt dist get upgrade to install packages/kernels