mirror of
https://github.com/containers/podman.git
synced 2025-06-24 19:42:56 +08:00
Remove
: remove files and connections
Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
This commit is contained in:
@ -342,6 +342,17 @@ func (m *HyperVMachine) collectFilesToDestroy(opts machine.RemoveOptions, diskPa
|
||||
return files
|
||||
}
|
||||
|
||||
func (m *HyperVMachine) removeFilesAndConnections(files []string) {
|
||||
for _, f := range files {
|
||||
if err := os.Remove(f); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
if err := machine.RemoveConnections(m.Name, m.Name+"-root"); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, func() error, error) {
|
||||
var (
|
||||
files []string
|
||||
@ -372,14 +383,7 @@ func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, fu
|
||||
|
||||
confirmationMessage += "\n"
|
||||
return confirmationMessage, func() error {
|
||||
for _, f := range files {
|
||||
if err := os.Remove(f); err != nil && !errors.Is(err, os.ErrNotExist) {
|
||||
logrus.Error(err)
|
||||
}
|
||||
}
|
||||
if err := machine.RemoveConnections(m.Name, m.Name+"-root"); err != nil {
|
||||
logrus.Error(err)
|
||||
}
|
||||
m.removeFilesAndConnections(files)
|
||||
|
||||
// Remove the HVSOCK for networking
|
||||
if err := m.NetworkHVSock.Remove(); err != nil {
|
||||
|
Reference in New Issue
Block a user