Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a couple of bugs in #216 #218

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions plugin/iamutil/internal/generate_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,17 @@ func main() {

func checkResource(name string, fullPath string, resource *discovery.RestResource, doc *discovery.RestDescription, docMeta *discovery.DirectoryListItems, config iamutil.GeneratedResources) error {
for rName, child := range resource.Resources {
return checkResource(rName, fullPath+"/"+rName, &child, doc, docMeta, config)
err := checkResource(rName, fullPath+"/"+rName, &child, doc, docMeta, config)
if err != nil {
return err
}
}

getM, hasGet := resource.Methods["getIamPolicy"]
setM, hasSet := resource.Methods["setIamPolicy"]

if !hasGet && !hasSet {
if !hasGet || !hasSet {
// Can't manage anything without both setIamPolicy and getIamPolicy
return nil
}

Expand Down Expand Up @@ -246,9 +250,6 @@ func generateConfig() error {
}
}
}
if mErr != nil {
return fmt.Errorf("errors while generating config: \n%s", mErr)
}

// Inject overrides that use ACLs instead of IAM policies
for k, v := range resourceOverrides {
Expand All @@ -259,6 +260,9 @@ func generateConfig() error {
return err
}

if mErr != nil {
return fmt.Errorf("errors while generating config: \n%s", mErr)
}
return nil
}

Expand Down
Loading