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
74625771
Commit
74625771
authored
Feb 15, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cli): align code with core grafana
parent
9c50b89d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
17 additions
and
19 deletions
+17
-19
pkg/cmd/grafana-cli/commands/commands.go
+2
-0
pkg/cmd/grafana-cli/commands/install_command.go
+3
-3
pkg/cmd/grafana-cli/commands/listremote_command.go
+2
-2
pkg/cmd/grafana-cli/commands/remove_command.go
+2
-2
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
+5
-5
pkg/cmd/grafana-cli/main.go
+3
-2
pkg/cmd/grafana-cli/version/version.go
+0
-5
No files found.
pkg/cmd/grafana-cli/commands/commands.go
View file @
74625771
...
...
@@ -3,6 +3,7 @@ package commands
import
(
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"os"
)
func
runCommand
(
command
func
(
commandLine
CommandLine
)
error
)
func
(
context
*
cli
.
Context
)
{
...
...
@@ -13,6 +14,7 @@ func runCommand(command func(commandLine CommandLine) error) func(context *cli.C
log
.
Errorf
(
"%v
\n\n
"
,
err
)
cmd
.
ShowHelp
()
os
.
Exit
(
1
)
}
else
{
log
.
Info
(
"Restart grafana after installing plugins . <service grafana-server restart>
\n
"
)
}
...
...
pkg/cmd/grafana-cli/commands/install_command.go
View file @
74625771
...
...
@@ -6,7 +6,7 @@ import (
"errors"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
ervices
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"io"
"io/ioutil"
"net/http"
...
...
@@ -49,7 +49,7 @@ func installCommand(c CommandLine) error {
}
func
InstallPlugin
(
pluginName
,
pluginFolder
,
version
string
)
error
{
plugin
,
err
:=
s
ervices
.
GetPlugin
(
pluginName
)
plugin
,
err
:=
s
.
GetPlugin
(
pluginName
)
if
err
!=
nil
{
return
err
}
...
...
@@ -74,7 +74,7 @@ func InstallPlugin(pluginName, pluginFolder, version string) error {
log
.
Info
(
"Installed %s successfully ✔
\n
"
,
plugin
.
Id
)
}
res
:=
s
ervices
.
ReadPlugin
(
pluginFolder
,
pluginName
)
res
:=
s
.
ReadPlugin
(
pluginFolder
,
pluginName
)
for
_
,
v
:=
range
res
.
Dependency
.
Plugins
{
log
.
Infof
(
"Installing Dependency: %s
\n
"
,
v
.
Id
)
...
...
pkg/cmd/grafana-cli/commands/listremote_command.go
View file @
74625771
...
...
@@ -2,11 +2,11 @@ package commands
import
(
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
)
func
listremoteCommand
(
c
CommandLine
)
error
{
plugin
,
err
:=
s
ervices
.
ListAllPlugins
()
plugin
,
err
:=
s
.
ListAllPlugins
()
if
err
!=
nil
{
return
err
...
...
pkg/cmd/grafana-cli/commands/remove_command.go
View file @
74625771
...
...
@@ -19,14 +19,14 @@ func removeCommand(c CommandLine) error {
plugin
:=
c
.
Args
()
.
First
()
log
.
Info
(
"plugin: "
+
plugin
+
"
\n
"
)
if
plugin
==
""
{
return
errors
.
New
(
"Missing
which
plugin parameter"
)
return
errors
.
New
(
"Missing plugin parameter"
)
}
log
.
Infof
(
"plugins :
\n
%v
\n
"
,
localPlugins
)
for
_
,
p
:=
range
localPlugins
{
log
.
Infof
(
"is %s == %s ? %v"
,
p
.
Id
,
c
.
Args
()
.
First
(),
p
.
Id
==
c
.
Args
()
.
First
())
if
p
.
Id
==
c
.
Args
()
.
First
()
{
log
.
Infof
(
"removing plugin %s"
,
p
.
Id
)
removePlugin
(
pluginPath
,
p
.
Id
)
}
}
...
...
pkg/cmd/grafana-cli/commands/upgrade_all_command.go
View file @
74625771
...
...
@@ -3,7 +3,7 @@ package commands
import
(
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
m
"github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
s
ervices
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
s
"github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
"github.com/hashicorp/go-version"
)
...
...
@@ -30,9 +30,9 @@ func ShouldUpgrade(installed string, remote m.Plugin) bool {
func
upgradeAllCommand
(
c
CommandLine
)
error
{
pluginDir
:=
c
.
GlobalString
(
"path"
)
localPlugins
:=
s
ervices
.
GetLocalPlugins
(
pluginDir
)
localPlugins
:=
s
.
GetLocalPlugins
(
pluginDir
)
remotePlugins
,
err
:=
s
ervices
.
ListAllPlugins
()
remotePlugins
,
err
:=
s
.
ListAllPlugins
()
if
err
!=
nil
{
return
err
...
...
@@ -51,9 +51,9 @@ func upgradeAllCommand(c CommandLine) error {
}
for
_
,
p
:=
range
pluginsToUpgrade
{
log
.
Infof
(
"
lets upgrade %v
\n
"
,
p
)
log
.
Infof
(
"
Upgrading %v
\n
"
,
p
.
Id
)
s
ervices
.
RemoveInstalledPlugin
(
pluginDir
,
p
.
Id
)
s
.
RemoveInstalledPlugin
(
pluginDir
,
p
.
Id
)
InstallPlugin
(
p
.
Id
,
pluginDir
,
""
)
}
...
...
pkg/cmd/grafana-cli/main.go
View file @
74625771
...
...
@@ -5,11 +5,12 @@ import (
"github.com/codegangsta/cli"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/commands"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/log"
"github.com/grafana/grafana/pkg/cmd/grafana-cli/version"
"os"
"runtime"
)
var
version
=
"master"
func
getGrafanaPluginPath
()
string
{
//TODO: try to get path from os:env GF_PLUGIN_FOLDER
...
...
@@ -28,7 +29,7 @@ func main() {
app
.
Name
=
"Grafana cli"
app
.
Author
=
"raintank"
app
.
Email
=
"https://github.com/grafana/grafana"
app
.
Version
=
version
.
Version
app
.
Version
=
version
app
.
Flags
=
[]
cli
.
Flag
{
cli
.
StringFlag
{
Name
:
"path"
,
...
...
pkg/cmd/grafana-cli/version/version.go
deleted
100644 → 0
View file @
9c50b89d
package
version
var
(
Version
=
"0.0.2"
)
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