From b0782818fa9e04103e0c3a50d2decd0388b48f93 Mon Sep 17 00:00:00 2001 From: Megan Wolf Date: Fri, 7 Jun 2024 10:52:16 -0400 Subject: [PATCH] fix: clean-up per comments --- src/pkg/common/oscal/component.go | 1 - .../common/requirement-store/requirement-store.go | 5 ++--- src/pkg/domains/kubernetes/create.go | 14 -------------- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/pkg/common/oscal/component.go b/src/pkg/common/oscal/component.go index f390a20c..5ccc09f6 100644 --- a/src/pkg/common/oscal/component.go +++ b/src/pkg/common/oscal/component.go @@ -420,7 +420,6 @@ func ComponentDefinitionToRequirementMap(componentDefinition *oscalTypes_1_1_2.C if component.ControlImplementations != nil { for _, controlImplementation := range *component.ControlImplementations { for _, requirement := range controlImplementation.ImplementedRequirements { - // TODO: should this be controlID (i.e., possibly combining multiple instances of the same control?) requirementMap[requirement.UUID] = Requirement{ ImplementedRequirement: &requirement, Component: &component, diff --git a/src/pkg/common/requirement-store/requirement-store.go b/src/pkg/common/requirement-store/requirement-store.go index 5b15a4eb..00173428 100644 --- a/src/pkg/common/requirement-store/requirement-store.go +++ b/src/pkg/common/requirement-store/requirement-store.go @@ -41,8 +41,7 @@ func (r *RequirementStore) ResolveLulaValidations(validationStore *validationsto if requirement.ImplementedRequirement.Links != nil { for _, link := range *requirement.ImplementedRequirement.Links { if common.IsLulaLink(link) { - id := common.TrimIdPrefix(link.Href) - _, err := validationStore.GetLulaValidation(id) + _, err := validationStore.GetLulaValidation(link.Href) if err != nil { message.Debugf("Error adding validation from link %s: %v", link.Href, err) // Create new LulaValidation and add to validationStore @@ -50,7 +49,7 @@ func (r *RequirementStore) ResolveLulaValidations(validationStore *validationsto lulaValidation.Result.Observations = map[string]string{ fmt.Sprintf("Error getting Lula validation %s", link.Href): err.Error(), } - validationStore.AddLulaValidation(lulaValidation, id) + validationStore.AddLulaValidation(lulaValidation, link.Href) } } } diff --git a/src/pkg/domains/kubernetes/create.go b/src/pkg/domains/kubernetes/create.go index b79cc0ac..e43b17a4 100644 --- a/src/pkg/domains/kubernetes/create.go +++ b/src/pkg/domains/kubernetes/create.go @@ -106,20 +106,6 @@ func CreateFromManifest(ctx context.Context, client klient.Client, resourceBytes } } - // decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(resourceBytes), 4096) - // for { - // rawObj := &unstructured.Unstructured{} - // if err := decoder.Decode(rawObj); err != nil { - // if err == io.EOF { - // break - // } - // return nil, err - // } - // resource, err := createResource(ctx, client, rawObj) - // if err == nil { - // resources = append(resources, resource.Object) - // } - // } return resources, nil }