Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support network options in rest api #199

Merged
merged 1 commit into from
May 24, 2015
Merged

Support network options in rest api #199

merged 1 commit into from
May 24, 2015

Conversation

aboch
Copy link
Contributor

@aboch aboch commented May 22, 2015

Signed-off-by: Alessandro Boch aboch@docker.com

@@ -145,6 +146,159 @@ func (c *NetworkConfiguration) Validate() error {
return nil
}

// FromMap retrieve the configuration data from the map form.
func (c *NetworkConfiguration) FromMap(data map[string]interface{}) error {
if i, ok := data["BridgeName"]; ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

in addition to checking for ok, i think you should also check for i != nil.
This is because, you have assumed that the client will use a map[string]string to populate the data, but if the client decides to populate it via say json marshalling, then by default all the fields are marshalled with string values marked as nil.
Hence, the map lookup will succeed with ok = true, but the value (i) will be nil and the subsequent type assertion will fail at runtime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will take care of that.

@aboch
Copy link
Contributor Author

aboch commented May 23, 2015

@mavenugo I took care of your comments, please take a look when you get a chance.

ops := options.Generic{
netlabel.EnableIPv6: true,
netlabel.GenericData: options.Generic{
"AllowNodDefaultName": "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldnt this be AllowNoDefaultName ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@aboch
Copy link
Contributor Author

aboch commented May 23, 2015

ping @mavenugo

)

const (
nullNetType = "null"
defaultDriverType = "bridge"
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to have this patch in client/network.go as part of the multi-net PR. That is the most appropriate PR that can make bridge as the default driver.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Will move it to the PR #202

@aboch
Copy link
Contributor Author

aboch commented May 23, 2015

@ping @mrjana @mavenugo . Took care of your comments. Please take a look. Thanks.

@mrjana
Copy link
Contributor

mrjana commented May 24, 2015

@aboch circle-ci is failing

- Also unexporting configuration structures in bridge
- Changes in dnet/network.go to set bridge name = network name

Signed-off-by: Alessandro Boch <aboch@docker.com>
@aboch
Copy link
Contributor Author

aboch commented May 24, 2015

ping @mrjana @mavenugo

@mavenugo
Copy link
Contributor

@aboch Thanks for addressing all the comments.
👍 LGTM.

@mrjana
Copy link
Contributor

mrjana commented May 24, 2015

LGTM

mrjana added a commit that referenced this pull request May 24, 2015
Support network options in rest api
@mrjana mrjana merged commit 42dcd5a into moby:master May 24, 2015
@aboch aboch deleted the rest branch July 28, 2015 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants