diff --git a/vmupdate/agent/source/apt/apt_cli.py b/vmupdate/agent/source/apt/apt_cli.py index 561d556..6beb646 100644 --- a/vmupdate/agent/source/apt/apt_cli.py +++ b/vmupdate/agent/source/apt/apt_cli.py @@ -91,7 +91,9 @@ def get_action(self, remove_obsolete: bool) -> List[str]: """ Return command `upgrade` or `dist-upgrade` if `remove_obsolete`. """ - return ["dist-upgrade"] if remove_obsolete else ["upgrade"] + result = ["-y"] + result += ["dist-upgrade"] if remove_obsolete else ["upgrade"] + return result def clean(self) -> int: """ diff --git a/vmupdate/agent/source/common/package_manager.py b/vmupdate/agent/source/common/package_manager.py index 7844d8b..447b01e 100644 --- a/vmupdate/agent/source/common/package_manager.py +++ b/vmupdate/agent/source/common/package_manager.py @@ -267,7 +267,7 @@ def get_packages(self) -> Dict[str, List[str]]: def get_action(self, remove_obsolete: bool) -> List[str]: """ - Return command for upgrade or upgrade with removing obsolete packages. + Return command and options for upgrade with optional removing obsoletes. """ raise NotImplementedError() @@ -275,9 +275,7 @@ def upgrade_internal(self, remove_obsolete: bool) -> ProcessResult: """ Just run upgrade via CLI. """ - cmd = [self.package_manager, - "--noconfirm" if self.package_manager == "pacman" else "-y", - *self.get_action(remove_obsolete)] + cmd = [self.package_manager, *self.get_action(remove_obsolete)] return self.run_cmd(cmd) diff --git a/vmupdate/agent/source/dnf/dnf_cli.py b/vmupdate/agent/source/dnf/dnf_cli.py index 313b1e5..fbff8ab 100644 --- a/vmupdate/agent/source/dnf/dnf_cli.py +++ b/vmupdate/agent/source/dnf/dnf_cli.py @@ -95,8 +95,8 @@ def get_action(self, remove_obsolete) -> List[str]: Disable or enforce obsolete flag in dnf/yum. """ if remove_obsolete: - return ["--obsoletes", "upgrade"] - return ["--setopt=obsoletes=0", + return ["-y", "--obsoletes", "upgrade"] + return ["-y", "--setopt=obsoletes=0", "upgrade" if self.package_manager == "dnf" else "update"] def clean(self) -> int: diff --git a/vmupdate/agent/source/pacman/pacman_cli.py b/vmupdate/agent/source/pacman/pacman_cli.py index 88fc052..dc9476b 100644 --- a/vmupdate/agent/source/pacman/pacman_cli.py +++ b/vmupdate/agent/source/pacman/pacman_cli.py @@ -65,7 +65,7 @@ def get_action(self, remove_obsolete) -> List[str]: """ Pacman will handle obsoletions itself """ - return ["-Syu"] + return ["--noconfirm", "-Syu"] def clean(self) -> int: """