Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
e978bfc3
Commit
e978bfc3
authored
Sep 15, 2017
by
THIERRY SALLE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added --pluginUrl option to grafana-cli for local network plugin installation
parent
442f625a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
18 deletions
+40
-18
docs/sources/plugins/installation.md
+5
-0
pkg/cmd/grafana-cli/commands/command_line.go
+5
-0
pkg/cmd/grafana-cli/commands/commandstest/fake_commandLine.go
+4
-0
pkg/cmd/grafana-cli/commands/install_command.go
+20
-18
pkg/cmd/grafana-cli/main.go
+6
-0
No files found.
docs/sources/plugins/installation.md
View file @
e978bfc3
...
...
@@ -72,6 +72,11 @@ The Download URL from Grafana.com API is in this form:
`https://grafana.com/api/plugins/<plugin id>/versions/<version number>/download`
You can specify a local URL by using the
`--pluginUrl`
option.
```
grafana-cli --pluginUrl https://nexus.company.com/grafana/plugins/<plugin-id>-<plugin-version>.zip plugins install <plugin-id>
```
To manually install a Plugin via the Grafana.com API:
1.
Find the plugin you want to download, the plugin id can be found on the Installation Tab on the plugin's page on Grafana.com. In this example, the plugin id is
`jdbranham-diagram-panel`
:
...
...
pkg/cmd/grafana-cli/commands/command_line.go
View file @
e978bfc3
...
...
@@ -19,6 +19,7 @@ type CommandLine interface {
PluginDirectory
()
string
RepoDirectory
()
string
PluginURL
()
string
}
type
contextCommandLine
struct
{
...
...
@@ -44,3 +45,7 @@ func (c *contextCommandLine) PluginDirectory() string {
func
(
c
*
contextCommandLine
)
RepoDirectory
()
string
{
return
c
.
GlobalString
(
"repo"
)
}
func
(
c
*
contextCommandLine
)
PluginURL
()
string
{
return
c
.
GlobalString
(
"pluginUrl"
)
}
pkg/cmd/grafana-cli/commands/commandstest/fake_commandLine.go
View file @
e978bfc3
...
...
@@ -101,3 +101,7 @@ func (fcli *FakeCommandLine) RepoDirectory() string {
func
(
fcli
*
FakeCommandLine
)
PluginDirectory
()
string
{
return
fcli
.
GlobalString
(
"pluginsDir"
)
}
func
(
fcli
*
FakeCommandLine
)
PluginURL
()
string
{
return
fcli
.
GlobalString
(
"pluginUrl"
)
}
pkg/cmd/grafana-cli/commands/install_command.go
View file @
e978bfc3
...
...
@@ -58,37 +58,39 @@ func installCommand(c CommandLine) error {
}
func
InstallPlugin
(
pluginName
,
version
string
,
c
CommandLine
)
error
{
plugin
,
err
:=
s
.
GetPlugin
(
pluginName
,
c
.
RepoDirectory
())
pluginFolder
:=
c
.
PluginDirectory
()
if
err
!=
nil
{
return
err
}
downloadURL
:=
c
.
PluginURL
()
if
downloadURL
==
""
{
plugin
,
err
:=
s
.
GetPlugin
(
pluginName
,
c
.
RepoDirectory
())
if
err
!=
nil
{
return
err
}
v
,
err
:=
SelectVersion
(
plugin
,
version
)
if
err
!=
nil
{
return
err
}
v
,
err
:=
SelectVersion
(
plugin
,
version
)
if
err
!=
nil
{
return
err
}
if
version
==
""
{
version
=
v
.
Version
if
version
==
""
{
version
=
v
.
Version
}
downloadURL
=
fmt
.
Sprintf
(
"%s/%s/versions/%s/download"
,
c
.
GlobalString
(
"repo"
),
pluginName
,
version
)
}
downloadURL
:=
fmt
.
Sprintf
(
"%s/%s/versions/%s/download"
,
c
.
GlobalString
(
"repo"
),
pluginName
,
version
)
logger
.
Infof
(
"installing %v @ %v
\n
"
,
plugin
.
Id
,
version
)
logger
.
Infof
(
"installing %v @ %v
\n
"
,
pluginName
,
version
)
logger
.
Infof
(
"from url: %v
\n
"
,
downloadURL
)
logger
.
Infof
(
"into: %v
\n
"
,
pluginFolder
)
logger
.
Info
(
"
\n
"
)
err
=
downloadFile
(
plugin
.
Id
,
pluginFolder
,
downloadURL
)
err
:=
downloadFile
(
pluginName
,
pluginFolder
,
downloadURL
)
if
err
!=
nil
{
return
err
}
logger
.
Infof
(
"%s Installed %s successfully
\n
"
,
color
.
GreenString
(
"✔"
),
plugin
.
Id
)
logger
.
Infof
(
"%s Installed %s successfully
\n
"
,
color
.
GreenString
(
"✔"
),
plugin
Name
)
res
,
_
:=
s
.
ReadPlugin
(
pluginFolder
,
pluginName
)
for
_
,
v
:=
range
res
.
Dependencies
.
Plugins
{
...
...
pkg/cmd/grafana-cli/main.go
View file @
e978bfc3
...
...
@@ -38,6 +38,12 @@ func main() {
Value
:
"https://grafana.com/api/plugins"
,
EnvVar
:
"GF_PLUGIN_REPO"
,
},
cli
.
StringFlag
{
Name
:
"pluginUrl"
,
Usage
:
"Full url to the plugin zip file instead of downloading the plugin from grafana.com/api"
,
Value
:
""
,
EnvVar
:
"GF_PLUGIN_URL"
,
},
cli
.
BoolFlag
{
Name
:
"debug, d"
,
Usage
:
"enable debug logging"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment