Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Relations with nil status can be imported #24
Conversation
| @@ -137,6 +137,11 @@ var relationDeserializationFuncs = map[int]relationDeserializationFunc{ | ||
| func newRelationImporter(v int, checker schema.Checker) func(map[string]interface{}) (*relation, error) { | ||
| return func(source map[string]interface{}) (*relation, error) { | ||
| + // Some relations don't have status; remove any nil value | ||
| + // so schema validation doesn't complain. |
howbazaar
Sep 13, 2017
Owner
Probably worth leaving a comment about potential import issues due to released bad code.
| @@ -160,7 +165,11 @@ func relationV1Fields() (schema.Fields, schema.Defaults) { | ||
| func relationV2Fields() (schema.Fields, schema.Defaults) { | ||
| fields, defaults := relationV1Fields() | ||
| fields["status"] = schema.StringMap(schema.Any()) | ||
| - return fields, defaults | ||
| + v2Defaults := schema.Defaults{"status": schema.Omit} |
| fields["status"] = schema.StringMap(schema.Any()) | ||
| - return fields, defaults | ||
| + v2Defaults := schema.Defaults{"status": schema.Omit} |
wallyworld
merged commit 7e21278
into
juju:master
Sep 13, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wallyworld commentedSep 13, 2017
Some relations don't have status. The nil value was being exported, and the import would complain.
Fix both issues - don't export nil status, and allow import to handle missing status.
QA: migrate a model with a relation without status.