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

feat: remove adding roles in requirements of metadata, but honor exis… #2724

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
3 changes: 1 addition & 2 deletions cli/bpmetadata/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,9 @@ func CreateBlueprintMetadata(bpPath string, bpMetadataObj *BlueprintMetadata) (*
mergeExistingOutputTypes(bpMetadataObj.Spec.Interfaces, existingInterfaces)

// get blueprint requirements
rolesCfgPath := path.Join(repoDetails.Source.BlueprintRootPath, tfRolesFileName)
svcsCfgPath := path.Join(repoDetails.Source.BlueprintRootPath, tfServicesFileName)
versionsCfgPath := path.Join(bpPath, tfVersionsFileName)
requirements, err := getBlueprintRequirements(rolesCfgPath, svcsCfgPath, versionsCfgPath)
requirements, err := getBlueprintRequirements(bpMetadataObj.Spec.Requirements.Roles, svcsCfgPath, versionsCfgPath)
if err != nil {
Log.Info("skipping blueprint requirements since roles and/or services configurations were not found as per https://tinyurl.com/tf-iam and https://tinyurl.com/tf-services")
} else {
Expand Down
18 changes: 4 additions & 14 deletions cli/bpmetadata/tfconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,23 +340,13 @@ func getBlueprintOutput(modOut *tfconfig.Output) *BlueprintOutput {

// getBlueprintRequirements gets the services and roles associated
// with the blueprint
func getBlueprintRequirements(rolesConfigPath, servicesConfigPath, versionsConfigPath string) (*BlueprintRequirements, error) {
func getBlueprintRequirements(roles []*BlueprintRoles, servicesConfigPath, versionsConfigPath string) (*BlueprintRequirements, error) {
//parse blueprint roles
p := hclparse.NewParser()
rolesFile, diags := p.ParseHCLFile(rolesConfigPath)
err := hasHclErrors(diags)
if err != nil {
return nil, err
}

r, err := parseBlueprintRoles(rolesFile)
if err != nil {
return nil, err
}

//parse blueprint services
servicesFile, diags := p.ParseHCLFile(servicesConfigPath)
err = hasHclErrors(diags)
err := hasHclErrors(diags)
if err != nil {
return nil, err
}
Expand All @@ -370,7 +360,7 @@ func getBlueprintRequirements(rolesConfigPath, servicesConfigPath, versionsConfi

if !versionCfgFileExists {
return &BlueprintRequirements{
Roles: r,
Roles: roles,
Services: s,
}, nil
}
Expand All @@ -388,7 +378,7 @@ func getBlueprintRequirements(rolesConfigPath, servicesConfigPath, versionsConfi
}

return &BlueprintRequirements{
Roles: r,
Roles: roles,
Services: s,
ProviderVersions: v,
}, nil
Expand Down
Loading