Missing relative path reference in bundle results in confusing error

Bug #1838560 reported by Casey Marshall
14
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Achilleas Anagnostopoulos

Bug Description

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

Tags: bundles
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1838560] [NEW] Missing relative path reference in bundle results in confusing error
Download full text (5.4 KiB)

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:
>
> 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 +0x95...

Read more...

Changed in juju:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Achilleas Anagnostopoulos (achilleasa)
Revision history for this message
Joseph Phillips (manadart) wrote :
Changed in juju:
status: Triaged → In Progress
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

PR https://github.com/juju/juju/pull/10484 includes a fix for the 2.6 branch

Changed in juju:
milestone: none → 2.6.7
status: In Progress → Fix Committed
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

PR https://github.com/juju/juju/pull/10487 includes a fix for the develop branch. This one properly supports resolving relative charm paths introduced by overlays which live at a different location than the bundle.

Changed in juju:
milestone: 2.6.7 → 2.6.8
tags: added: bundles
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.