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
a6c6b00d
Commit
a6c6b00d
authored
Mar 07, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:grafana/grafana
parents
2a557f67
1a6af064
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
pkg/cmd/grafana-cli/commands/commands.go
+1
-1
pkg/cmd/grafana-cli/commands/install_command.go
+15
-1
pkg/cmd/grafana-cli/commands/ls_command.go
+11
-4
No files found.
pkg/cmd/grafana-cli/commands/commands.go
View file @
a6c6b00d
...
...
@@ -11,7 +11,7 @@ func runCommand(command func(commandLine CommandLine) error) func(context *cli.C
cmd
:=
&
contextCommandLine
{
context
}
if
err
:=
command
(
cmd
);
err
!=
nil
{
log
.
Errorf
(
"%
v
\n\n
"
,
err
)
log
.
Errorf
(
"%
s
\n\n
"
,
err
)
cmd
.
ShowHelp
()
os
.
Exit
(
1
)
...
...
pkg/cmd/grafana-cli/commands/install_command.go
View file @
a6c6b00d
...
...
@@ -43,7 +43,11 @@ func installCommand(c CommandLine) error {
pluginToInstall
:=
c
.
Args
()
.
First
()
version
:=
c
.
Args
()
.
Get
(
1
)
log
.
Infof
(
"version: %v
\n
"
,
version
)
if
version
==
""
{
log
.
Infof
(
"version: latest
\n
"
)
}
else
{
log
.
Infof
(
"version: %v
\n
"
,
version
)
}
return
InstallPlugin
(
pluginToInstall
,
pluginFolder
,
version
,
c
.
GlobalString
(
"repo"
))
}
...
...
@@ -62,6 +66,10 @@ func InstallPlugin(pluginName, pluginFolder, version, repoUrl string) error {
url
:=
v
.
Url
commit
:=
v
.
Commit
if
version
==
""
{
version
=
v
.
Version
}
downloadURL
:=
url
+
"/archive/"
+
commit
+
".zip"
log
.
Infof
(
"installing %v @ %v
\n
"
,
plugin
.
Id
,
version
)
...
...
@@ -114,6 +122,12 @@ func downloadFile(pluginName, filepath, url string) (err error) {
if
err
!=
nil
{
return
err
}
log
.
Infof
(
"Got statuscode %s from %s
\n
"
,
resp
.
Status
,
url
)
if
resp
.
StatusCode
==
302
||
resp
.
StatusCode
==
301
{
str
,
_
:=
ioutil
.
ReadAll
(
resp
.
Body
)
log
.
Info
(
"body %s
\n\n
"
,
string
(
str
))
}
r
,
err
:=
zip
.
NewReader
(
bytes
.
NewReader
(
body
),
resp
.
ContentLength
)
if
err
!=
nil
{
...
...
pkg/cmd/grafana-cli/commands/ls_command.go
View file @
a6c6b00d
...
...
@@ -2,6 +2,7 @@ package commands
import
(
"errors"
"fmt"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
...
...
@@ -14,11 +15,11 @@ var validateLsCommmand = func(pluginDir string) error {
return
errors
.
New
(
"missing path flag"
)
}
log
.
Info
(
"plugindir: "
+
pluginDir
+
"
\n
"
)
log
.
Debug
(
"plugindir: "
+
pluginDir
+
"
\n
"
)
pluginDirInfo
,
err
:=
s
.
IoHelper
.
Stat
(
pluginDir
)
if
err
!=
nil
{
return
errors
.
New
(
"missing path flag"
)
return
fmt
.
Errorf
(
"error: %s"
,
err
)
}
if
pluginDirInfo
.
IsDir
()
==
false
{
...
...
@@ -34,8 +35,14 @@ func lsCommand(c CommandLine) error {
return
err
}
for
_
,
plugin
:=
range
ls_getPlugins
(
pluginDir
)
{
log
.
Infof
(
"plugin: %s @ %s
\n
"
,
plugin
.
Name
,
plugin
.
Info
.
Version
)
plugins
:=
ls_getPlugins
(
pluginDir
)
if
len
(
plugins
)
>
0
{
log
.
Info
(
"installed plugins:
\n
"
)
}
for
_
,
plugin
:=
range
plugins
{
log
.
Infof
(
"%s @ %s
\n
"
,
plugin
.
Id
,
plugin
.
Info
.
Version
)
}
return
nil
...
...
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