github.com/containers/podman/v4@v4.9.4/pkg/machine/e2e/config_rm_test.go (about)

     1  package e2e_test
     2  
     3  type rmMachine struct {
     4  	/*
     5  	  -f, --force           Stop and do not prompt before rming
     6  	      --save-ignition   Do not delete ignition file
     7  	      --save-image      Do not delete the image file
     8  	      --save-keys       Do not delete SSH keys
     9  
    10  	*/
    11  	force        bool
    12  	saveIgnition bool
    13  	saveImage    bool
    14  	saveKeys     bool
    15  
    16  	cmd []string
    17  }
    18  
    19  func (i *rmMachine) buildCmd(m *machineTestBuilder) []string {
    20  	cmd := []string{"machine", "rm"}
    21  	if i.force {
    22  		cmd = append(cmd, "--force")
    23  	}
    24  	if i.saveIgnition {
    25  		cmd = append(cmd, "--save-ignition")
    26  	}
    27  	if i.saveImage {
    28  		cmd = append(cmd, "--save-image")
    29  	}
    30  	if i.saveKeys {
    31  		cmd = append(cmd, "--save-keys")
    32  	}
    33  	cmd = append(cmd, m.name)
    34  	i.cmd = cmd
    35  	return cmd
    36  }
    37  
    38  func (i *rmMachine) withForce() *rmMachine {
    39  	i.force = true
    40  	return i
    41  }
    42  
    43  func (i *rmMachine) withSaveIgnition() *rmMachine {
    44  	i.saveIgnition = true
    45  	return i
    46  }
    47  
    48  func (i *rmMachine) withSaveImage() *rmMachine {
    49  	i.saveImage = true
    50  	return i
    51  }
    52  
    53  func (i *rmMachine) withSaveKeys() *rmMachine {
    54  	i.saveKeys = true
    55  	return i
    56  }