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
e4f649e2
Unverified
Commit
e4f649e2
authored
Apr 23, 2019
by
Andrej Ocenas
Committed by
GitHub
Apr 23, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chore: Small improvements to grafana-cli (#16670)
* Small improvements * Better error handling
parent
c429934a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
3 deletions
+11
-3
pkg/cmd/grafana-cli/main.go
+1
-1
pkg/cmd/grafana-cli/services/services.go
+9
-1
pkg/setting/setting.go
+1
-1
No files found.
pkg/cmd/grafana-cli/main.go
View file @
e4f649e2
...
...
@@ -66,7 +66,7 @@ func main() {
func
setupLogging
()
{
for
_
,
f
:=
range
os
.
Args
{
if
f
==
"-
D
"
||
f
==
"--debug"
||
f
==
"-debug"
{
if
f
==
"-
d
"
||
f
==
"--debug"
||
f
==
"-debug"
{
logger
.
SetDebug
(
true
)
}
}
...
...
pkg/cmd/grafana-cli/services/services.go
View file @
e4f649e2
...
...
@@ -21,6 +21,7 @@ var (
IoHelper
m
.
IoUtil
=
IoUtilImp
{}
HttpClient
http
.
Client
grafanaVersion
string
NotFoundError
=
errors
.
New
(
"404 not found error"
)
)
func
Init
(
version
string
,
skipTLSVerify
bool
)
{
...
...
@@ -126,10 +127,14 @@ func RemoveInstalledPlugin(pluginPath, pluginName string) error {
}
func
GetPlugin
(
pluginId
,
repoUrl
string
)
(
m
.
Plugin
,
error
)
{
logger
.
Debugf
(
"getting plugin metadata from: %v pluginId: %v
\n
"
,
repoUrl
,
pluginId
)
body
,
err
:=
sendRequest
(
repoUrl
,
"repo"
,
pluginId
)
if
err
!=
nil
{
logger
.
Info
(
"Failed to send request"
,
"error"
,
err
)
logger
.
Info
(
"Failed to send request: "
,
err
)
if
err
==
NotFoundError
{
return
m
.
Plugin
{},
fmt
.
Errorf
(
"Failed to find requested plugin, check if the plugin_id is correct. error: %v"
,
err
)
}
return
m
.
Plugin
{},
fmt
.
Errorf
(
"Failed to send request. error: %v"
,
err
)
}
...
...
@@ -169,6 +174,9 @@ func sendRequest(repoUrl string, subPaths ...string) ([]byte, error) {
return
[]
byte
{},
err
}
if
res
.
StatusCode
==
404
{
return
[]
byte
{},
NotFoundError
}
if
res
.
StatusCode
/
100
!=
2
{
return
[]
byte
{},
fmt
.
Errorf
(
"Api returned invalid status: %s"
,
res
.
Status
)
}
...
...
pkg/setting/setting.go
View file @
e4f649e2
...
...
@@ -770,7 +770,7 @@ func (cfg *Cfg) Load(args *CommandLineArgs) error {
pluginsSection
:=
iniFile
.
Section
(
"plugins"
)
cfg
.
PluginsEnableAlpha
=
pluginsSection
.
Key
(
"enable_alpha"
)
.
MustBool
(
false
)
cfg
.
PluginsAppsSkipVerifyTLS
=
iniFile
.
Section
(
"plugins"
)
.
Key
(
"app_tls_skip_verify_insecure"
)
.
MustBool
(
false
)
cfg
.
PluginsAppsSkipVerifyTLS
=
pluginsSection
.
Key
(
"app_tls_skip_verify_insecure"
)
.
MustBool
(
false
)
// check old location for this option
if
panelsSection
.
Key
(
"enable_alpha"
)
.
MustBool
(
false
)
{
...
...
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