-
Notifications
You must be signed in to change notification settings - Fork 104
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
Handle collections containing secrets when finding existing property GUIDs #505
Handle collections containing secrets when finding existing property GUIDs #505
Conversation
We have created an issue in Pivotal Tracker to manage this. Unfortunately, the Pivotal Tracker project is private so you may be unable to view the contents of the story. The labels on this github issue will be updated when the story is started. |
@@ -137,12 +156,20 @@ func (existingCollection responsePropertyCollection) findGUIDForEquivalentlItem( | |||
return "", false | |||
} | |||
|
|||
func associateExistingCollectionGUIDs(updatedProperty interface{}, existingProperty ResponseProperty) error { | |||
updatedCollection, err := parseUpdatedPropertyCollection(updatedProperty) | |||
type associateExistingCollectionGUIDsInput struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the changes are a result of this refactoring, implemented to make passing the properties needed to enable func parseResponsePropertyCollection()
to make a Api.GetDeployedProductCredential()
call to fetch the existing secret values
for collectionItemKey, collectionItemObj := range itemMap { | ||
collectionItemObjAsMap := collectionItemObj.(map[interface{}]interface{}) | ||
isCredential := collectionItemObjAsMap["credential"].(bool) | ||
if !isCredential { | ||
continue | ||
} | ||
|
||
credentialName := fmt.Sprintf("%s[%d].%s", input.PropertyName, index, collectionItemKey) | ||
apiOutput, err := input.APIService.GetDeployedProductCredential(GetDeployedProductCredentialInput{ | ||
DeployedGUID: input.ProductGUID, | ||
CredentialReference: credentialName, | ||
}) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
collectionItemObjAsMap["value"] = apiOutput.Credential.Value | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the new logic is here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetching the credential values like this increases the HTTP requests made by
om configure-product --config example-product.config.yml
from 40 to 60
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it going to be 60 requests every time, or just for collection objects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not too worried about the time addition
It looks like there's a merge conflict in |
Addresses one of the known issues for collection GUID assignment addressed in #207: