mirror of
https://github.com/containers/podman.git
synced 2025-06-25 03:52:15 +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
|
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) {
|
func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, func() error, error) {
|
||||||
var (
|
var (
|
||||||
files []string
|
files []string
|
||||||
@ -372,14 +383,7 @@ func (m *HyperVMachine) Remove(_ string, opts machine.RemoveOptions) (string, fu
|
|||||||
|
|
||||||
confirmationMessage += "\n"
|
confirmationMessage += "\n"
|
||||||
return confirmationMessage, func() error {
|
return confirmationMessage, func() error {
|
||||||
for _, f := range files {
|
m.removeFilesAndConnections(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)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove the HVSOCK for networking
|
// Remove the HVSOCK for networking
|
||||||
if err := m.NetworkHVSock.Remove(); err != nil {
|
if err := m.NetworkHVSock.Remove(); err != nil {
|
||||||
|
Reference in New Issue
Block a user