Allow Resource.Fingerprint to be the zero value. #189

Merged
merged 7 commits into from Jan 12, 2016

Conversation

Projects
None yet
3 participants
Contributor

ericsnowcurrently commented Jan 12, 2016

No description provided.

resource/resource.go
- return errors.Annotate(err, "bad fingerprint")
+ if res.Fingerprint.IsZero() {
+ if res.Size > 0 {
+ return errors.NewNotValid(nil, "missing fingerprint; sized resources must have one")
@natefinch

natefinch Jan 12, 2016

Contributor

error text is kind of awkward. 0 is a size ;)

I think it's sufficient to say "missing fingerprint".

resource/fingerprint.go
@@ -47,11 +47,11 @@ func ParseFingerprint(raw string) (Fingerprint, error) {
}
// GenerateFingerprint returns the fingerprint for the provided data.
-func GenerateFingerprint(data io.Reader) (Fingerprint, error) {
+func GenerateFingerprint(reader io.Reader) (Fingerprint, error) {
@natefinch

natefinch Jan 12, 2016

Contributor

traditionally r, but I'm not too picky.

Contributor

natefinch commented Jan 12, 2016

I would add a test for GenerateFingerprint(nil), and ensure it validates correctly.

Contributor

natefinch commented Jan 12, 2016

Otherwise, LGTM.

Contributor

ericsnowcurrently commented Jan 12, 2016

$$merge$$

Contributor

jujubot commented Jan 12, 2016

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

Contributor

jujubot commented Jan 12, 2016

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju-charm/31

Contributor

ericsnowcurrently commented Jan 12, 2016

$$try-again$$

Contributor

jujubot commented Jan 12, 2016

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 Jan 12, 2016

Merge pull request #189 from ericsnowcurrently/resources-fingerprint-…
…zero-value

Allow Resource.Fingerprint to be the zero value.

@jujubot jujubot merged commit 5f443e0 into juju:v6-unstable Jan 12, 2016

@ericsnowcurrently ericsnowcurrently deleted the ericsnowcurrently:resources-fingerprint-zero-value branch Jan 12, 2016

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