support zipped plugins

Bug #1866907 reported by Paul Collins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Grafana Charm
Fix Released
Wishlist
Liam Young

Bug Description

It seems to be fairly common to distribute Grafana plugins as zip files (e.g. https://github.com/grafana/piechart-panel/releases).

The charm doesn't support zip files:

2020-03-10 20:09:50 INFO config-changed shutil.ReadError: /tmp/grafana-plugin.tar.gz is not a compressed or uncompressed tar file

So we have to repack them first. It would be good to eliminate this step.

Related branches

Revision history for this message
Paul Collins (pjdc) wrote :

Looks like this is because the charm always writes the file to /tmp/grafana-plugin.tar.gz (unsafe usage of /tmp there!) and shutil.unpack_archive guesses based on the filename.

-----

2020-03-10 20:09:50 INFO config-changed File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.4/site-packages/charms/reactive/bus.py", line 181, in invoke
2020-03-10 20:09:50 INFO config-changed self._action(*args)
2020-03-10 20:09:50 INFO config-changed File "/var/lib/juju/agents/unit-grafana-0/charm/reactive/grafana.py", line 183, in install_plugins
2020-03-10 20:09:50 INFO config-changed shutil.unpack_archive(plugin_file, plugins_dir)
2020-03-10 20:09:50 INFO config-changed File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.4/shutil.py", line 961, in unpack_archive
2020-03-10 20:09:50 INFO config-changed func(filename, extract_dir, **kwargs)
2020-03-10 20:09:50 INFO config-changed File "/var/lib/juju/agents/unit-grafana-0/.venv/lib/python3.4/shutil.py", line 904, in _unpack_tarfile
2020-03-10 20:09:50 INFO config-changed "%s is not a compressed or uncompressed tar file" % filename)
2020-03-10 20:09:50 INFO config-changed shutil.ReadError: /tmp/grafana-plugin.tar.gz is not a compressed or uncompressed tar file

-----

Help on function unpack_archive in module shutil:

unpack_archive(filename, extract_dir=None, format=None)
[...]
    `format` is the archive format: one of "zip", "tar", "gztar", "bztar",
    or "xztar". Or any other registered format. If not provided,
    unpack_archive will use the filename extension and see if an unpacker
    was registered for that extension.
[...]

Edin S (exsdev)
Changed in charm-grafana:
importance: Undecided → Wishlist
Liam Young (gnuoy)
Changed in charm-grafana:
status: New → Confirmed
assignee: nobody → Liam Young (gnuoy)
Celia Wang (ziyiwang)
Changed in charm-grafana:
status: Confirmed → Fix Released
milestone: none → 21.07
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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