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

Update RHCC registry with new query and logic to handle Spec creation #158

Merged
merged 2 commits into from
Jun 15, 2017

Conversation

dymurray
Copy link
Member

@dymurray dymurray commented Jun 9, 2017

No description provided.

Copy link
Contributor

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some thoughts I had.


err = json.Unmarshal([]byte(hist.History[0]["v1Compatibility"]), &conf)
if err != nil {
r.log.Error("Error unmarshalling intermediary JSON response")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we print the error out here? I think that helps while debugging if something goes wrong


r.log.Debug(r.config.Url)
encodedSpec := conf.Config.Label.Spec
decodedSpecYaml, _err := b64.StdEncoding.DecodeString(encodedSpec)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not create a new error variable here, I think that it should be err, imo


hist := struct {
History []map[string]string `json:"history"`
}{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these all private structs defined within the method? I would've made them normal structs at the top of the file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made these private structs because they are intermediary objects I need to parse the JSON down to the spec which gives us the labels. I figured this data object wouldn't be used outside of this function.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with leaving everything in this one file. I'd rather we not touch anything outside since this will change post TP.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 I agree.

}
defer resp.Body.Close()

type label struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of this is in pkg/apb/types/go https://github.com/openshift/ansible-service-broker/blob/master/pkg/apb/types.go#L15.

The way you're reading in the json IMO is better. Right now we use the string 'com.redhat.apb.spec' as a map key when we should really be decoding into a struct. We could either leave this as additional tech debt or try and fix it now. I might take a crack at doing this tomorrow.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, I'd be ok with it being in the struct instead of being a map key. That makes sense to me. 👍

}
defer resp.Body.Close()

type label struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, I'd be ok with it being in the struct instead of being a map key. That makes sense to me. 👍

@rthallisey
Copy link
Contributor

Update here: After some testing it looks like RHCC images can be inspected. This change may just be a config file change to point at the correct registry.

@dymurray
Copy link
Member Author

#180

Above issue is used to track Ryan's comment that there is overlapping logic here we can make a lot cleaner for using different registries.

@dymurray dymurray changed the title [WIP] Update RHCC registry with new query and logic to handle Spec creation Update RHCC registry with new query and logic to handle Spec creation Jun 14, 2017
Copy link
Contributor

@rthallisey rthallisey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dymurray I'll leave it to you to test. Just give me a 👍 once tested since I'm having trouble connecting to the registry.


hist := struct {
History []map[string]string `json:"history"`
}{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with leaving everything in this one file. I'd rather we not touch anything outside since this will change post TP.

@dymurray dymurray dismissed jmrodri’s stale review June 15, 2017 16:42

Out of date, worked your suggestions in but currently on PTO.

@eriknelson
Copy link
Contributor

ACK

@eriknelson eriknelson merged commit 3ae190f into openshift:master Jun 15, 2017
jianzhangbjz pushed a commit to jianzhangbjz/ansible-service-broker that referenced this pull request May 17, 2018
…openshift#158)

* Update RHCC registry with new query and logic to handle Spec creation

Updated config to use URL too

error cleanup

* Send Metadata field when creating a new service class for the Service Catalog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants