mirror of
https://github.com/docker/compose.git
synced 2025-07-23 21:54:40 +02:00
Use ACI .IsHttpStatus() rather than accessing .StatusCode directly, that might lead to nil pointer panic
Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
parent
1cc0ccb189
commit
0d74298eed
@ -173,7 +173,7 @@ func stopACIContainerGroup(ctx context.Context, aciContext store.AciContext, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
result, err := containerGroupsClient.Stop(ctx, aciContext.ResourceGroup, containerGroupName)
|
result, err := containerGroupsClient.Stop(ctx, aciContext.ResourceGroup, containerGroupName)
|
||||||
if result.StatusCode == http.StatusNotFound {
|
if result.IsHTTPStatus(http.StatusNotFound) {
|
||||||
return errdefs.ErrNotFound
|
return errdefs.ErrNotFound
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
@ -62,7 +62,7 @@ func (cs *aciComposeService) Down(ctx context.Context, project string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if cg.StatusCode == http.StatusNoContent {
|
if cg.IsHTTPStatus(http.StatusNoContent) {
|
||||||
return errdefs.ErrNotFound
|
return errdefs.ErrNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ func (cs *aciContainerService) Delete(ctx context.Context, containerID string, r
|
|||||||
|
|
||||||
cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName)
|
cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName)
|
||||||
// Delete returns `StatusNoContent` if the group is not found
|
// Delete returns `StatusNoContent` if the group is not found
|
||||||
if cg.StatusCode == http.StatusNoContent {
|
if cg.IsHTTPStatus(http.StatusNoContent) {
|
||||||
return errdefs.ErrNotFound
|
return errdefs.ErrNotFound
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -223,7 +223,7 @@ func (cs *aciVolumeService) Delete(ctx context.Context, id string, options inter
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
if _, ok := account.Tags[dockerVolumeTag]; ok {
|
if _, ok := account.Tags[dockerVolumeTag]; ok {
|
||||||
result, err := storageAccountsClient.Delete(ctx, cs.aciContext.ResourceGroup, storageAccount)
|
result, err := storageAccountsClient.Delete(ctx, cs.aciContext.ResourceGroup, storageAccount)
|
||||||
if result.StatusCode == http.StatusNoContent {
|
if result.IsHTTPStatus(http.StatusNoContent) {
|
||||||
return errors.Wrapf(errdefs.ErrNotFound, "storage account %s does not exist", storageAccount)
|
return errors.Wrapf(errdefs.ErrNotFound, "storage account %s does not exist", storageAccount)
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user