Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
MaaS 2.0 issues a 404 when requesting static-routes. #7045
Conversation
jameinel
added some commits
Feb 27, 2017
axw
approved these changes
Feb 28, 2017
It would be good to have a test. Does the mock code not support setting the status code?
| - return nil, errors.Annotate(err, "unable to look up static-routes") | ||
| + // maas 2.0 does not support static-routes, so we just treat it as not | ||
| + // having any static routes to worry about. | ||
| + // Ideally we would know from the API version, or from the capabilities |
axw
Feb 28, 2017
Member
seems like TMI to me, can we just say:
MAAS 2.0 does not support static-routes, and will return 404. MAAS
does not report support for static-routes in its capabilities, so we treat
404 as meaning that it is unsupported and that there are no static routes
to configure.
Other info could go in the commit message.
| + // We don't check the full string, because the MAAS server may not be strictly hosted at /MAAS (though that is the default). | ||
| + serverError, ok := gomaasapi.GetServerError(err) | ||
| + if ok && serverError.StatusCode == http.StatusNotFound && | ||
| + strings.Contains(err.Error(), "Unknown API endpoint:") && |
jameinel
Feb 28, 2017
Owner
I check less of the exact message, and added tests that we suppress matching errors, but not unmatching ones.
|
$$merge$$ |
|
Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju |
jujubot
merged commit 0a00f0f
into
juju:2.1
Feb 28, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
jameinel commentedFeb 27, 2017
•
Edited 1 time
-
jameinel
Feb 27, 2017
It seems static-routes is only in 2.1+ but isn't reported in the API version,
nor in the 'capabilities' list.
Description of change
MAAS 2.1 implemented a new API (static-routes), that we wanted to propagate into containers. However, MAAS 2.0 does not have that API, but we don't have a way to tell the API isn't available based on the API version, nor on the capabilities tags. So instead we try the API, and handle getting a 404 back.
QA steps
We have a functional test that tests we can create containers and get access to them on MAAS 2.0.
To test directly "juju bootstrap" onto a MAAS 2.0 machine, and "juju add-machine -m controller lxd:0". That container should be on the host's network, instead of on lxdbr0, and there shouldn't be this error in the log file:
2017-02-27 17:55:22 WARNING juju.provisioner lxd-broker.go:82 failed to prepare container "0/lxd/1" network config: unable to look up static-routes: unexpected: ServerError: 404 NOT FOUND (Unknown API endpoint: /MAAS/api/2.0/static-routes/.)
Documentation changes
No.
Bug reference
lp:1668359