Link and Unlink Subnet to an interface #33

Merged
merged 5 commits into from Apr 13, 2016

Conversation

Projects
None yet
3 participants
Owner

howbazaar commented Apr 12, 2016

No description provided.

+
+ response, err := readInterface(i.controller.apiVersion, source)
+ if err != nil {
+ return errors.Trace(err)
@mjs

mjs Apr 13, 2016

Should this be wrapped by one of the error types?

@howbazaar

howbazaar Apr 13, 2016

Owner

No, because the errors returned out of readInterface are already one of the local types.

+
+ response, err := readInterface(i.controller.apiVersion, source)
+ if err != nil {
+ return errors.Trace(err)
interface.go
+ }
+ }
+ if link == nil {
+ return errors.NotValidf("unlinked Subnet")
@mjs

mjs Apr 13, 2016

is this the right error text? An error here means that the subnet is linked to this interface but the error message implies the subnet isn't linked at all.

@howbazaar

howbazaar Apr 13, 2016

Owner

If we couldn't find a link with the specified subnet, then the error text is "unlinked Subnet not valid".

It isn't valid to unlink a subnet that isn't linked. Alternatively, we could just succeed ?

interface.go
+ if subnet == nil {
+ return errors.NotValidf("missing Subnet")
+ }
+ var link Link
@mjs

mjs Apr 13, 2016

I think extracting the subnet search to it's own method would enhance clarity.

mjs commented Apr 13, 2016

LGTM - just little things

Owner

howbazaar commented Apr 13, 2016

$$merge$$

Contributor

jujubot commented Apr 13, 2016

@jujubot jujubot merged commit 31141c5 into juju:master Apr 13, 2016

@howbazaar howbazaar deleted the howbazaar:link-subnet branch Apr 13, 2016

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