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
f0d6ea17
Unverified
Commit
f0d6ea17
authored
Feb 20, 2018
by
Carl Bergquist
Committed by
GitHub
Feb 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10967 from bergquist/sample-yaml
provisioning: dont ignore sample yaml files
parents
c5461fe2
4dc6074e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
46 deletions
+51
-46
conf/provisioning/dashboards/sample.yaml
+1
-4
conf/provisioning/datasources/sample.yaml
+1
-4
pkg/services/provisioning/dashboards/config_reader.go
+1
-1
pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml
+8
-8
pkg/services/provisioning/datasources/config_reader.go
+1
-1
pkg/services/provisioning/datasources/config_reader_test.go
+12
-1
pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml
+27
-27
No files found.
conf/provisioning/dashboards/sample.yaml
View file @
f0d6ea17
# This file is only an example.
# Grafana will never read sample.yaml files
# # config file version
# # config file version
#
apiVersion: 1
apiVersion
:
1
#providers:
#providers:
# - name: 'default'
# - name: 'default'
...
...
conf/provisioning/datasources/sample.yaml
View file @
f0d6ea17
# This file is only an example.
# Grafana will never read sample.yaml files
# # config file version
# # config file version
#
apiVersion: 1
apiVersion
:
1
# # list of datasources that should be deleted from the database
# # list of datasources that should be deleted from the database
#deleteDatasources:
#deleteDatasources:
...
...
pkg/services/provisioning/dashboards/config_reader.go
View file @
f0d6ea17
...
@@ -63,7 +63,7 @@ func (cr *configReader) readConfig() ([]*DashboardsAsConfig, error) {
...
@@ -63,7 +63,7 @@ func (cr *configReader) readConfig() ([]*DashboardsAsConfig, error) {
}
}
for
_
,
file
:=
range
files
{
for
_
,
file
:=
range
files
{
if
(
!
strings
.
HasSuffix
(
file
.
Name
(),
".yaml"
)
&&
!
strings
.
HasSuffix
(
file
.
Name
(),
".yml"
))
||
file
.
Name
()
==
"sample.yaml"
{
if
!
strings
.
HasSuffix
(
file
.
Name
(),
".yaml"
)
&&
!
strings
.
HasSuffix
(
file
.
Name
(),
".yml"
)
{
continue
continue
}
}
...
...
pkg/services/provisioning/dashboards/test-configs/dashboards-from-disk/sample.yaml
View file @
f0d6ea17
apiVersion
:
1
apiVersion
:
1
providers
:
#
providers:
-
name
:
'
gasdf'
#
- name: 'gasdf'
orgId
:
2
#
orgId: 2
folder
:
'
developers'
#
folder: 'developers'
editable
:
true
#
editable: true
type
:
file
#
type: file
options
:
#
options:
path
:
/var/lib/grafana/dashboards
#
path: /var/lib/grafana/dashboards
pkg/services/provisioning/datasources/config_reader.go
View file @
f0d6ea17
...
@@ -24,7 +24,7 @@ func (cr *configReader) readConfig(path string) ([]*DatasourcesAsConfig, error)
...
@@ -24,7 +24,7 @@ func (cr *configReader) readConfig(path string) ([]*DatasourcesAsConfig, error)
}
}
for
_
,
file
:=
range
files
{
for
_
,
file
:=
range
files
{
if
(
strings
.
HasSuffix
(
file
.
Name
(),
".yaml"
)
||
strings
.
HasSuffix
(
file
.
Name
(),
".yml"
))
&&
file
.
Name
()
!=
"sample.yaml"
{
if
strings
.
HasSuffix
(
file
.
Name
(),
".yaml"
)
||
strings
.
HasSuffix
(
file
.
Name
(),
".yml"
)
{
datasource
,
err
:=
cr
.
parseDatasourceConfig
(
path
,
file
)
datasource
,
err
:=
cr
.
parseDatasourceConfig
(
path
,
file
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
pkg/services/provisioning/datasources/config_reader_test.go
View file @
f0d6ea17
...
@@ -138,7 +138,7 @@ func TestDatasourceAsConfig(t *testing.T) {
...
@@ -138,7 +138,7 @@ func TestDatasourceAsConfig(t *testing.T) {
t
.
Fatalf
(
"readConfig return an error %v"
,
err
)
t
.
Fatalf
(
"readConfig return an error %v"
,
err
)
}
}
So
(
len
(
cfg
),
ShouldEqual
,
2
)
So
(
len
(
cfg
),
ShouldEqual
,
3
)
dsCfg
:=
cfg
[
0
]
dsCfg
:=
cfg
[
0
]
...
@@ -146,6 +146,17 @@ func TestDatasourceAsConfig(t *testing.T) {
...
@@ -146,6 +146,17 @@ func TestDatasourceAsConfig(t *testing.T) {
validateDatasource
(
dsCfg
)
validateDatasource
(
dsCfg
)
validateDeleteDatasources
(
dsCfg
)
validateDeleteDatasources
(
dsCfg
)
dsCount
:=
0
delDsCount
:=
0
for
_
,
c
:=
range
cfg
{
dsCount
+=
len
(
c
.
Datasources
)
delDsCount
+=
len
(
c
.
DeleteDatasources
)
}
So
(
dsCount
,
ShouldEqual
,
2
)
So
(
delDsCount
,
ShouldEqual
,
1
)
})
})
Convey
(
"can read all properties from version 0"
,
func
()
{
Convey
(
"can read all properties from version 0"
,
func
()
{
...
...
pkg/services/provisioning/datasources/test-configs/all-properties/sample.yaml
View file @
f0d6ea17
...
@@ -3,30 +3,30 @@
...
@@ -3,30 +3,30 @@
apiVersion
:
1
apiVersion
:
1
datasources
:
#
datasources:
-
name
:
name
#
- name: name
type
:
type
#
type: type
access
:
proxy
#
access: proxy
orgId
:
2
#
orgId: 2
url
:
url
#
url: url
password
:
password
#
password: password
user
:
user
#
user: user
database
:
database
#
database: database
basicAuth
:
true
#
basicAuth: true
basicAuthUser
:
basic_auth_user
#
basicAuthUser: basic_auth_user
basicAuthPassword
:
basic_auth_password
#
basicAuthPassword: basic_auth_password
withCredentials
:
true
#
withCredentials: true
jsonData
:
#
jsonData:
graphiteVersion
:
"
1.1"
#
graphiteVersion: "1.1"
tlsAuth
:
true
#
tlsAuth: true
tlsAuthWithCACert
:
true
#
tlsAuthWithCACert: true
secureJsonData
:
#
secureJsonData:
tlsCACert
:
"
MjNOcW9RdkbUDHZmpco2HCYzVq9dE+i6Yi+gmUJotq5CDA=="
#
tlsCACert: "MjNOcW9RdkbUDHZmpco2HCYzVq9dE+i6Yi+gmUJotq5CDA=="
tlsClientCert
:
"
ckN0dGlyMXN503YNfjTcf9CV+GGQneN+xmAclQ=="
#
tlsClientCert: "ckN0dGlyMXN503YNfjTcf9CV+GGQneN+xmAclQ=="
tlsClientKey
:
"
ZkN4aG1aNkja/gKAB1wlnKFIsy2SRDq4slrM0A=="
#
tlsClientKey: "ZkN4aG1aNkja/gKAB1wlnKFIsy2SRDq4slrM0A=="
editable
:
true
#
editable: true
version
:
10
#
version: 10
#
deleteDatasources
:
#
deleteDatasources:
-
name
:
old-graphite3
#
- name: old-graphite3
orgId
:
2
#
orgId: 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