Salman Rana a3f8b7adda Enable enroll-init: post factory-install reconfiguration
These changes ensure that a standalone node is in the correct state
for reconfiguration (for DC enrollment)  after a successful factory-install.
This is achieved by ensuring:
- Factory install services are cleaned up.
- Cloud-init services remain enabled and active.

To facilitate enrollment initialization, two new scripts
are being introduced in the platform-util package:
1. enroll-init-cleanup: Removes the cloud-init preset set by factory-install
   and sets service disabled flag.
2. enroll-init-reconfigure: A newly introduced script that allows OAM
   and password reconfiguration, ensuring:
     - The password change is done after system services are active.
     - OAM reconfiguration is done via system commands.
    This is required as outlined in
    https://review.opendev.org/c/starlingx/distcloud/+/921719

These scripts must be independent of the factory-install services
and available on the platform for DCManager operations. Hence, they
are not part of factory-install services but are included
in the platform-util package.

Additionally, a minor restructuring of factory-install services is done as part of these changes:
- Moved the host config folder to the parent folder.
This is more appropriate as the top-level folder already holds
the cloud-init configurable files. The factory-install folder
is meant for the static  service files.
- Introduced a utils folder/scripts for the factory-install services.

Test plan:
- PASS: Validate factory-install services:
        - config files copied correctly to home dir
        - factory install utils copied to
          /var/lib/factory-install dir
        - cloud-init preset after successful install
        - factory install services cleaned up
- PASS: Validate full factory install
- PASS: Build iso and install load to ensure
        platform-util package is installed
        with enroll-init-cleanup and enroll-init-reconfigure
        scripts in /usr/local/bin
- PASS: Validate enroll-init-cleanup and enroll-init-reconfigure scripts:
        - Password persisted and OAM reconfiguration verified with
          system oam-show + endpoints updated
        - cloud-init services disabled (not restarted on reboot)

Story: 2011100
Task: 50164

Change-Id: I9a99c53c6fe6590716ad3d5d59663c8e6c475db5
Signed-off-by: Salman Rana <salman.rana@windriver.com>
2024-06-20 15:36:55 -04:00

62 lines
2.7 KiB
Makefile
Executable File

#!/usr/bin/make -f
#export DH_VERBOSE = 1
DEBIAN_BUILDDIR := $(CURDIR)/debian/tmp
%:
dh $@ --with python3 --buildsystem=pybuild
# do nothing here since we install stuff into /usr/local
override_dh_usrlocal:
echo
override_dh_auto_clean:
cd platform-util && python3 setup.py clean
override_dh_auto_build:
cd platform-util && python3 setup.py build
override_dh_auto_configure:
echo "CONFIGURE NOT REQUIRED"
override_dh_auto_test:
echo "AUTO TEST NOT REQUIRED"
override_dh_auto_install:
cd platform-util && python3 setup.py install -f --install-layout=deb --root=$(CURDIR)/debian/tmp
cd platform-util && python3 setup.py bdist_wheel \
--universal \
-d $(CURDIR)/debian/platform-util-wheel/usr/share/python3-wheels
install -d $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/update-iso.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/update-dm.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/gen-bootloader-iso.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/gen-bootloader-iso-centos.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/ipmicap.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/stx-iso-utils.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/stx-iso-utils-centos.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/show-certs.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/update_docker_registry_auth.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/change_system_private_registry.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/is-rootdisk-device.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/local_starlingxrc $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 555 scripts/kubeconfig-setup $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 755 scripts/connectivity_test $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 750 scripts/set_keystone_user_option.sh $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 750 scripts/enroll-init-cleanup $(DEBIAN_BUILDDIR)/usr/local/bin/
install -m 750 scripts/enroll-init-reconfigure $(DEBIAN_BUILDDIR)/usr/local/bin/
install -d $(DEBIAN_BUILDDIR)/usr/local/sbin/
install -m 700 -p -D scripts/patch-restart-mtce $(DEBIAN_BUILDDIR)/usr/local/sbin/
install -m 700 -p -D scripts/patch-restart-processes $(DEBIAN_BUILDDIR)/usr/local/sbin/
install -m 700 -p -D scripts/patch-restart-haproxy $(DEBIAN_BUILDDIR)/usr/local/sbin/
dh_install
override_dh_fixperms:
dh_fixperms -Xupdate-iso.sh -Xpatch-dm.sh -Xgen-bootloader-iso.sh -Xstx-iso-utils.sh \
-Xshow-certs.sh -Xupdate_docker_registry_auth.sh -Xchange_system_private_registry.sh \
-Xis-rootdisk-device.sh -Xlocal_starlingxrc -Xkubeconfig-setup -Xpatch-restart-* \
-Xconnectivity_test -Xset_keystone_user_option.sh -Xenroll-init-*