Skip to content

Commit f738818

Browse files
[sonic-package-manager] stop service explicitelly before uninstalling package (#1805)
#### What I did Fixed an issue with uninstall. 1. When disabling the feature by setting its state to disabled in FEATURE table and then uninstalling it, there is a possibility that service hasn't fully stopped yet. 2. When uninstalling with --force option, and reinstalling the package with --enable option the service does not start. #### How I did it Stop and disable service explicitely before uninstalling package. #### How to verify it ``` sudo spm uninstall cpu-report --force && sudo spm install cpu-report=10.0.0 -v DEBUG -y --enable && docker ps ```
1 parent d8ee5e9 commit f738818

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

sonic_package_manager/manager.py

+11
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,17 @@ def uninstall(self, name: str, force=False):
435435
# After all checks are passed we proceed to actual uninstallation
436436

437437
try:
438+
# Stop and disable the service.
439+
# First to make sure we are not uninstalling
440+
# package before the service has fully stopped
441+
# since "config feature state" command is not blocking.
442+
# Second, we make sure the service is in disabled state
443+
# so that after reinstall and enablement hostcfgd will enable
444+
# it and start it.
445+
# TODO: once there is a way to block till hostcfgd will stop
446+
# the service, replace it with new approach.
447+
self._systemctl_action(package, 'stop')
448+
self._systemctl_action(package, 'disable')
438449
self._uninstall_cli_plugins(package)
439450
self.service_creator.remove(package)
440451
self.service_creator.generate_shutdown_sequence_files(

0 commit comments

Comments
 (0)