Adjust resources code. #184

Merged
merged 14 commits into from Dec 15, 2015

Conversation

Projects
None yet
4 participants
Contributor

ericsnowcurrently commented Dec 15, 2015

This patch makes a few adjustments needed for the resources feature:

  • Make resource.Type an int enum.
  • Add resource.Origin and Resource.Origin.
  • Return an error from resource.ParseType(). Returning a bool (and then ignoring it) wasn't very helpful.

This patch also percolates the parsing error up the stack. The pattern of ignoring errors during metadata parsing relies on parse results causing appropriate errors during validation. This approach is fragile and easily resolved by supporting error returns from parsing.

@ericsnowcurrently ericsnowcurrently changed the title from Return an error from resource.ParseType(). to Fix resources. Dec 15, 2015

@ericsnowcurrently ericsnowcurrently changed the title from Fix resources. to Adjust resources code. Dec 15, 2015

+ OriginStore
+)
+
+var origins = map[Origin]string{
@kat-co

kat-co Dec 15, 2015

Contributor

Complete developer preference here, but I believe the stringer @natefinch demonstrated in the last sprint is a standard way to turn iotas into strings. Use this? If not, that's totally fine.

@ericsnowcurrently

ericsnowcurrently Dec 15, 2015

Contributor

Doing that makes parsing more of a pain.

Contributor

kat-co commented Dec 15, 2015

Overall LGTM

Contributor

wwitzel3 commented Dec 15, 2015

LGTM

Contributor

ericsnowcurrently commented Dec 15, 2015

$$merge$$

Contributor

jujubot commented Dec 15, 2015

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-charm

jujubot added a commit that referenced this pull request Dec 15, 2015

Merge pull request #184 from ericsnowcurrently/return-error-from-parsing
Adjust resources code.

This patch makes a few adjustments needed for the resources feature:

* Make resource.Type an int enum.
* Add resource.Origin and Resource.Origin.
* Return an error from resource.ParseType().  Returning a bool (and then ignoring it) wasn't very helpful.

This patch also percolates the parsing error up the stack.  The pattern of ignoring errors during metadata parsing relies on parse results causing appropriate errors during validation.  This approach is fragile and easily resolved by supporting error returns from parsing.

@jujubot jujubot merged commit 24bd2be into juju:v6-unstable Dec 15, 2015

@ericsnowcurrently ericsnowcurrently deleted the ericsnowcurrently:return-error-from-parsing branch Dec 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment