Skip to content

Libjuju failure with bundles with resources containing filenames with the path  #669

@oEscal

Description

@oEscal

When trying to deploy a Juju Bundle with a Charm where I needed to pass a resource of type file, I got the following error by the libjuju:

await model.deploy(uri, trust=True, channel='11.0/edge')                                                                            
  File "/usr/local/lib/python3.8/dist-packages/juju/model.py", line 1593, in deploy                                                                                                                                                                                             
    await handler.fetch_plan(url, res.origin, overlays=overlays)                                                                                                                                                                                                                
  File "/usr/local/lib/python3.8/dist-packages/juju/bundle.py", line 261, in fetch_plan                                                                                                                                                                                         
    self.bundle = await self._handle_local_charms(self.bundle, bundle_dir)                                                                                                                                                                                                      
  File "/usr/local/lib/python3.8/dist-packages/juju/bundle.py", line 150, in _handle_local_charms                            
    resources = await self.model.add_local_resources(
  File "/usr/local/lib/python3.8/dist-packages/juju/model.py", line 1848, in add_local_resources
    response = await resources_facade.AddPendingResources(
  File "/usr/local/lib/python3.8/dist-packages/juju/client/facade.py", line 482, in wrapper
    reply = await f(*args, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/juju/client/overrides.py", line 93, in AddPendingResources
    reply = await self.rpc(msg)
  File "/usr/local/lib/python3.8/dist-packages/juju/client/facade.py", line 655, in rpc
    result = await self.connection.rpc(msg, encoder=TypeEncoder)
  File "/usr/local/lib/python3.8/dist-packages/juju/client/connection.py", line 647, in rpc
    raise errors.JujuError(result['response']['error']['message'])
juju.errors.JujuError: bad resource info for "jmx-prometheus-jar": bad metadata: filename cannot contain "/" (got "./jmx_prometheus_javaagent-0.15.0.jar")

... and my Juju Bundle had something like the following:

[...]
sample:
    charm: ./charms/sample
    scale: 1
    trust: true
    resources:
      sample-image: <image>
      jmx-prometheus-jar: ./jmx_prometheus_javaagent-0.15.0.jar
    storage:
      data: 100M
    annotations:
      gui-x: 0
      gui-y: 250
[...]

So, it seems that, for some reason I can not understand, Juju is not accepting resources with a file path, which means that I can not pass any relative or absolute file path to an image's resource. However, according to the Bundle reference, this should be allowed to the user.

Am I doing something wrong here, or is this, in fact, a bug?
(I am using the most recent python-jujulib i.e., built from the master's code, and my Juju version is the 2.9.28-ubuntu-amd64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions