-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
install-plugin action #311
base: main
Are you sure you want to change the base?
Conversation
name: | ||
type: string | ||
description: | | ||
Name of the plugin. Must be hosted at https://grafana.com/grafana/plugins`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make more sense to have url
as the param?
That would lift the grafana.com
restriction and the /plugins/{name}/versions/{version}/download
assumption.
Or, if we want to keep the grafana.com
restriction, then we could use grafana cli for that, which would be great help with uninstalling (which is currently missing in the PR).
url = f"https://grafana.com/api/plugins/{name}/versions/{version}/download" | ||
path = Path('/var/lib/grafana/plugins') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would extract path and url to constants
installed_plugins = [o.strip() for o in subprocess.getoutput("grafana cli plugin ls").splitlines()[1:]] | ||
download_path.unlink() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put this inside a try...except
blick
This is currently failing checks. Do we want to merge this? If so, we should fix the linting issues. I'm happy having this merged as-is, as it helps with provisioning plugins during initial deployment. Deleting them during day 2 operations can be done through the UI, so it does not feel as urgent. |
adds a development action to download and install into grafana a plugin.
Usage:
juju run grafana install-plugin some-plugin 1.0.0
The script will grab the plugin from
grafana.com/api/plugins/some-plugin/versions/1.0.0/downloads
, and unzip it into/var/lib/grafana/plugins
, then restart grafana and the plugin should be there.Can't test it at the moment because
charmcraft pack
is bork on main.