Skip to content

Commit

Permalink
Fix more Custom Resource updaters (#528)
Browse files Browse the repository at this point in the history
* Custom::ECRRepository update does not error

* fix more custom updates

* gofmt

* return the actual outputs for repo

* get physical resource id from the right place
  • Loading branch information
ddollar committed Apr 8, 2016
1 parent 3d09654 commit a501c0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
7 changes: 6 additions & 1 deletion api/cmd/formation/handler/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ func ECRRepositoryCreate(req Request) (string, map[string]string, error) {
}

func ECRRepositoryUpdate(req Request) (string, map[string]string, error) {
return req.PhysicalResourceId, nil, fmt.Errorf("could not update")
outputs := map[string]string{
"RegistryId": strings.Split(req.PhysicalResourceId, ":")[4],
"RepositoryName": strings.Split(req.PhysicalResourceId, "/")[1],
}

return req.PhysicalResourceId, outputs, nil
}

func ECRRepositoryDelete(req Request) (string, map[string]string, error) {
Expand Down
20 changes: 10 additions & 10 deletions api/cmd/formation/handler/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func ECSClusterCreate(req Request) (string, map[string]string, error) {
}

func ECSClusterUpdate(req Request) (string, map[string]string, error) {
return req.PhysicalResourceId, nil, fmt.Errorf("could not update")
return req.PhysicalResourceId, nil, nil
}

func ECSClusterDelete(req Request) (string, map[string]string, error) {
Expand Down Expand Up @@ -425,15 +425,15 @@ func ECSTaskDefinitionCreate(req Request) (string, map[string]string, error) {
// a single string (shell form) - ["sh", "-c", command]
// an array of strings (exec form) - ["cmd1", "cmd2"]
switch commands := task["Command"].(type) {
case string:
if commands != "" {
r.ContainerDefinitions[i].Command = []*string{aws.String("sh"), aws.String("-c"), aws.String(commands)}
}
case []interface{}:
r.ContainerDefinitions[i].Command = make([]*string, len(commands))
for j, command := range commands {
r.ContainerDefinitions[i].Command[j] = aws.String(command.(string))
}
case string:
if commands != "" {
r.ContainerDefinitions[i].Command = []*string{aws.String("sh"), aws.String("-c"), aws.String(commands)}
}
case []interface{}:
r.ContainerDefinitions[i].Command = make([]*string, len(commands))
for j, command := range commands {
r.ContainerDefinitions[i].Command[j] = aws.String(command.(string))
}
}

// set Task environment from CF Tasks[].Environment key/values
Expand Down
2 changes: 1 addition & 1 deletion api/cmd/formation/handler/kms.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func KMSKeyCreate(req Request) (string, map[string]string, error) {
}

func KMSKeyUpdate(req Request) (string, map[string]string, error) {
return req.PhysicalResourceId, nil, fmt.Errorf("could not update")
return req.PhysicalResourceId, nil, nil
}

func KMSKeyDelete(req Request) (string, map[string]string, error) {
Expand Down

0 comments on commit a501c0f

Please sign in to comment.