forked from uyuni-project/uyuni-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use the new help functions in mgradm uninstall command
- Loading branch information
Showing
4 changed files
with
62 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,45 @@ | ||
// SPDX-FileCopyrightText: 2023 SUSE LLC | ||
// SPDX-FileCopyrightText: 2024 SUSE LLC | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package uninstall | ||
|
||
import ( | ||
"github.com/rs/zerolog/log" | ||
"github.com/spf13/cobra" | ||
"github.com/uyuni-project/uyuni-tools/shared/podman" | ||
"github.com/uyuni-project/uyuni-tools/shared/types" | ||
"github.com/uyuni-project/uyuni-tools/shared/utils" | ||
) | ||
|
||
func uninstallForPodman(dryRun bool, purge bool) { | ||
func uninstallForPodman( | ||
globalFlags *types.GlobalFlags, | ||
flags *uninstallFlags, | ||
cmd *cobra.Command, | ||
args []string, | ||
) error { | ||
|
||
// Uninstall the service | ||
podman.UninstallService("uyuni-server", dryRun) | ||
podman.UninstallService("uyuni-server", flags.DryRun) | ||
|
||
// Force stop the pod | ||
podman.DeleteContainer(podman.ServerContainerName, dryRun) | ||
podman.DeleteContainer(podman.ServerContainerName, flags.DryRun) | ||
|
||
// Remove the volumes | ||
if purge { | ||
if flags.PurgeVolumes { | ||
volumes := []string{"cgroup"} | ||
for volume := range utils.VOLUMES { | ||
volumes = append(volumes, volume) | ||
} | ||
for _, volume := range volumes { | ||
podman.DeleteVolume(volume, dryRun) | ||
podman.DeleteVolume(volume, flags.DryRun) | ||
} | ||
log.Info().Msg("All volumes removed") | ||
} | ||
|
||
podman.DeleteNetwork(dryRun) | ||
podman.DeleteNetwork(flags.DryRun) | ||
|
||
podman.ReloadDaemon(dryRun) | ||
podman.ReloadDaemon(flags.DryRun) | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters