Enable cloud-init services based on boot paremeter
This commit enables the cloud-init systemd services based on presence of cloud-init=enabled boot parameter Test plan: PASS: - Boot ISO including cloud-init=enabled boot parameter. Validate that the cloud-init systemd services are enabled. Boot using a nocloud seed ISO. Verify that cloud-init functions as intended Story: 2011100 Task: 49971 Co-authored-by: Salman Rana <salman.rana@windriver.com> Change-Id: I1b934dd8f61a5bb342e1741db5ee0678221f2834 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com> Signed-off-by: Salman Rana <salman.rana@windriver.com>
This commit is contained in:
parent
4e62e3ac9f
commit
a6b612c8b3
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2022-2023 Wind River Systems, Inc.
|
# Copyright (c) 2022-2024 Wind River Systems, Inc.
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
@ -142,6 +142,21 @@ function report_failure_with_msg()
|
|||||||
reboot -f
|
reboot -f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Name : check_rc_with_msg
|
||||||
|
# Purpose : Check given return code, reporting failure if non-zero
|
||||||
|
# Parameters: \$1 is the exit code to check
|
||||||
|
# \$2 is the failure message string
|
||||||
|
# Return : Does not return if exit code is non-zero
|
||||||
|
########################################################################
|
||||||
|
function check_rc_with_msg {
|
||||||
|
local rc=\${1}
|
||||||
|
local msg=\${2}
|
||||||
|
if [ \${rc} -ne 0 ]; then
|
||||||
|
report_failure_with_msg "\${msg} [rc=\${rc}]"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Name : get_disk
|
# Name : get_disk
|
||||||
# Parameters: \$1 - any disk path
|
# Parameters: \$1 - any disk path
|
||||||
@ -371,6 +386,20 @@ function is_usb_install()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#########################################################################
|
||||||
|
# Name : enable_cloudinit
|
||||||
|
# Returns : true :0
|
||||||
|
# false:1
|
||||||
|
#########################################################################
|
||||||
|
function enable_cloudinit()
|
||||||
|
{
|
||||||
|
if grep -q 'cloud-init=enabled' /proc/cmdline; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
# Name : check_prestage
|
# Name : check_prestage
|
||||||
# Returns : true :0
|
# Returns : true :0
|
||||||
@ -3359,6 +3388,17 @@ if [ "${storage}" = true ] ; then
|
|||||||
ln -s /usr/share/starlingx/pmon.d/syslog-ng.conf ${IMAGE_ROOTFS}/etc/pmon.d/syslog-ng.conf
|
ln -s /usr/share/starlingx/pmon.d/syslog-ng.conf ${IMAGE_ROOTFS}/etc/pmon.d/syslog-ng.conf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if enable_cloudinit; then
|
||||||
|
ilog "Enabling cloud-init services"
|
||||||
|
mkdir -p "${IMAGE_ROOTFS}"/etc/systemd/system/cloud-init.target.wants
|
||||||
|
check_rc_with_msg $? "mkdir failed (cloud-init.target.wants)"
|
||||||
|
ln -s /usr/lib/systemd/system/cloud-config.service "${IMAGE_ROOTFS}"/etc/systemd/system/cloud-init.target.wants/cloud-config.service && \
|
||||||
|
ln -s /usr/lib/systemd/system/cloud-init-local.service "${IMAGE_ROOTFS}"/etc/systemd/system/cloud-init.target.wants/cloud-init-local.service && \
|
||||||
|
ln -s /usr/lib/systemd/system/cloud-init.service "${IMAGE_ROOTFS}"/etc/systemd/system/cloud-init.target.wants/cloud-init.service && \
|
||||||
|
ln -s /usr/lib/systemd/system/cloud-final.service "${IMAGE_ROOTFS}"/etc/systemd/system/cloud-init.target.wants/cloud-final.service
|
||||||
|
check_rc_with_msg $? "Failed to setup cloud-init services"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -e "/instboot/ks-addon.cfg" ]; then
|
if [ -e "/instboot/ks-addon.cfg" ]; then
|
||||||
ilog "Running kickstart addon script"
|
ilog "Running kickstart addon script"
|
||||||
source /instboot/ks-addon.cfg
|
source /instboot/ks-addon.cfg
|
||||||
|
Loading…
x
Reference in New Issue
Block a user