diff -Nru juju-core-2.0~beta7/debian/changelog juju-core-2.0~beta12/debian/changelog --- juju-core-2.0~beta7/debian/changelog 2016-05-17 20:14:16.000000000 +0000 +++ juju-core-2.0~beta12/debian/changelog 2016-07-22 14:31:32.000000000 +0000 @@ -1,4 +1,31 @@ -juju-core (2.0~beta7-0ubuntu1.16.04.1) xenial-proposed; urgency=medium +juju-core (2.0~beta12-0ubuntu1.16.04.1) xenial-proposed; urgency=medium + + [ Nicholas Skaggs ] + * New upstream release 2.0-beta12 (LP: #1604137). + * Update debian/copyright. + * Add skip to current-manual-provider for bug 1605313 and bug 1605050 + * Fix adt test for manual-provider + + [ Martin Packman ] + * Allow stripping of go binaries (LP: #1564662). + * Mark juju-2.0 as conflicting and replacing old ppas (LP: #1600257). + * Adjust where bash completion script is installed (LP: #1588403). + + -- Nicholas Skaggs Mon, 18 Jul 2016 14:00:19 -0400 + +juju-core (2.0~beta10-0ubuntu1.16.10.1) yakkety; urgency=medium + + * New upstream release 2.0-beta10 (LP: #1596920). + * Update debian/copyright for licence changes. + * Depend on golang-go >1.6 on all architectures. + * Drop golang-github-lxc-lxd-dev dependency temporarily as a post-1.0 version + is required but not yet released in the archive. + * Drop golang-gopkg-lxc-go-lxc.v2-dev dependency as old lxc support is gone. + * Update name of controller in lxd test. + + -- Martin Packman Tue, 28 Jun 2016 11:16:58 +0000 + +juju-core (2.0~beta7-0ubuntu1.16.10.1) yakkety; urgency=medium * New upstream release 2.0-beta7 (LP: #1581645) diff -Nru juju-core-2.0~beta7/debian/control juju-core-2.0~beta12/debian/control --- juju-core-2.0~beta7/debian/control 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/control 2016-07-18 19:45:44.000000000 +0000 @@ -8,13 +8,10 @@ golang-check.v1-dev, golang-github-bmizerany-pat-dev, golang-github-coreos-go-systemd-dev, - golang-github-lxc-lxd-dev, - golang-go (>= 2:1.2) [amd64 i386 armhf], - golang-go (>= 2:1.6) [!amd64 !i386 !armhf] | gccgo-5 [!amd64 !i386 !armhf] | gccgo-go [!amd64 !i386 !armhf], + golang-go (>= 2:1.6), golang-go-dbus-dev, golang-golang-x-crypto-dev, golang-golang-x-net-dev, - golang-gopkg-lxc-go-lxc.v2-dev, golang-gopkg-tomb.v2-dev, golang-juju-loggo-dev, golang-websocket-dev, @@ -31,7 +28,8 @@ Depends: distro-info, ${misc:Depends}, ${shlibs:Depends} Recommends: lxd, bash-completion Breaks: juju-core (<= 1.25.4) -Conflicts: juju2 +Conflicts: juju2, juju-core2 +Replaces: juju2, juju-core2 Built-Using: ${misc:Built-Using} Description: Juju is devops distilled - client Through the use of charms, juju provides you with shareable, re-usable, diff -Nru juju-core-2.0~beta7/debian/copyright juju-core-2.0~beta12/debian/copyright --- juju-core-2.0~beta7/debian/copyright 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/copyright 2016-07-18 19:45:44.000000000 +0000 @@ -43,12 +43,12 @@ Files: src/github.com/bmizerany/pat/* Copyright: 2012 Keith Rarick, Blake Mizerany License: Expat -Comment: Last verified commit 48be7df2c27e1cec821a3284a683ce6ef90d9052 +Comment: Last verified commit c068ca2f0aacee5ac3681d68e4d0a003b7d1fd2c Files: src/github.com/coreos/go-systemd/* Copyright: 2015 CoreOS, Inc. License: Apache-2.0 -Comment: Last verified commit 2d21675230a81a503f4363f4aa3490af06d52bb8 +Comment: Last verified commit 7b2428fec40033549c68f54e26e89e7ca9a9ce31 File src/github.com/coreos/go-systemd/daemon/sdnotify.go forked from Docker project, also under Apache-2.0. @@ -65,15 +65,27 @@ issues in golang 1.2.x. Files: src/github.com/godbus/dbus/* -Copyright: 2013, Georg Reinke () +Copyright: 2013 Georg Reinke (), Google License: BSD-2-clause -Comment: Last verified commit 88765d85c0fdadcd98a54e30694fa4e4f5b51133 +Comment: Last verified commit 32c6cc29c14570de4cf6d7e7737d68fb2d01ad15 + +Files: src/github.com/google/go-querystring/* +Copyright: 2013 The Go Authors. All rights reserved. + Copyright 2013 Google. +License: BSD-3-clause +Comment: Last verified commit 9235644dd9e52eeae6fa48efd539fdc351a0af53 Files: src/github.com/gorilla/websocket/* Copyright: 2013, 2014, 2015 The Gorilla WebSocket Authors. All rights reserved. License: BSD-2-clause Comment: Last verified commit 13e4d0621caa4d77fd9aa470ef6d7ab63d1a5e41 +Files: src/github.com/gorilla/schema/* +Copyright: 2012 The Gorilla Authors. All rights reserved. + 2012 Rodrigo Moraes. All rights reserved. +License: BSD-3-clause +Comment: Last verified commit 08023a0215e7fc27a9aecd8b8c50913c40019478 + Files: src/github.com/gosuri/uitable/* Copyright: 2015 Greg Osuri License: Expat @@ -84,9 +96,9 @@ License: Expat Files: src/github.com/joyent/gocommon/* -Copyright: 2013, Joyent Inc. -License: LGPL-3+ -Comment: Last verified commit 40c7818502f7c1ebbb13dab185a26e77b746ff40 +Copyright: 2013, 2016, Joyent Inc. +License: MPL-2.0 +Comment: Last verified commit ade826b8b54e81a779ccb29d358a45ba24b7809c Files: src/github.com/joyent/gosdc/* Copyright: 2013, Joyent Inc. @@ -106,12 +118,12 @@ Files: src/github.com/juju/bundlechanges/* Copyright: 2015 Canonical Ltd. License: LGPL-3+ -Comment: Last verified commit a1fcaa2fc3b55305d064d16cb56bf87541efb8a4 +Comment: Last verified commit 8d99dd2a94d7b4fd975a152238d0e19d0c4a6cf1 Files: src/github.com/juju/cmd/* Copyright: 2012-2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit ca63dd8ba13f8fbbbe16a917696a7ce68cc3dc0b +Comment: Last verified commit a11ae7a7436c133e799f025998cbbefd3f6eef7e Files: src/github.com/juju/errors/* Copyright: 2013-2015 Canonical Ltd. @@ -219,7 +231,7 @@ Files: src/github.com/juju/idmclient/* Copyright: 2014, 2015, 2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit 1995850da11150fb9247e43c6089e54eaeaae44a +Comment: Last verified commit 3dda079a75cccb85083d4c3877e638f5d6ab79c2 Files: src/github.com/juju/mempool/* Copyright: 2012 The Go Authors. @@ -265,7 +277,7 @@ The original Apache-2.0 license for the external source can be found inside src/github.com/juju/juju/cloudconfig/Apache-License.txt. -Files: src/github.com/juju/juju/etc/bash_completion.d/juju2 +Files: src/github.com/juju/juju/etc/bash_completion.d/juju Copyright: 2013+ Canonical Ltd. License: GPL-3 @@ -284,21 +296,16 @@ License: LGPL-3 with linking exception Comment: Last verified commit 8477fc936adf0e382d680310047ca27e128a309a -Files: src/github.com/juju/names/* -Copyright: 2013-2016 Canonical Ltd. +Files: src/github.com/juju/mutex/* +Copyright: 2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit 8a0aa0963bbacdc790914892e9ff942e94d6f795 +Comment: Last verified commit 59c26ee163447c5c57f63ff71610d433862013de Files: src/github.com/juju/persistent-cookiejar/* Copyright: 2012, 2013, 2015 The Go Authors. All rights reserved. License: BSD-3-clause Comment: Last verified commit e710b897c13ca52828ca2fc9769465186fd6d15c -Files: src/github.com/juju/ratelimit/* -Copyright: 2014, 2015 Canonical Ltd -License: LGPL-3 with linking exception -Comment: Last verified commit aa5bb718d4d435629821789cb90970319f57bfe5 - Files: src/github.com/juju/replicaset/* Copyright: 2013-2015 Canonical Ltd License: LGPL-3 with linking exception @@ -309,10 +316,15 @@ License: LGPL-3 with linking exception Comment: Last verified commit 62c62032529169c7ec02fa48f93349604c345e1f +Files: src/github.com/juju/rfc/* +Copyright: 2015 Canonical Ltd. +License: LGPL-3 with linking exception +Comment: Last verified commit ebdbbdb950cd039a531d15cdc2ac2cbd94f068ee + Files: src/github.com/juju/romulus/* Copyright: 2016 Canonical Ltd. License: AGPL-3 -Comment: Last verified commit 767a53ef0929d969a3c81c53c6b9f8e94a95dae5 +Comment: Last verified commit 6b52a14d619315a31ad4d7069db654c883d6f562 Files: src/github.com/juju/schema/* Copyright: 2011-2016 Canonical Ltd. @@ -322,7 +334,7 @@ Files: src/github.com/juju/testing/* Copyright: 2011-2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit 3ea8417b3125018f678eb9159731917d01121445 +Comment: Last verified commit ccf839b5a07a7a05009f8fa3ec41cd05fb2e0b08 Files: src/github.com/juju/testing/checkers/file_test.go src/github.com/juju/testing/mgo_windows.go @@ -351,7 +363,7 @@ Copyright: 2011-2016 Canonical Ltd. 2014, 2015, 2016 Cloudbase Solutions SRL License: LGPL-3 with linking exception -Comment: Last verified commit d5423ca3ec0b0cc8ccf093fab1365b1c9f93eb2d +Comment: Last verified commit 6219812829a3542c827c76cc75f416d4e6c94335 Files: src/github.com/juju/utils/du/diskusage.go src/github.com/juju/utils/du/diskusage_windows.go @@ -367,10 +379,9 @@ Comment: See src/github.com/juju/utils/LICENSE.golang. Files: src/github.com/juju/version/* -Copyright: 2015 Canonical Ltd. -License: LGPL-3 -Comment: Last verified commit ef897ad7f130870348ce306f61332f5335355063 - (should have a linking exception, doesn't currently) +Copyright: 2012, 2013, 2015 Canonical Ltd. +License: LGPL-3 with linking exception +Comment: Last verified commit 4ae6172c00626779a5a462c3e3d22fc0e889431a Files: src/github.com/juju/webbrowser/* Copyright: 2015 Canonical Ltd. @@ -429,6 +440,11 @@ License: Expat Comment: Last verified commit d96d1bd051f2bd9e7e43d602782b37b93b1b5666 +Files: src/github.com/rogpeppe/fastuuid/* +Copyright: 2014 Roger Peppe +License: BSD-3-clause +Comment: Last verified commit 6724a57986aff9bff1a1770e9347036def7c89f6 + Files: src/golang.org/x/crypto/* Copyright: 2009-2015 The Go Authors. All rights reserved. License: BSD-3-clause @@ -507,17 +523,17 @@ Files: src/gopkg.in/juju/charm.v6-unstable/* Copyright: 2011-2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit 9857751ba31e81773bbb42557e85054d6b4de4dd +Comment: Last verified commit 8796be6021c9ecb20630950498ec515f7dd24575 Files: src/gopkg.in/juju/charmrepo.v2-unstable/* Copyright: 2012-2016 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit c457416da598dffa665fc75aeb5c7265ff1273c0 +Comment: Last verified commit 6e6733987fb03100f30e494cc1134351fe4a593b Files: src/gopkg.in/juju/charmstore.v5-unstable/* Copyright: 2012-2016 Canonical Ltd. License: AGPL-3 -Comment: Last verified commit 745fa1ca2260cdc9dd5a6df6282da51776baa59f +Comment: Last verified commit 2cb9f80553dddaae8c5e2161ea45f4be5d9afc00 Files: src/gopkg.in/juju/environschema.v1/* Copyright: 2015 Canonical Ltd. @@ -527,12 +543,12 @@ Files: src/gopkg.in/juju/jujusvg.v1/* Copyright: 2014, 2015 Canonical Ltd. License: LGPL-3 with linking exception -Comment: Last verified commit a60359df348ef2ca40ec3bcd58a01de54f05658e +Comment: Last verified commit cc128825adce31ea13020d24e7b3302bac86a8c3 Files: src/gopkg.in/macaroon-bakery.v1/* Copyright: 2014, Roger Peppe, Canonical Inc. License: LGPL-3 with linking exception -Comment: Last verified commit c8e0209b0f4e48e8603ab0ae2477445f9443fbdc +Comment: Last verified commit b097c9d99b2537efaf54492e08f7e148f956ba51 Files: src/gopkg.in/macaroon.v1/* Copyright: 2014, Roger Peppe @@ -552,6 +568,11 @@ https://github.com/christkv/kerberos/tree/master/lib/win32/kerberos_sspi.c https://github.com/christkv/kerberos/tree/master/lib/win32/kerberos_sspi.h +Files: src/gopkg.in/juju/names.v2/* +Copyright: 2013-2016 Canonical Ltd. +License: LGPL-3 with linking exception +Comment: Last verified commit 5426d66579afd36fc63d809dd58806806c2f161f + Files: src/gopkg.in/natefinch/lumberjack.v2/* Copyright: 2014 Nate Finch License: Expat @@ -561,7 +582,7 @@ Copyright: 2013 npipe authors 2013 Nate Finch License: Expat -Comment: Last verified commit e562d4ae5c2f838f9e7e406f7d9890d5b02467a9 +Comment: Last verified commit c1b8fa8bdccecb0b8db834ee0b92fdbcfa606dd6 Files: src/gopkg.in/yaml.v1/* Copyright: 2011-2014 Canonical Inc. @@ -823,3 +844,8 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +License: MPL-2.0 + This Software is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + software, you can obtain one at http://mozilla.org/MPL/2.0/. diff -Nru juju-core-2.0~beta7/debian/juju-2.0.lintian-overrides juju-core-2.0~beta12/debian/juju-2.0.lintian-overrides --- juju-core-2.0~beta7/debian/juju-2.0.lintian-overrides 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/juju-2.0.lintian-overrides 2016-07-18 19:45:44.000000000 +0000 @@ -1,5 +1,3 @@ -# golang binaries should not be stripped -unstripped-binary-or-object usr/lib/juju-*/bin/* # false positive from golang port of libyaml embedded-library usr/lib/juju-*/bin/*: libyaml hardening-no-relro usr/lib/juju-*/bin/juju-upgrade-mongo diff -Nru juju-core-2.0~beta7/debian/rules juju-core-2.0~beta12/debian/rules --- juju-core-2.0~beta7/debian/rules 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/rules 2016-07-18 19:45:44.000000000 +0000 @@ -50,15 +50,18 @@ override_dh_auto_install: echo '#!/bin/sh\nexport PATH=/usr/lib/juju-$(VERSION)/bin:"$$PATH"\nexec juju "$$@"' > _build/bin/juju-$(VERSION) chmod 755 _build/bin/juju-$(VERSION) - mkdir -p debian/home - HOME=debian/home $(CURDIR)/src/github.com/juju/juju/scripts/generate-docs.py man -o juju.1 + mkdir -p _build/home + HOME=_build/home $(CURDIR)/src/github.com/juju/juju/scripts/generate-docs.py man -o _build/juju.1 dh_install _build/bin/juju usr/lib/juju-$(VERSION)/bin dh_install _build/bin/juju-metadata usr/lib/juju-$(VERSION)/bin dh_install _build/bin/juju-upgrade-mongo usr/lib/juju-$(VERSION)/bin dh_install _build/bin/jujud usr/lib/juju-$(VERSION)/bin dh_install _build/bin/juju-$(VERSION) usr/bin - dh_install juju.1 usr/lib/juju-$(VERSION)/man/man1 - dh_install src/github.com/juju/juju/etc/bash_completion.d/juju2 \ + dh_install _build/juju.1 usr/lib/juju-$(VERSION)/man/man1 + # Install version switching bash completion script under 'juju' so first load picks + # it up, and we have already made sure we remove earlier clashing 1.X packages. + cp src/github.com/juju/juju/etc/bash_completion.d/juju-version _build/juju + dh_install _build/juju src/github.com/juju/juju/etc/bash_completion.d/juju-2.0 \ usr/share/bash-completion/completions override_dh_link: @@ -72,16 +75,10 @@ dh_compress override_dh_auto_clean: - rm -rf bin juju.1 - rm -rf pkg bin debian/home debian/gocode + rm -rf _build find . -name "*.pyc" -delete || : dh_auto_clean -# Don't strip golang compiled binaries as this does -# not function correctly -override_dh_strip: - : - override_dh_builddeb: dh_builddeb -- -Zxz diff -Nru juju-core-2.0~beta7/debian/tests/current-manual-provider juju-core-2.0~beta12/debian/tests/current-manual-provider --- juju-core-2.0~beta7/debian/tests/current-manual-provider 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/tests/current-manual-provider 2016-07-21 19:14:52.000000000 +0000 @@ -1,6 +1,9 @@ #!/bin/sh set -ex +echo "SKIP: bug 1605313 and bug 1605050" +exit 0 + if ! apt-cache show juju-mongodb3.2 >/dev/null 2>&1; then echo "SKIP: 32-bit state servers not supported after xenial." exit 0 diff -Nru juju-core-2.0~beta7/debian/tests/lxd-provider juju-core-2.0~beta12/debian/tests/lxd-provider --- juju-core-2.0~beta7/debian/tests/lxd-provider 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/tests/lxd-provider 2016-07-18 19:45:44.000000000 +0000 @@ -18,7 +18,7 @@ echo "OK" echo "Waiting for environment to bootstrap: " -juju status --debug -m admin +juju status --debug -m controller juju status --debug echo "OK" diff -Nru juju-core-2.0~beta7/debian/tests/manual-provider juju-core-2.0~beta12/debian/tests/manual-provider --- juju-core-2.0~beta7/debian/tests/manual-provider 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/debian/tests/manual-provider 2016-07-20 01:53:06.000000000 +0000 @@ -14,11 +14,4 @@ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ssh-keyscan "$ip" >> ~/.ssh/known_hosts -mkdir -p ~/.local/share/juju/ -cat > ~/.local/share/juju/clouds.yaml < 0 { + if len(params) > 0 && !ph.redirect { r.URL.RawQuery = url.Values(params).Encode() + "&" + r.URL.RawQuery } ph.ServeHTTP(w, r) @@ -111,6 +119,11 @@ } } + if p.NotFound != nil { + p.NotFound.ServeHTTP(w, r) + return + } + allowed := make([]string, 0, len(p.handlers)) for meth, handlers := range p.handlers { if meth == r.Method { @@ -166,16 +179,42 @@ p.Add("OPTIONS", pat, h) } +// Patch will register a pattern with a handler for PATCH requests. +func (p *PatternServeMux) Patch(pat string, h http.Handler) { + p.Add("PATCH", pat, h) +} + // Add will register a pattern with a handler for meth requests. func (p *PatternServeMux) Add(meth, pat string, h http.Handler) { - p.handlers[meth] = append(p.handlers[meth], &patHandler{pat, h}) + p.add(meth, pat, h, false) +} + +func (p *PatternServeMux) add(meth, pat string, h http.Handler, redirect bool) { + handlers := p.handlers[meth] + for _, p1 := range handlers { + if p1.pat == pat { + return // found existing pattern; do nothing + } + } + handler := &patHandler{ + pat: pat, + Handler: h, + redirect: redirect, + } + p.handlers[meth] = append(handlers, handler) n := len(pat) if n > 0 && pat[n-1] == '/' { - p.Add(meth, pat[:n-1], http.RedirectHandler(pat, http.StatusMovedPermanently)) + p.add(meth, pat[:n-1], http.HandlerFunc(addSlashRedirect), true) } } +func addSlashRedirect(w http.ResponseWriter, r *http.Request) { + u := *r.URL + u.Path += "/" + http.Redirect(w, r, u.String(), http.StatusMovedPermanently) +} + // Tail returns the trailing string in path after the final slash for a pat ending with a slash. // // Examples: @@ -209,6 +248,7 @@ type patHandler struct { pat string http.Handler + redirect bool } func (ph *patHandler) try(path string) (url.Values, bool) { diff -Nru juju-core-2.0~beta7/src/github.com/bmizerany/pat/mux_test.go juju-core-2.0~beta12/src/github.com/bmizerany/pat/mux_test.go --- juju-core-2.0~beta7/src/github.com/bmizerany/pat/mux_test.go 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/bmizerany/pat/mux_test.go 2016-07-18 19:45:44.000000000 +0000 @@ -1,93 +1,65 @@ package pat import ( + "io" "net/http" "net/http/httptest" "net/url" + "reflect" "sort" "strings" "testing" - - "github.com/bmizerany/assert" ) func TestPatMatch(t *testing.T) { - params, ok := (&patHandler{"/", nil}).try("/") - assert.Equal(t, true, ok) - - params, ok = (&patHandler{"/", nil}).try("/wrong_url") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/:name", nil}).try("/foo/bar") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar"}}, params) - - params, ok = (&patHandler{"/foo/:name/baz", nil}).try("/foo/bar") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/:name/bar/", nil}).try("/foo/keith/bar/baz") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"keith"}}, params) - - params, ok = (&patHandler{"/foo/:name/bar/", nil}).try("/foo/keith/bar/") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"keith"}}, params) - - params, ok = (&patHandler{"/foo/:name/bar/", nil}).try("/foo/keith/bar") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/:name/baz", nil}).try("/foo/bar/baz") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar"}}, params) - - params, ok = (&patHandler{"/foo/:name/baz/:id", nil}).try("/foo/bar/baz") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/:name/baz/:id", nil}).try("/foo/bar/baz/123") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar"}, ":id": {"123"}}, params) - - params, ok = (&patHandler{"/foo/:name/baz/:name", nil}).try("/foo/bar/baz/123") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar", "123"}}, params) - - params, ok = (&patHandler{"/foo/:name.txt", nil}).try("/foo/bar.txt") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar"}}, params) - - params, ok = (&patHandler{"/foo/:name", nil}).try("/foo/:bar") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {":bar"}}, params) - - params, ok = (&patHandler{"/foo/:a:b", nil}).try("/foo/val1:val2") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":a": {"val1"}, ":b": {":val2"}}, params) - - params, ok = (&patHandler{"/foo/:a.", nil}).try("/foo/.") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":a": {""}}, params) - - params, ok = (&patHandler{"/foo/:a:b", nil}).try("/foo/:bar") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":a": {""}, ":b": {":bar"}}, params) - - params, ok = (&patHandler{"/foo/:a:b:c", nil}).try("/foo/:bar") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":a": {""}, ":b": {""}, ":c": {":bar"}}, params) - - params, ok = (&patHandler{"/foo/::name", nil}).try("/foo/val1:val2") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":": {"val1"}, ":name": {":val2"}}, params) - - params, ok = (&patHandler{"/foo/:name.txt", nil}).try("/foo/bar/baz.txt") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/x:name", nil}).try("/foo/bar") - assert.Equal(t, false, ok) - - params, ok = (&patHandler{"/foo/x:name", nil}).try("/foo/xbar") - assert.Equal(t, true, ok) - assert.Equal(t, url.Values{":name": {"bar"}}, params) + for i, tt := range []struct { + pat string + u string + match bool + vals url.Values + }{ + {"/", "/", true, nil}, + {"/", "/wrong_url", false, nil}, + {"/foo/:name", "/foo/bar", true, url.Values{":name": {"bar"}}}, + {"/foo/:name/baz", "/foo/bar", false, nil}, + {"/foo/:name/bar/", "/foo/keith/bar/baz", true, url.Values{":name": {"keith"}}}, + {"/foo/:name/bar/", "/foo/keith/bar/", true, url.Values{":name": {"keith"}}}, + {"/foo/:name/bar/", "/foo/keith/bar", false, nil}, + {"/foo/:name/baz", "/foo/bar/baz", true, url.Values{":name": {"bar"}}}, + {"/foo/:name/baz/:id", "/foo/bar/baz", false, nil}, + {"/foo/:name/baz/:id", "/foo/bar/baz/123", true, url.Values{":name": {"bar"}, ":id": {"123"}}}, + {"/foo/:name/baz/:name", "/foo/bar/baz/123", true, url.Values{":name": {"bar", "123"}}}, + {"/foo/:name.txt", "/foo/bar.txt", true, url.Values{":name": {"bar"}}}, + {"/foo/:name", "/foo/:bar", true, url.Values{":name": {":bar"}}}, + {"/foo/:a:b", "/foo/val1:val2", true, url.Values{":a": {"val1"}, ":b": {":val2"}}}, + {"/foo/:a.", "/foo/.", true, url.Values{":a": {""}}}, + {"/foo/:a:b", "/foo/:bar", true, url.Values{":a": {""}, ":b": {":bar"}}}, + {"/foo/:a:b:c", "/foo/:bar", true, url.Values{":a": {""}, ":b": {""}, ":c": {":bar"}}}, + {"/foo/::name", "/foo/val1:val2", true, url.Values{":": {"val1"}, ":name": {":val2"}}}, + {"/foo/:name.txt", "/foo/bar/baz.txt", false, nil}, + {"/foo/x:name", "/foo/bar", false, nil}, + {"/foo/x:name", "/foo/xbar", true, url.Values{":name": {"bar"}}}, + } { + params, ok := (&patHandler{pat: tt.pat}).try(tt.u) + if !tt.match { + if ok { + t.Errorf("[%d] url %q matched pattern %q", i, tt.u, tt.pat) + } + continue + } + if !ok { + t.Errorf("[%d] url %q did not match pattern %q", i, tt.u, tt.pat) + continue + } + if tt.vals != nil { + if !reflect.DeepEqual(params, tt.vals) { + t.Errorf( + "[%d] for url %q, pattern %q: got %v; want %v", + i, tt.u, tt.pat, params, tt.vals, + ) + } + } + } } func TestPatRoutingHit(t *testing.T) { @@ -97,17 +69,15 @@ p.Get("/foo/:name", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ok = true t.Logf("%#v", r.URL.Query()) - assert.Equal(t, "keith", r.URL.Query().Get(":name")) + if got, want := r.URL.Query().Get(":name"), "keith"; got != want { + t.Errorf("got %q, want %q", got, want) + } })) - r, err := http.NewRequest("GET", "/foo/keith?a=b", nil) - if err != nil { - t.Fatal(err) + p.ServeHTTP(nil, newRequest("GET", "/foo/keith?a=b", nil)) + if !ok { + t.Error("handler not called") } - - p.ServeHTTP(nil, r) - - assert.T(t, ok) } func TestPatRoutingMethodNotAllowed(t *testing.T) { @@ -122,20 +92,22 @@ ok = true })) - r, err := http.NewRequest("GET", "/foo/keith", nil) - if err != nil { - t.Fatal(err) - } + r := httptest.NewRecorder() + p.ServeHTTP(r, newRequest("GET", "/foo/keith", nil)) - rr := httptest.NewRecorder() - p.ServeHTTP(rr, r) - - assert.T(t, !ok) - assert.Equal(t, http.StatusMethodNotAllowed, rr.Code) + if ok { + t.Fatal("handler called when it should have not been allowed") + } + if r.Code != http.StatusMethodNotAllowed { + t.Fatalf("got status %d; expected %d", r.Code, http.StatusMethodNotAllowed) + } - allowed := strings.Split(rr.Header().Get("Allow"), ", ") - sort.Strings(allowed) - assert.Equal(t, allowed, []string{"POST", "PUT"}) + got := strings.Split(r.Header().Get("Allow"), ", ") + sort.Strings(got) + want := []string{"POST", "PUT"} + if !reflect.DeepEqual(got, want) { + t.Fatalf("got Allow header %v; want %v", got, want) + } } // Check to make sure we don't pollute the Raw Query when we have no parameters @@ -146,17 +118,15 @@ p.Get("/foo/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ok = true t.Logf("%#v", r.URL.RawQuery) - assert.Equal(t, "", r.URL.RawQuery) + if r.URL.RawQuery != "" { + t.Errorf("RawQuery was %q; should be empty", r.URL.RawQuery) + } })) - r, err := http.NewRequest("GET", "/foo/", nil) - if err != nil { - t.Fatal(err) + p.ServeHTTP(nil, newRequest("GET", "/foo/", nil)) + if !ok { + t.Error("handler not called") } - - p.ServeHTTP(nil, r) - - assert.T(t, ok) } // Check to make sure we don't pollute the Raw Query when there are parameters but no pattern variables @@ -167,54 +137,50 @@ p.Get("/foo/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { ok = true t.Logf("%#v", r.URL.RawQuery) - assert.Equal(t, "a=b", r.URL.RawQuery) + if got, want := r.URL.RawQuery, "a=b"; got != want { + t.Errorf("for RawQuery: got %q; want %q", got, want) + } })) - r, err := http.NewRequest("GET", "/foo/?a=b", nil) - if err != nil { - t.Fatal(err) + p.ServeHTTP(nil, newRequest("GET", "/foo/?a=b", nil)) + if !ok { + t.Error("handler not called") } - - p.ServeHTTP(nil, r) - - assert.T(t, ok) } func TestPatImplicitRedirect(t *testing.T) { p := New() p.Get("/foo/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) - r, err := http.NewRequest("GET", "/foo", nil) - if err != nil { - t.Fatal(err) - } - res := httptest.NewRecorder() - p.ServeHTTP(res, r) - + p.ServeHTTP(res, newRequest("GET", "/foo", nil)) if res.Code != 301 { - t.Errorf("expected Code 301, was %d", res.Code) + t.Errorf("got Code %d; want 301", res.Code) } - if loc := res.Header().Get("Location"); loc != "/foo/" { - t.Errorf("expected %q, got %q", "/foo/", loc) + t.Errorf("got %q; want %q", loc, "/foo/") } p = New() p.Get("/foo", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) p.Get("/foo/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) - r, err = http.NewRequest("GET", "/foo", nil) - if err != nil { - t.Fatal(err) + res = httptest.NewRecorder() + p.ServeHTTP(res, newRequest("GET", "/foo", nil)) + if res.Code != 200 { + t.Errorf("got %d; want Code 200", res.Code) } - res = httptest.NewRecorder() - res.Code = 200 - p.ServeHTTP(res, r) + p = New() + p.Get("/hello/:name/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) - if res.Code != 200 { - t.Errorf("expected Code 200, was %d", res.Code) + res = httptest.NewRecorder() + p.ServeHTTP(res, newRequest("GET", "/hello/bob?a=b#f", nil)) + if res.Code != 301 { + t.Errorf("got code %d; want 301", res.Code) + } + if got, want := res.Header().Get("Location"), "/hello/bob/?a=b#f"; got != want { + t.Errorf("got %q; want %q", got, want) } } @@ -239,3 +205,49 @@ } } } + +func TestNotFound(t *testing.T) { + p := New() + p.NotFound = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(123) + }) + p.Post("/bar", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) + + for _, path := range []string{"/foo", "/bar"} { + res := httptest.NewRecorder() + p.ServeHTTP(res, newRequest("GET", path, nil)) + if res.Code != 123 { + t.Errorf("for path %q: got code %d; want 123", path, res.Code) + } + } +} + +func TestMethodPatch(t *testing.T) { + p := New() + p.Patch("/foo/bar", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})) + + // Test to see if we get a 405 Method Not Allowed errors from trying to + // issue a GET request to a handler that only supports the PATCH method. + res := httptest.NewRecorder() + res.Code = http.StatusMethodNotAllowed + p.ServeHTTP(res, newRequest("GET", "/foo/bar", nil)) + if res.Code != http.StatusMethodNotAllowed { + t.Errorf("got Code %d; want 405", res.Code) + } + + // Now, test to see if we get a 200 OK from issuing a PATCH request to + // the same handler. + res = httptest.NewRecorder() + p.ServeHTTP(res, newRequest("PATCH", "/foo/bar", nil)) + if res.Code != http.StatusOK { + t.Errorf("Expected code %d, got %d", http.StatusOK, res.Code) + } +} + +func newRequest(method, urlStr string, body io.Reader) *http.Request { + req, err := http.NewRequest(method, urlStr, body) + if err != nil { + panic(err) + } + return req +} diff -Nru juju-core-2.0~beta7/src/github.com/bmizerany/pat/README.md juju-core-2.0~beta12/src/github.com/bmizerany/pat/README.md --- juju-core-2.0~beta7/src/github.com/bmizerany/pat/README.md 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/bmizerany/pat/README.md 2016-07-18 19:45:44.000000000 +0000 @@ -1,37 +1,41 @@ # pat (formerly pat.go) - A Sinatra style pattern muxer for Go's net/http library +[![GoDoc](https://godoc.org/github.com/bmizerany/pat?status.svg)](https://godoc.org/github.com/bmizerany/pat) + ## INSTALL $ go get github.com/bmizerany/pat ## USE - package main - - import ( - "io" - "net/http" - "github.com/bmizerany/pat" - "log" - ) - - // hello world, the web server - func HelloServer(w http.ResponseWriter, req *http.Request) { - io.WriteString(w, "hello, "+req.URL.Query().Get(":name")+"!\n") - } +```go +package main - func main() { - m := pat.New() - m.Get("/hello/:name", http.HandlerFunc(HelloServer)) - - // Register this pat with the default serve mux so that other packages - // may also be exported. (i.e. /debug/pprof/*) - http.Handle("/", m) - err := http.ListenAndServe(":12345", nil) - if err != nil { - log.Fatal("ListenAndServe: ", err) - } +import ( + "io" + "net/http" + "github.com/bmizerany/pat" + "log" +) + +// hello world, the web server +func HelloServer(w http.ResponseWriter, req *http.Request) { + io.WriteString(w, "hello, "+req.URL.Query().Get(":name")+"!\n") +} + +func main() { + m := pat.New() + m.Get("/hello/:name", http.HandlerFunc(HelloServer)) + + // Register this pat with the default serve mux so that other packages + // may also be exported. (i.e. /debug/pprof/*) + http.Handle("/", m) + err := http.ListenAndServe(":12345", nil) + if err != nil { + log.Fatal("ListenAndServe: ", err) } +} +``` It's that simple. @@ -40,10 +44,20 @@ ## CONTRIBUTORS -* Keith Rarick (@krarick) - github.com/kr -* Blake Mizerany (@bmizerany) - github.com/bmizerany -* Evan Shaw -* George Rogers +* Alexis Svinartchouk (@zvin) +* Blake Mizerany (@bmizerany) +* Brian Ketelsen (@bketelsen) +* Bryan Matsuo (@bmatsuo) +* Caleb Spare (@cespare) +* Evan Shaw (@edsrzf) +* Gary Burd (@garyburd) +* George Rogers (@georgerogers42) +* Keith Rarick (@kr) +* Matt Williams (@mattyw) +* Mike Stipicevic (@wickedchicken) +* Nick Saika (@nesv) +* Timothy Cyrus (@tcyrus) +* binqin (@binku87) ## LICENSE diff -Nru juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/files.go juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/files.go --- juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/files.go 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/files.go 2016-07-18 19:45:44.000000000 +0000 @@ -28,10 +28,8 @@ func Files(unsetEnv bool) []*os.File { if unsetEnv { - // there is no way to unset env in golang os package for now - // https://code.google.com/p/go/issues/detail?id=6423 - defer os.Setenv("LISTEN_PID", "") - defer os.Setenv("LISTEN_FDS", "") + defer os.Unsetenv("LISTEN_PID") + defer os.Unsetenv("LISTEN_FDS") } pid, err := strconv.Atoi(os.Getenv("LISTEN_PID")) @@ -44,7 +42,7 @@ return nil } - var files []*os.File + files := make([]*os.File, 0, nfds) for fd := listenFdsStart; fd < listenFdsStart+nfds; fd++ { syscall.CloseOnExec(fd) files = append(files, os.NewFile(uintptr(fd), "LISTEN_FD_"+strconv.Itoa(fd))) diff -Nru juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/listeners.go juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/listeners.go --- juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/listeners.go 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/listeners.go 2016-07-18 19:45:44.000000000 +0000 @@ -15,6 +15,7 @@ package activation import ( + "crypto/tls" "net" ) @@ -26,15 +27,36 @@ // corresponding with "udp, tcp, tcp", then the slice would contain {nil, net.Listener, net.Listener} func Listeners(unsetEnv bool) ([]net.Listener, error) { files := Files(unsetEnv) - listeners := make([]net.Listener, 0) + listeners := make([]net.Listener, len(files)) - for i := 0; i < len(files); i++ { - if pc, err := net.FileListener(files[i]); err == nil { - listeners = append(listeners, pc) - continue - } else { - listeners = append(listeners, nil) + for i, f := range files { + if pc, err := net.FileListener(f); err == nil { + listeners[i] = pc } } return listeners, nil } + +// TLSListeners returns a slice containing a net.listener for each matching TCP socket type +// passed to this process. +// It uses default Listeners func and forces TCP sockets handlers to use TLS based on tlsConfig. +func TLSListeners(unsetEnv bool, tlsConfig *tls.Config) ([]net.Listener, error) { + listeners, err := Listeners(unsetEnv) + + if listeners == nil || err != nil { + return nil, err + } + + if tlsConfig != nil && err == nil { + tlsConfig.NextProtos = []string{"http/1.1"} + + for i, l := range listeners { + // Activate TLS only for TCP sockets + if l.Addr().Network() == "tcp" { + listeners[i] = tls.NewListener(l, tlsConfig) + } + } + } + + return listeners, err +} diff -Nru juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/packetconns.go juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/packetconns.go --- juju-core-2.0~beta7/src/github.com/coreos/go-systemd/activation/packetconns.go 2016-05-17 20:01:14.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/coreos/go-systemd/activation/packetconns.go 2016-07-18 19:45:44.000000000 +0000 @@ -26,13 +26,11 @@ // corresponding with "udp, tcp, udp", then the slice would contain {net.PacketConn, nil, net.PacketConn} func PacketConns(unsetEnv bool) ([]net.PacketConn, error) { files := Files(unsetEnv) - conns := make([]net.PacketConn, 0) - for i := 0; i < len(files); i++ { - if pc, err := net.FilePacketConn(files[i]); err == nil { - conns = append(conns, pc) - continue - } else { - conns = append(conns, nil) + conns := make([]net.PacketConn, len(files)) + + for i, f := range files { + if pc, err := net.FilePacketConn(f); err == nil { + conns[i] = pc } } return conns, nil diff -Nru juju-core-2.0~beta7/src/github.com/coreos/go-systemd/CONTRIBUTING.md juju-core-2.0~beta12/src/github.com/coreos/go-systemd/CONTRIBUTING.md --- juju-core-2.0~beta7/src/github.com/coreos/go-systemd/CONTRIBUTING.md 1970-01-01 00:00:00.000000000 +0000 +++ juju-core-2.0~beta12/src/github.com/coreos/go-systemd/CONTRIBUTING.md 2016-07-18 19:45:44.000000000 +0000 @@ -0,0 +1,77 @@ +# How to Contribute + +CoreOS projects are [Apache 2.0 licensed](LICENSE) and accept contributions via +GitHub pull requests. This document outlines some of the conventions on +development workflow, commit message formatting, contact points and other +resources to make it easier to get your contribution accepted. + +# Certificate of Origin + +By contributing to this project you agree to the Developer Certificate of +Origin (DCO). This document was created by the Linux Kernel community and is a +simple statement that you, as a contributor, have the legal right to make the +contribution. See the [DCO](DCO) file for details. + +# Email and Chat + +The project currently uses the general CoreOS email list and IRC channel: +- Email: [coreos-dev](https://groups.google.com/forum/#!forum/coreos-dev) +- IRC: #[coreos](irc://irc.freenode.org:6667/#coreos) IRC channel on freenode.org + +Please avoid emailing maintainers found in the MAINTAINERS file directly. They +are very busy and read the mailing lists. + +## Getting Started + +- Fork the repository on GitHub +- Read the [README](README.md) for build and test instructions +- Play with the project, submit bugs, submit patches! + +## Contribution Flow + +This is a rough outline of what a contributor's workflow looks like: + +- Create a topic branch from where you want to base your work (usually master). +- Make commits of logical units. +- Make sure your commit messages are in the proper format (see below). +- Push your changes to a topic branch in your fork of the repository. +- Make sure the tests pass, and add any new tests as appropriate. +- Submit a pull request to the original repository. + +Thanks for your contributions! + +### Coding Style + +CoreOS projects written in Go follow a set of style guidelines that we've documented +[here](https://github.com/coreos/docs/tree/master/golang). Please follow them when +working on your contributions. + +### Format of the Commit Message + +We follow a rough convention for commit messages that is designed to answer two +questions: what changed and why. The subject line should feature the what and +the body of the commit should describe the why. + +``` +scripts: add the test-cluster command + +this uses tmux to setup a test cluster that you can easily kill and +start for debugging. + +Fixes #38 +``` + +The format can be described more formally as follows: + +``` +: + + + +