Skip to content

Commit

Permalink
get role directly
Browse files Browse the repository at this point in the history
bump version

print message when logof gets a jobId that doesn't exist yet.
  • Loading branch information
brentp committed Feb 1, 2018
1 parent f9bdcbe commit 551416f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
2 changes: 1 addition & 1 deletion batchit.go
@@ -1,3 +1,3 @@
package batchit

const Version = "0.4.0"
const Version = "0.4.1"
3 changes: 3 additions & 0 deletions logof/logof.go
Expand Up @@ -30,6 +30,9 @@ func LogOf(jobId string, region string) int {
sort.Slice(output.Jobs, func(i, j int) bool { return *output.Jobs[i].StartedAt < *output.Jobs[j].StartedAt })
j := output.Jobs[len(output.Jobs)-1]
stream := j.Container.LogStreamName
if stream == nil {
log.Fatalf("job %s not found. has it started?", jobId)
}

gli := &cloudwatchlogs.GetLogEventsInput{
LogGroupName: aws.String("/aws/batch/job"),
Expand Down
34 changes: 5 additions & 29 deletions submit/submit.go
Expand Up @@ -45,36 +45,12 @@ func (c cliargs) Version() string {
}

func getRole(svc *iam.IAM, role string) *iam.Role {

var roles []*iam.Role
var marker *string

for {

params := &iam.ListRolesInput{
MaxItems: aws.Int64(100),
Marker: marker,
}

r, err := svc.ListRoles(params)
if err != nil {
panic(err)
}
roles = append(roles, r.Roles...)
if !*r.IsTruncated {
break
}
marker = r.Marker
}
var irole *iam.Role
for _, r := range roles {
if *r.RoleName == role {
irole = r
break
}
inp := &iam.GetRoleInput{RoleName: &role}
op, err := svc.GetRole(inp)
if err != nil {
panic(err)
}

return irole
return op.Role
}

const scriptPrefix = "script:"
Expand Down

0 comments on commit 551416f

Please sign in to comment.