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
81ff8565
Unverified
Commit
81ff8565
authored
Jul 10, 2019
by
Ryan McKinley
Committed by
GitHub
Jul 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grafana-cli: allow installing plugins from a local zip file (#18021)
parent
648aa622
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
pkg/cmd/grafana-cli/commands/install_command.go
+19
-10
No files found.
pkg/cmd/grafana-cli/commands/install_command.go
View file @
81ff8565
...
...
@@ -85,7 +85,7 @@ func InstallPlugin(pluginName, version string, c utils.CommandLine) error {
}
logger
.
Infof
(
"installing %v @ %v
\n
"
,
pluginName
,
version
)
logger
.
Infof
(
"from
url
: %v
\n
"
,
downloadURL
)
logger
.
Infof
(
"from: %v
\n
"
,
downloadURL
)
logger
.
Infof
(
"into: %v
\n
"
,
pluginFolder
)
logger
.
Info
(
"
\n
"
)
...
...
@@ -145,18 +145,27 @@ func downloadFile(pluginName, filePath, url string) (err error) {
}
}()
resp
,
err
:=
http
.
Get
(
url
)
// #nosec
if
err
!=
nil
{
return
err
}
defer
resp
.
Body
.
Close
()
var
bytes
[]
byte
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
err
if
_
,
err
:=
os
.
Stat
(
url
);
err
==
nil
{
bytes
,
err
=
ioutil
.
ReadFile
(
url
)
if
err
!=
nil
{
return
err
}
}
else
{
resp
,
err
:=
http
.
Get
(
url
)
// #nosec
if
err
!=
nil
{
return
err
}
defer
resp
.
Body
.
Close
()
bytes
,
err
=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
return
err
}
}
return
extractFiles
(
b
ody
,
pluginName
,
filePath
)
return
extractFiles
(
b
ytes
,
pluginName
,
filePath
)
}
func
extractFiles
(
body
[]
byte
,
pluginName
string
,
filePath
string
)
error
{
...
...
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