I have some charms and resources in a bundle.yaml that reference relative paths in my project. I would have expected the paths to be relative to the location of the bundle file. It seems though that the paths are relative to the current working directory of the shell in which I try to deploy the bundle.
The panic I get when the relative path references are missed, is misleading. A "file not found" error with the absolute path of the resolved paths that Juju was looking for would be better. Even better would be if the paths were resolved relative to the bundle file, then I could more easily distribute a relocatable archive of a bundle and all its referenced files.
This is with 2.6.5-bionic-amd64 snap installed.
Here's the panic I get when relative paths fail to resolve:
ubuntu@chthonic:~/Projects/kafka-rest-layer$ juju deploy ./charm/bundle.yaml
Resolving charm: cs:~containers/easyrsa
Resolving charm: cs:haproxy
Resolving charm: cs:~yellow/kafka-4
Resolving charm: cs:postgresql
Resolving charm: cs:~yellow/zookeeper-3
panic: charm or bundle URL has invalid form: "./builds/eventbus-api"
goroutine 1 [running]: github.com/juju/juju/vendor/gopkg.in/juju/charm%2ev6.MustParseURL(0xc420059c60, 0x15, 0xc42022e410) /build/juju/parts/juju/go/src/github.com/juju/juju/vendor/gopkg.in/juju/charm.v6/url.go:99 +0x6f
github.com/juju/juju/vendor/github.com/juju/bundlechanges.getSeries(0xc4207b0900, 0xc420b507f0, 0x6, 0xc, 0x4fd1080)
/build/juju/parts/juju/go/src/github.com/juju/juju/vendor/github.com/juju/bundlechanges/handlers.go:1017 +0xb8
github.com/juju/juju/vendor/github.com/juju/bundlechanges.(*resolver).handleApplications(0xc420f47480, 0xc420d1c4e0) /build/juju/parts/juju/go/src/github.com/juju/juju/vendor/github.com/juju/bundlechanges/handlers.go:49 +0x981
github.com/juju/juju/vendor/github.com/juju/bundlechanges.FromData(0xc420a96e00, 0xc4200b37a0, 0x355ef60, 0xc42080d230, 0x0, 0x0, 0xc420b50858, 0xc4201e27e0, 0x7, 0xc420bff320, ...) /build/juju/parts/juju/go/src/github.com/juju/juju/vendor/github.com/juju/bundlechanges/changes.go:62 +0x130github.com/juju/juju/cmd/juju/application.(*bundleHandler).getChanges(0xc4201e27e0, 0x0, 0x0)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/application/bundle.go:383 +0xd2
github.com/juju/juju/cmd/juju/application.deployBundle(0xc42026ce60, 0x0, 0xc420a96e00, 0xc420aa4dc0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/application/bundle.go:157 +0x18a github.com/juju/juju/cmd/juju/application.(*DeployCommand).deployBundle(0xc4203f2000, 0xc42026ce60, 0x0, 0xc420a96e00, 0xc420aa4dc0, 0x2c, 0x0, 0x0, 0x0, 0x0, ...)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/application/deploy.go:923 +0x959 github.com/juju/juju/cmd/juju/application.(*DeployCommand).maybeReadLocalBundle.func1(0xc42026ce60, 0x35fc080, 0xc4200b32c0, 0xc420affad0, 0x0) /build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/application/deploy.go:1370 +0x1a7
github.com/juju/juju/cmd/juju/application.(*DeployCommand).Run(0xc4203f2000, 0xc42026ce60, 0x0, 0x0)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/application/deploy.go:1187 +0x49a
github.com/juju/juju/cmd/modelcmd.(*modelCommandWrapper).Run(0xc4207f7e30, 0xc42026ce60, 0xc4207f7e30, 0xc4208c3ed0)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/modelcommand.go:606 +0x11c
github.com/juju/juju/cmd/modelcmd.(*baseCommandWrapper).Run(0xc4204ff580, 0xc42026ce60, 0x0, 0x0)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/modelcmd/base.go:471 +0xab
github.com/juju/juju/vendor/github.com/juju/cmd.(*SuperCommand).Run(0xc4202ac000, 0xc42026ce60, 0xc42026ce60, 0x0)
/build/juju/parts/juju/go/src/github.com/juju/juju/vendor/github.com/juju/cmd/supercommand.go:493 +0x2c0
github.com/juju/juju/vendor/github.com/juju/cmd.Main(0x359d400, 0xc4202ac000, 0xc42026ce60, 0xc4200dc0a0, 0x2, 0x2, 0x2d897e0)
/build/juju/parts/juju/go/src/github.com/juju/juju/vendor/github.com/juju/cmd/cmd.go:379 +0x2d9
github.com/juju/juju/cmd/juju/commands.main.Run(0x3300a20, 0xc4200dc090, 0x3, 0x3, 0x0)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/commands/main.go:143 +0x1af
github.com/juju/juju/cmd/juju/commands.Main(0xc4200dc090, 0x3, 0x3, 0xc4200da100)
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/commands/main.go:89 +0x4b
main.main()
/build/juju/parts/juju/go/src/github.com/juju/juju/cmd/juju/main.go:37 +0x8c
They are very much supposed to be relative to the directory the bundle.yaml
is in. Definitely we shouldn't have a panic, even if the input is wrong.
On Wed, Jul 31, 2019 at 4:05 PM Casey Marshall <email address hidden>
wrote:
> Public bug reported: chthonic: ~/Projects/ kafka-rest- layer$ juju deploy easyrsa zookeeper- 3 eventbus- api" com/juju/ juju/vendor/ gopkg.in/ juju/charm% 2ev6.MustParseU RL(0xc420059c60 , juju/parts/ juju/go/ src/ com/juju/ juju/vendor/ gopkg.in/ juju/charm. v6/url. go:99 +0x6f com/juju/ juju/vendor/ github. com/juju/ bundlechanges. getSeries( 0xc4207b0900, juju/parts/ juju/go/ src/ com/juju/ juju/vendor/ github. com/juju/ bundlechanges/ handlers. go:1017 com/juju/ juju/vendor/ github. com/juju/ bundlechanges. (*resolver) .handleApplicat ions(0xc420f474 80, juju/parts/ juju/go/ src/ com/juju/ juju/vendor/ github. com/juju/ bundlechanges/ handlers. go:49 com/juju/ juju/vendor/ github. com/juju/ bundlechanges. FromData( 0xc420a96e00, juju/parts/ juju/go/ src/ com/juju/ juju/vendor/ github. com/juju/ bundlechanges/ changes. go:62 + com/juju/ juju/cmd/ juju/applicatio n.(*bundleHandl er).getChanges( 0xc4201e27e0, juju/parts/ juju/go/ src/ com/juju/ juju/cmd/ juju/applicatio n/bundle. go:383 +0xd2 com/juju/ juju/cmd/ juju/applicatio n.deployBundle( 0xc42026ce60, 0x0, juju/parts/ juju/go/ src/ com/juju/ juju/cmd/ juju/applicatio n/bundle. go:157 +0x18a com/juju/ juju/cmd/ juju/applicatio n.(*DeployComma nd).deployBundl e(0xc4203f2000, juju/parts/ juju/go/ src/ com/juju/ juju/cmd/ juju/applicatio n/deploy. go:923 +0x95...
>
> I have some charms and resources in a bundle.yaml that reference
> relative paths in my project. I would have expected the paths to be
> relative to the location of the bundle file. It seems though that the
> paths are relative to the current working directory of the shell in
> which I try to deploy the bundle.
>
> The panic I get when the relative path references are missed, is
> misleading. A "file not found" error with the absolute path of the
> resolved paths that Juju was looking for would be better. Even better
> would be if the paths were resolved relative to the bundle file, then I
> could more easily distribute a relocatable archive of a bundle and all
> its referenced files.
>
> This is with 2.6.5-bionic-amd64 snap installed.
>
> Here's the panic I get when relative paths fail to resolve:
>
> ubuntu@
> ./charm/bundle.yaml
> Resolving charm: cs:~containers/
>
> Resolving charm: cs:haproxy
>
> Resolving charm: cs:~yellow/kafka-4
>
> Resolving charm: cs:postgresql
>
> Resolving charm: cs:~yellow/
>
> panic: charm or bundle URL has invalid form: "./builds/
>
>
>
> goroutine 1 [running]:
>
> github.
> 0x15, 0xc42022e410)
> /build/
> github.
>
> github.
> 0xc420b507f0, 0x6, 0xc, 0x4fd1080)
> /build/
> github.
> +0xb8
>
> github.
> 0xc420d1c4e0) /build/
> github.
> +0x981
>
> github.
> 0xc4200b37a0, 0x355ef60, 0xc42080d230, 0x0, 0x0, 0xc420b50858,
> 0xc4201e27e0, 0x7, 0xc420bff320, ...) /build/
> github.
> 0x130github.
> 0x0, 0x0)
> /build/
> github.
>
> github.
> 0xc420a96e00, 0xc420aa4dc0, 0x2c, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
> /build/
> github.
>
> github.
> 0xc42026ce60, 0x0, 0xc420a96e00, 0xc420aa4dc0, 0x2c, 0x0, 0x0, 0x0, 0x0,
> ...)
> /build/
> github.