mirror of https://github.com/docker/compose.git
Merge pull request #905 from docker/fix_aci_potential_nil_panic
Use ACI .IsHttpStatus() rather than accessing .StatusCode directly
This commit is contained in:
commit
aa09ecb1f8
|
@ -173,7 +173,7 @@ func stopACIContainerGroup(ctx context.Context, aciContext store.AciContext, con
|
|||
}
|
||||
|
||||
result, err := containerGroupsClient.Stop(ctx, aciContext.ResourceGroup, containerGroupName)
|
||||
if result.StatusCode == http.StatusNotFound {
|
||||
if result.IsHTTPStatus(http.StatusNotFound) {
|
||||
return errdefs.ErrNotFound
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -62,7 +62,7 @@ func (cs *aciComposeService) Down(ctx context.Context, project string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if cg.StatusCode == http.StatusNoContent {
|
||||
if cg.IsHTTPStatus(http.StatusNoContent) {
|
||||
return errdefs.ErrNotFound
|
||||
}
|
||||
|
||||
|
|
|
@ -223,7 +223,7 @@ func (cs *aciContainerService) Delete(ctx context.Context, containerID string, r
|
|||
|
||||
cg, err := deleteACIContainerGroup(ctx, cs.ctx, groupName)
|
||||
// Delete returns `StatusNoContent` if the group is not found
|
||||
if cg.StatusCode == http.StatusNoContent {
|
||||
if cg.IsHTTPStatus(http.StatusNoContent) {
|
||||
return errdefs.ErrNotFound
|
||||
}
|
||||
if err != nil {
|
||||
|
|
|
@ -223,7 +223,7 @@ func (cs *aciVolumeService) Delete(ctx context.Context, id string, options inter
|
|||
if err == nil {
|
||||
if _, ok := account.Tags[dockerVolumeTag]; ok {
|
||||
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 err
|
||||
|
|
Loading…
Reference in New Issue