Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Update schema and fix various mappings #7

Merged
merged 5 commits into from
Mar 22, 2020
Merged

Update schema and fix various mappings #7

merged 5 commits into from
Mar 22, 2020

Conversation

raphink
Copy link
Contributor

@raphink raphink commented Feb 26, 2020

No description provided.

Copy link
Owner

@tehwalris tehwalris left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I'm sorry that I never got around to reviewing your original one.

The changes to the code seem reasonable. I've left a couple of small change requests.

My main concern with this PR is the possibility of breaking changes. I've made a high-level diff of the schema to evaluate that. The rest of this comment is about those schema differences.

Most of the changes are new commands and fields, and also the changes to the type of certificate fields. Those should both be fine.

The pkinit_anonymous command was removed by FreeIPA. I don't think there's much we easily do about that. I doubt it will be a problem for users of this library if we remove the command.

The create_reverse params related to DNS and the md5_fingerprint param related to certs have been removed. What will happen if an old FreeIPA server still sends them to us in a response? Will that cause on error in go-freeipa?

@@ -49,6 +49,10 @@ func toGoType(ipaType string) string {
return "string"
case "Decimal":
return "float64"
case "Certificate":
return "interface{}"
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
return "interface{}"
return "string"

Certificates had type bytes in the old schema (diff), so the generated fields had type string. We should avoid changing that if possible. Is there a reason why you went with interface{} here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, there is a reason. Certificates are actually modeled as maps with a __base64__ subfield, so casting them as strings failed.

"ipaallowedtoperform_write_keys_group",
"ipaallowedtoperform_write_keys_host",
"ipaallowedtoperform_write_keys_hostgroup",
}
Copy link
Owner

Choose a reason for hiding this comment

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

I guess you added this workaround since you encountered errors when working with "host" objects. Could you please add a small test which reads (and maybe writes) a host object? That would make it easy to detect similar issues after schema changes in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, these fields failed to parse because they're not present when creating a new host and are required by the schema.

@raphink
Copy link
Contributor Author

raphink commented Mar 17, 2020

Hi @tehwalris. Have you seen my answers?

@tehwalris
Copy link
Owner

Hi @tehwalris. Have you seen my answers?

Yes, thanks. I've opened an issue for the Certificate type, since the way that works is not ideal (before and after this PR). Otherwise this PR is good to merge. Thanks a lot for submitting it.

@tehwalris tehwalris merged commit e462fc5 into tehwalris:master Mar 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants