Skip to content

Commit

Permalink
revert last changes
Browse files Browse the repository at this point in the history
  • Loading branch information
itamar-smirra-port committed Apr 25, 2024
1 parent 55567a8 commit b217def
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
31 changes: 15 additions & 16 deletions pkg/k8s/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,28 +248,27 @@ func (c *Controller) getObjectEntities(obj interface{}, selector port.Selector,
items, parseItemsError := jq.ParseArray(itemsToParse, structuredObj)
if parseItemsError != nil {
return nil, parseItemsError
} else {
editedObject, ok := structuredObj.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("error parsing object '%#v'", structuredObj)
}
}
editedObject, ok := structuredObj.(map[string]interface{})
if !ok {
return nil, fmt.Errorf("error parsing object '%#v'", structuredObj)
}

for _, item := range items {
editedObject["item"] = item
selectorResult, err := isPassSelector(editedObject, selector)
for _, item := range items {
editedObject["item"] = item
selectorResult, err := isPassSelector(editedObject, selector)

if err != nil {
return nil, err
}

if selectorResult {
currentEntities, err := mapEntities(editedObject, mappings)
if err != nil {
return nil, err
}

if selectorResult {
currentEntities, err := mapEntities(editedObject, mappings)
if err != nil {
return nil, err
}

entities = append(entities, currentEntities...)
}
entities = append(entities, currentEntities...)
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/port/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ type EntityMappings struct {

type Port struct {
Entity EntityMappings `json:"entity"`
ItemsToParse string `json:"ItemsToParse"`
ItemsToParse string `json:"itemsToParse"`
}

type Selector struct {
Expand Down

0 comments on commit b217def

Please sign in to comment.