Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cleanup feature as part of command set
The 'cleanup' methods should ignore as many errors as possible when doing their job, to cope with both the nominal case, and cases where some of the checks are disabled/skipped. Which would mean we don't need to check the config options, as the 'cleanup' method will be appropriate in both cases. As of now, cleanup command for linux is partial since we are not sure if virt installed packages as part of setup command or by the user. Also user added himself as part of libvirt group or it happened by setup command.
- Loading branch information
1 parent
27c3e22
commit 51fe265
Showing
7 changed files
with
212 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/code-ready/crc/pkg/crc/output" | ||
"github.com/code-ready/crc/pkg/crc/preflight" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func init() { | ||
rootCmd.AddCommand(cleanupCmd) | ||
} | ||
|
||
var cleanupCmd = &cobra.Command{ | ||
Use: "cleanup", | ||
Short: fmt.Sprintf("Undo config changes"), | ||
Long: "Undo all the configuration changes done by 'crc setup' command", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
runCleanup(args) | ||
}, | ||
} | ||
|
||
func runCleanup(arguments []string) { | ||
preflight.CleanUpHost() | ||
output.Outln("Cleanup finished") | ||
} |
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
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