(instance *model.Instance)
| 180 | } |
| 181 | |
| 182 | func RemoveContainer(instance *model.Instance) error { |
| 183 | containerID := fmt.Sprintf("%s_%s", instance.Type, instance.InstanceID) |
| 184 | err := utils.DoWithRetry(func() error { |
| 185 | _, err := utils.DockerClient.ContainerRemove( |
| 186 | context.Background(), |
| 187 | containerID, |
| 188 | client.ContainerRemoveOptions{Force: true}, |
| 189 | ) |
| 190 | return err |
| 191 | }, 4) |
| 192 | |
| 193 | if err != nil { |
| 194 | err := fmt.Errorf( |
| 195 | "stop container %s error: %s", |
| 196 | containerID, |
| 197 | err.Error(), |
| 198 | ) |
| 199 | return err |
| 200 | } |
| 201 | |
| 202 | return nil |
| 203 | } |
| 204 | |
| 205 | func UpdateInstanceState(oldInstance, newInstance *model.Instance) error { |
| 206 | var err error |
no outgoing calls
no test coverage detected