Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
Fix bugs discovered during permissions testing: (#187)
Browse files Browse the repository at this point in the history
Add permission handling to DescribeTaskDefinition error.
Previous step from getTask should be getCluster.
Reprot on correct error when tagging.
  • Loading branch information
mgritter authored Nov 19, 2022
1 parent cb634a4 commit fe762a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/internal/ecs/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ func getTaskState(wf *AddWorkflow) (nextState optionals.Optional[AddWorkflowStat
}

if taskAnswer == goBackOption {
return awf_next(getRegionState)
return awf_next(getClusterState)
}
wf.ecsTaskDefinitionFamily = taskAnswer

Expand Down Expand Up @@ -923,7 +923,7 @@ func updateServiceState(wf *AddWorkflow) (nextState optionals.Optional[AddWorkfl
if tagErr == nil {
printer.Infof("Tagged service %q with %q.\n", wf.ecsService, akitaModificationTagKey)
} else {
telemetry.Error("AWS ECS TagResource", err)
telemetry.Error("AWS ECS TagResource", tagErr)
if uoe, unauth := isUnauthorized(tagErr); unauth {
printer.Warningf("The provided credentials do not have permission to tag the ECS service %q (operation %s).\n",
wf.ecsServiceARN, uoe.OperationName)
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/ecs/aws_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ func (wf *AddWorkflow) getLatestECSTaskDefinition(family string) (*types.TaskDef
output, err := wf.ecsClient.DescribeTaskDefinition(wf.ctx, input)
if err != nil {
telemetry.Error("AWS ECS DescribeTaskDefinition", err)
return nil, nil, err
return nil, nil, wrapUnauthorized(err)
}
return output.TaskDefinition, output.Tags, nil
}
Expand Down

0 comments on commit fe762a7

Please sign in to comment.