Commit Graph

260 Commits

Author SHA1 Message Date
Alexander Zobnin
4f9123ebe2
Provisioning: always pin app to the sidebar when enabled (#29084) 2020-11-17 09:45:40 +03:00
Arve Knudsen
ab078133bf
Backend: Remove unused code (#28933)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-11 11:38:04 +01:00
Arve Knudsen
7897c6b7d5
Chore: Fix staticcheck issues (#28854)
* Chore: Fix issues reported by staticcheck

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>

* Undo changes

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-11-05 11:57:20 +01:00
Maksim Nabokikh
6e3e0dead8
Provisioning: Remove provisioned dashboards without parental reader (#26143) 2020-09-11 09:19:44 +02:00
Maksim Nabokikh
b646a1d627
Provisioning: describe which folder caused an error while provisioning from files structure (#26771)
* Provisioning: describe which folder caused an error while provisioning from files structure

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* Apply suggestions from code review

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Remove unused DashType constants

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-08-04 09:03:09 -07:00
Arve Knudsen
16c185c3b9
Chore: Drop xerrors dependency (#26718)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-31 09:45:20 +02:00
Maksim Nabokikh
ba2524cd88
Provisioning: Add validation for missing organisations in datasource, dashboard, and notifier configurations (#26601)
* Provisioning: Check that org. from config exists

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* Apply suggestions from code review

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Fix some code after applying suggestions

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

* Add negative test case

Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-30 12:59:12 +03:00
Maksim Nabokikh
a1f40195be
Provisioning: Validate that datasource access field equals to direct or proxy (#26440)
* Validate that datasource access field equals to allowed value (direct or proxy)
2020-07-20 10:01:25 +02:00
Marcus Efraimsson
7969d6645a
Provisioning: Support alert notification channel secure settings (#26168)
Closes #25968
2020-07-17 13:54:01 +02:00
Arve Knudsen
d4e4cb4c71
Chore: Enable Go linter gocritic (#26224)
* Chore: Enable gocritic linter

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-16 14:39:01 +02:00
Marcus Efraimsson
b97d1f4170
Provisioning: Fix bug when provision app plugins using Enterprise edition (#26340)
In OSS provisioning service init after plugin registration, but in
Enterprise it's the opposite order and installed app plugin check
fails. This adjusts service registry init priority to make sure plugins
are registered before provisioning inits.

Which issue(s) this PR fixes:
Fixes #26336
2020-07-16 10:36:08 +02:00
Arve Knudsen
41d432b5ae
Chore: Enable whitespace linter (#25903)
Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-07-06 20:17:28 +02:00
Carl Bergquist
db8d7ffbf6
Linting fixes for the provisioning package (#25690) 2020-06-30 22:46:41 +02:00
Maksim Nabokikh
810ec4c5f8
Provisioning: Use folders structure from the file system to create desired folders in dashboard provisioning. (#23117)
Fixes #12016
2020-06-30 15:33:26 +02:00
Emil Tullstedt
112c28033d
Provisioning: Apply settings expanders (#25692)
* Provisioning: Apply settings expanders

Adds support for the variable expanders introduced to the configuration file in #25075 to provisioning.

* Update pkg/services/provisioning/values/values_test.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Update pkg/services/provisioning/values/values.go

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

* Provisioning: Handle errors when expanding JSON maps
2020-06-25 12:04:42 +02:00
Marcus Efraimsson
cc95754e0d
Provisioning: Adds support for enabling app plugins (#25649)
Adds support for enabling app plugins using provisioning. 

Ref #11409

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
2020-06-22 17:49:13 +02:00
Arve Knudsen
07582a8e85
Chore: Fix various spelling errors in back-end code (#25241)
* Chore: Fix various spelling errors in back-end code
Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>>
2020-06-01 17:11:25 +02:00
Carl Bergquist
c62591e77b
Provisioning: Makes file the default dashboard provisioner type (#24856)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-05-19 15:01:04 +02:00
Carl Bergquist
7610d5717a
Provisioning: Use proxy as default access mode in provisioning (#24669)
fixes #24591
fixes #19501
2020-05-14 12:40:00 +02:00
Mario Trangoni
5116420e9a
Fix misspell issues (#23905)
* Fix misspell issues

See,
$ golangci-lint run --timeout 10m --disable-all -E misspell ./...

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* Fix codespell issues

See,
$ codespell -S './.git*' -L 'uint,thru,pres,unknwon,serie,referer,uptodate,durationm'

Signed-off-by: Mario Trangoni <mjtrangoni@gmail.com>

* ci please?

* non-empty commit - ci?

* Trigger build

Co-authored-by: bergquist <carl.bergquist@gmail.com>
Co-authored-by: Kyle Brandt <kyle@grafana.com>
2020-04-29 21:37:21 +02:00
Andrej Ocenas
e5dd7efdee
Provisioning: Allows specifying uid for datasource and use that in derived fields (#23585)
* Add uid to datasource

* Fix uid passing when provisioning

* Better error handling and Uid column type change

* Fix test and strict null error counts

* Add backend tests

* Add tests

* Fix strict null checks

* Update test

* Improve tests

* Update pkg/services/sqlstore/datasource.go

Co-Authored-By: Arve Knudsen <arve.knudsen@gmail.com>

* Variable rename

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
2020-04-20 15:48:38 +02:00
Carl Bergquist
5fc255bd89
Linting fixes for provisoning (#23600) 2020-04-16 05:46:20 +02:00
Carl Bergquist
80f40040b0
Linting fixes for dashboard provsioning (#23576) 2020-04-15 08:12:52 +02:00
Artur Kondas
9f2af718dc
Provisioning: Validate that dashboard providers have unique names (#22898)
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
Co-authored-by: bergquist <carl.bergquist@gmail.com>
2020-04-14 20:54:00 +02:00
Carl Bergquist
0fd5945542
Fixes linting errors in datasource provisioning. (#23515) 2020-04-11 21:07:07 +02:00
huanggze
69c5efcf00
Cleanup: move interface ProvisioningService into provisioning package (#23061) 2020-03-25 14:14:24 +01:00
Carl Bergquist
f9962eabff
chore: avoid aliasing imports in services (#22499) 2020-02-29 13:35:15 +01:00
Marcus Efraimsson
ca84829647
Provisioning: Start provision dashboards after Grafana server have started (#21564)
6.2-beta1 changed so that data sources, dashboards and alert notifiers 
are provisioned on service Init where's before only data sources and 
alert notifiers was provisioned on service Init and dashboards was first
provisioned in service Run which happens after Grafana server have 
started.
This change reverts so that dashboard provisioning are first happening 
in service Run, after Grafana server have started.

Fixes #21133
2020-01-17 13:39:41 +01:00
Alexander Morozov
06bf7e8ef1 OAuth: Removes send_client_credentials_via_post setting (#20044)
Removes send_client_credentials_via_post oauth setting and 
use auto-detect mechanism instead.
By these changes also fixes statichcheck errors

Ref #8968
2019-12-12 20:00:56 +01:00
Andrej Ocenas
3f144bdd05 Provisioning: Fix unmarshaling nested jsonData values (#20399)
Problem was that yaml unmarshal returned nested maps as
 map[interface{}]interface{} which are then not marshal-able 
to json because of that interface{} key type. This adds explicit 
casting of the keys in the yaml value types to string which 
then makes the values marshal-able to JSON in DB.

Fixes: #11537
2019-11-18 11:06:39 +01:00
Jon Gyllenswärd
b489c75aaf
Provisioning: fix for cannot save provisioned dashboard (#20218)
Provisioning of dashboards now always overwrite existing ones and does not look at the configuration `allowUiUpdates` anymore
2019-11-07 10:49:24 +01:00
Jon Gyllenswärd
a45ce36566
Allow saving of provisioned dashboards (#19820)
Allows saving of provisioned dashboards if the config value allowUiUpdates is set to true

Fixes #11778
2019-10-31 14:27:31 +01:00
gotjosh
8e508e5ce4 Provisioning: Handle empty nested keys on YAML provisioning datasources (#19547)
* Fix: Handle empty nested keys on YAML provisioning datasources

As we provision a datasource via a YAML file, we attempt to transform the
file into sensible Go types that the provisioning code can use.

While this happens, there is a chance some of the keys nested within
the YAML array are empty.

This fix allows the YAML parser to handle empty keys by null checking
the return of `reflect.TypeOf` which according to the documentation:

> TypeOf returns the reflection Type that represents the dynamic type of i. If i is a nil interface value, TypeOf returns nil.

Can return nil.

* Add tests
2019-10-02 08:48:19 +02:00
Erik Sundell
4dbedb8405 Azure Monitor: Revert support for cross resource queries (#19115)" (#19346)
This reverts commit 88051258e9.
2019-09-24 12:01:12 +02:00
Erik Sundell
88051258e9
Azure Monitor: Add support for cross resource queries (#19115)
* Add new query mode picker with different states for each query. Also really simple migration script

* Populate cross resource dropdowns

* Cleanup. Handle change events

* Add multi select picker for subscriptions

* Fix markup issue

* Prepare for new query mode

* More cleanup

* Handle multiple queries both in ds and backend

* Refactoring

* Improve migration

* Add support for multiselect display name

* Use multiselect also for locations and resources

* Add more typings

* Fix migrations

* Custom multiselect built for array of options instead of variables

* Add url builder test

* fix datasource tests

* UI fixes

* Improve query editor init

* Fix brokens tests

* Cleanup

* Fix tslint issue

* Change query mode display name

* Make sure alerting works for single queries

* Friendly error for multi resources

* Add temporary typings
2019-09-17 11:35:40 +02:00
Kyle Brandt
76d08989f0
provisioning: escape literal '$' with '$$' to avoid interpolation (#18045)
fixes #17986
2019-07-11 07:32:07 -04:00
Oleg Gaidarenko
caa1314f44
Build: use golangci-lint as a make command (#17739)
* Build: use golangci-lint as a make command

* Since gometalinter was deprecated in favor of golangci-lint so it was
  replaced by it. Responsibilities held by the gometalinter was moved to
  golangci-lint

* There was some changes in implementation (that was also mentioned in
  the code comment) between the tools, which uncovered couple errors
  in the code. Those issues were either solved or disabled by
  the inline comments

* Introduce the golangci-lint config, to make their
  configuration more manageable

* Build: replace backend-lint.sh script with make
2019-07-02 16:06:59 +03:00
Augustin Husson
c8382ba435 Provisioning: Support folder that doesn't exist yet in dashboard provisioning (#17407)
closes #17320
2019-06-04 22:23:08 +02:00
Carl Bergquist
c87b2c9913
docs: fixes typo in provisioning docs (#17248)
closes #17196
2019-05-23 13:06:34 +02:00
Oleg Gaidarenko
be66ed9dab
Chore: explore possibilities of using makefile (#17039)
* Chore: explore possibilities of using makefile

This is an exploratory commit - I wanted to see how
revive/gosec linters could be integrated with makefile and our build scripts.

Looks better then I expected :)

* Chore: make revive happy

Revive execution was not supplied with path, if you restore there is couple
errors that were popping up - so I fixed them

* Chore: make revive happy
2019-05-16 00:29:26 +03:00
Carl Bergquist
c55e6016bf
backend: replace /pkg/errors with errutil (#17065) 2019-05-15 12:20:17 +02:00
zhulongcheng
2fff8f77dc move log package to /infra (#17023)
ref #14679

Signed-off-by: zhulongcheng <zhulongcheng.me@gmail.com>
2019-05-13 08:45:54 +02:00
Andrej Ocenas
eb82a75668
Provisioning: Show file path of provisioning file in save/delete dialogs (#16706)
* Add file path to metadata and show it in dialogs

* Make path relative to config directory

* Fix tests

* Add test for the relative path

* Refactor to use path relative to provisioner path

* Change return types

* Rename attribute

* Small fixes from review
2019-04-30 13:32:18 +02:00
Torkel Ödegaard
9b68952482 Provisioning: Trying to fix failing test (#16800)
* Provisioning: Trying to fix test

* Use better sync strategy for test

* Lower the timeout

* Remove commented code

Co-Authored-By: aocenas <mr.ocenas@gmail.com>
2019-04-30 10:35:54 +02:00
Andrej Ocenas
42b745a098
Provisioning: Add API endpoint to reload provisioning configs (#16579)
* Add api to reaload provisioning

* Refactor and simplify the polling code

* Add test for the provisioning service

* Fix provider initialization and move some code to file reader

* Simplify the code and move initialization

* Remove unused code

* Update comment

* Add comment

* Change error messages

* Add DashboardProvisionerFactory type

* Update imports

* Use new assert lib

* Use mutext for synchronizing the reloading

* Fix typo

Co-Authored-By: aocenas <mr.ocenas@gmail.com>

* Add docs about the new api
2019-04-25 09:06:44 +02:00
Andrej Ocenas
fcebd713a5
Provisioning: Interpolate env vars in provisioning files (#16499)
* Add value types with custom unmarshalling logic

* Add env support for notifications config

* Use env vars in json data tests for values

* Add some more complexities to value tests

* Update comment with example usage

* Set env directly in the tests, removing patching

* Update documentation

* Add env var to the file reader tests

* Add raw value

* Post merge fixes

* Add comment
2019-04-24 15:39:47 +02:00
Josh
fca5ee4bea Provisioning: Support FolderUid in Dashboard Provisioning Config (#16559)
* add folderUid to DashbaordsAsConfig structs and DashbardProviderConfigs struct, set these values in mapping func
look for new folderUid values in config_reader tests
set dashboard folder Uid explicitly in file_reader, which has no affect when not given

* formatting and docstrings

* add folderUid to DashbaordsAsConfig structs and DashbardProviderConfigs struct, set these values in mapping func
look for new folderUid values in config_reader tests
set dashboard folder Uid explicitly in file_reader, which has no affect when not given

* formatting and docstrings

* add folderUid option, as well as documentation for the rest of the fields

* add blank folderUid in devenv example.

* add folderUid to provisioning sample yaml

* instead of just warning, return error if unmarshalling dashboard provisioning file fails

* Removing the error handling and adding comment

* Add duplicity check for folder Uids


Co-authored-by: swtch1 <joshua.thornton@protonmail.com>
2019-04-24 08:57:42 +02:00
Andrej Ocenas
66f6e16916
Security: Store datasource passwords encrypted in secureJsonData (#16175)
* Store passwords in secureJsonData

* Revert unnecessary refactors

* Fix for nil jsonSecureData value

* Remove copied encryption code from migration

* Fix wrong field reference

* Remove migration and provisioning changes

* Use password getters in datasource proxy

* Refactor password handling in datasource configs

* Add provisioning warnings

* Update documentation

* Remove migration command, moved to separate PR

* Remove unused code

* Set the upgrade version

* Remove unused code

* Remove double reference
2019-04-15 11:11:17 +02:00
Andrej Ocenas
2d7fc55df7
Provisioning: Do not allow deletion of provisioned dashboards (#16211)
* Unprovision dashboard in case of DisableDeletion = true

* Rename command struct

* Handle removed provision files

* Allow html in confirm-modal

* Do not show confirm button without onConfirm

* Show dialog on deleting provisioned dashboard

* Changed DeleteDashboard to DeleteProvisionedDashboard

* Remove unreachable return

* Add provisioned checks to API

* Remove filter func

* Fix and add tests for deleting dashboards

* Change delete confirm text

* Added and used pkg/errors for error wrapping
2019-04-10 13:29:10 +02:00
Marcus Efraimsson
b4267eafb8
log root cause error when reading from provisioning directories 2019-02-07 15:46:57 +01:00
bergquist
11c4967bdc changes some info logging to debug 2019-01-31 21:51:14 +01:00
bergquist
7c93335d28 gofmt issue 2019-01-28 21:04:08 +01:00
bergquist
809019d4ee moves test files into testdata folder 2019-01-28 20:44:10 +01:00
bergquist
8f0e65a150 renames alert_notifications -> notifiers 2019-01-28 20:39:09 +01:00
Pavel Bakulev
d0370ea7ad Using func InitNotifier for verifying notification settings 2019-01-16 16:50:00 +02:00
Pavel Bakulev
f132e929ce Added uid for alert notifications 2019-01-16 16:50:00 +02:00
Pavel Bakulev
6d1ec19fe9 Renamed validation funcs for alert notification 2019-01-16 16:45:42 +02:00
Pavel Bakulev
5c10a897f8 Instantiating notifiers from config before using 2019-01-16 16:45:42 +02:00
Pavel Bakulev
4fa45253cf Added orgName parameter for alert_notifications 2019-01-16 16:45:42 +02:00
Pavel Bakulev
6e3e9a337d Added alert_notification configuration 2019-01-16 16:45:42 +02:00
bergquist
8880829eda avoid infinite loop in the dashboard provisioner
if one dashboard with an uid is refered to by two
provsioners each provsioner overwrite each other.
filling up dashboard_versions quite fast if using
default settings.

ref #12864
2019-01-14 16:38:39 +01:00
Joesis
92a8c5b81b log error when resolvePath 2018-12-13 02:10:29 -08:00
bergquist
4498d75b17 provisioning: adds more logging about failed to deletion of provisioned dashboards 2018-10-03 17:38:10 +02:00
Carl Bergquist
464f3f738f
Merge pull request #13360 from sapcc/symlinks
resolve symlink on each run
2018-09-27 09:21:29 +02:00
Torkel Ödegaard
862ca07f03 fix: updated tests 2018-09-25 14:01:38 +02:00
Torkel Ödegaard
98dad530e2 provisioning: changed provisioning default update interval from 3 to 10 seconds 2018-09-22 10:06:57 +02:00
Mario Trangoni
60dfff11a0 Fix datbase > database 2018-09-21 13:41:31 +02:00
Mario Trangoni
80fa66fcb0 Fix some typos found by codespell
See,
$ codespell -S "./.git*,./vendor*,./public*"
2018-09-21 11:54:52 +02:00
Arno Uhlig
1355c00c44 fix reader linux test 2018-09-20 13:42:56 +02:00
Arno Uhlig
6b2d91815a resolve symlink on each run 2018-09-20 11:46:32 +02:00
Marcus Efraimsson
0a7be2618e
cleaning up test data 2018-08-17 15:00:37 +02:00
Marcus Efraimsson
aed89b49c0
should allow one default datasource per organisation using provisioning 2018-08-14 14:48:14 +02:00
Carl Bergquist
7214ee9024
Merge pull request #12007 from bergquist/provisioning_symlinked_folders
Add support for symlinked folders in dashboard provisioning
2018-06-04 16:00:32 +02:00
bergquist
cd4026da6b Revert "provisioning: turn relative symlinked path into absolut paths"
This reverts commit d089b5e05d.
2018-06-04 15:38:37 +02:00
bergquist
d089b5e05d provisioning: turn relative symlinked path into absolut paths 2018-06-04 15:20:26 +02:00
bergquist
f606654c50 provisioning: adds fallback if evalsymlink/abs fails 2018-06-04 09:04:33 +02:00
bergquist
3f5078339c tests: uses different paths depending on os 2018-06-04 08:27:03 +02:00
bergquist
75ee1e9208 renames intervalSeconds to updateIntervalSeconds 2018-06-04 08:13:20 +02:00
bergquist
333af6fd9b provisioning: makes the interval for polling for changes configurable 2018-05-31 21:07:34 +02:00
bergquist
c817aecd66 provisioning: only update dashboard if hash of json changed 2018-05-31 21:05:52 +02:00
bergquist
44f5b92fbc provisioning: only provision if json file is newer then db 2018-05-31 11:38:29 +02:00
bergquist
2bd4c14e5f make path absolute before following symlink 2018-05-31 09:53:15 +02:00
bergquist
47d3884377 provisioning: follow symlinked folders
fixes #11958
2018-05-31 09:38:09 +02:00
bergquist
d5aeae3a90 test: fixes broken test on windows 2018-05-31 08:27:29 +02:00
bergquist
c7acbcdaf5 provisioning: enable relative path's
this commit enable relatives path for provisioning dashboards.
this enables easier dev setups
2018-05-30 08:46:44 +02:00
bergquist
1411709db1 provisioning: place testfiles within testdata folder 2018-05-29 16:30:12 +02:00
bergquist
c40b0ea1df test: moves test files to testdata folder 2018-05-18 23:23:13 +02:00
Torkel Ödegaard
053c2039bb refactor: provisioning service refactoring 2018-05-02 19:56:15 +02:00
Karsten Weiss
b7adf28501 Remove redundancy in variable declarations (golint)
This commit fixes the following golint warnings:
pkg/api/avatar/avatar.go:229:12: should omit type *http.Client from declaration of var client; it will be inferred from the right-hand side
pkg/login/brute_force_login_protection.go:13:26: should omit type time.Duration from declaration of var loginAttemptsWindow; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:58:26: should omit type []string from declaration of var metricCategoryPrefix; it will be inferred from the right-hand side
pkg/metrics/graphitebridge/graphite.go:69:22: should omit type []string from declaration of var trimMetricPrefix; it will be inferred from the right-hand side
pkg/models/alert.go:37:36: should omit type error from declaration of var ErrCannotChangeStateOnPausedAlert; it will be inferred from the right-hand side
pkg/models/alert.go:38:36: should omit type error from declaration of var ErrRequiresNewState; it will be inferred from the right-hand side
pkg/models/datasource.go:61:28: should omit type map[string]bool from declaration of var knownDatasourcePlugins; it will be inferred from the right-hand side
pkg/plugins/update_checker.go:16:13: should omit type http.Client from declaration of var httpClient; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:103:24: should omit type time.Duration from declaration of var unfinishedWorkTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:105:19: should omit type time.Duration from declaration of var alertTimeout; it will be inferred from the right-hand side
pkg/services/alerting/engine.go:106:19: should omit type int from declaration of var alertMaxAttempts; it will be inferred from the right-hand side
pkg/services/alerting/notifier.go:143:23: should omit type map[string]*NotifierPlugin from declaration of var notifierFactories; it will be inferred from the right-hand side
pkg/services/alerting/rule.go:136:24: should omit type map[string]ConditionFactory from declaration of var conditionFactories; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:12:15: should omit type []string from declaration of var defaultTypes; it will be inferred from the right-hand side
pkg/services/alerting/conditions/evaluator.go:13:15: should omit type []string from declaration of var rangedTypes; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/opsgenie.go:44:19: should omit type string from declaration of var opsgenieAlertURL; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/pagerduty.go:43:23: should omit type string from declaration of var pagerdutyEventApiUrl; it will be inferred from the right-hand side
pkg/services/alerting/notifiers/telegram.go:21:17: should omit type string from declaration of var telegramApiUrl; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:11:24: should omit type string from declaration of var simpleDashboardConfig; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:12:24: should omit type string from declaration of var oldVersion; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/config_reader_test.go:13:24: should omit type string from declaration of var brokenConfigs; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:22:30: should omit type time.Duration from declaration of var checkDiskForChangesInterval; it will be inferred from the right-hand side
pkg/services/provisioning/dashboards/file_reader.go:24:23: should omit type error from declaration of var ErrFolderNameMissing; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:15:34: should omit type string from declaration of var twoDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:16:34: should omit type string from declaration of var twoDatasourcesConfigPurgeOthers; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:17:34: should omit type string from declaration of var doubleDatasourcesConfig; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:18:34: should omit type string from declaration of var allProperties; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:19:34: should omit type string from declaration of var versionZero; it will be inferred from the right-hand side
pkg/services/provisioning/datasources/config_reader_test.go:20:34: should omit type string from declaration of var brokenYaml; it will be inferred from the right-hand side
pkg/services/sqlstore/stats.go:16:25: should omit type time.Duration from declaration of var activeUserTimeLimit; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:69:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/mysql_dialect.go:70:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:95:14: should omit type bool from declaration of var hasLen1; it will be inferred from the right-hand side
pkg/services/sqlstore/migrator/postgres_dialect.go:96:14: should omit type bool from declaration of var hasLen2; it will be inferred from the right-hand side
pkg/setting/setting.go:42:15: should omit type string from declaration of var Env; it will be inferred from the right-hand side
pkg/setting/setting.go:161:18: should omit type bool from declaration of var LdapAllowSignup; it will be inferred from the right-hand side
pkg/setting/setting.go:473:30: should omit type bool from declaration of var skipStaticRootValidation; it will be inferred from the right-hand side
pkg/tsdb/interval.go:14:21: should omit type time.Duration from declaration of var defaultMinInterval; it will be inferred from the right-hand side
pkg/tsdb/interval.go:15:21: should omit type time.Duration from declaration of var year; it will be inferred from the right-hand side
pkg/tsdb/interval.go:16:21: should omit type time.Duration from declaration of var day; it will be inferred from the right-hand side
pkg/tsdb/cloudwatch/credentials.go:26:24: should omit type map[string]cache from declaration of var awsCredentialCache; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:15:27: should omit type *regexp.Regexp from declaration of var regexpOperatorPattern; it will be inferred from the right-hand side
pkg/tsdb/influxdb/query.go:16:27: should omit type *regexp.Regexp from declaration of var regexpMeasurementPattern; it will be inferred from the right-hand side
pkg/tsdb/mssql/mssql_test.go:25:14: should omit type string from declaration of var serverIP; it will be inferred from the right-hand side
2018-04-27 22:14:36 +02:00
Mario Trangoni
6eb00000fe pkg/services: fix ineffassign issues 2018-04-23 19:28:54 +02:00
Mario Trangoni
c1742df9ac remove unused variables detected by varcheck 2018-04-18 19:04:37 +02:00
Carl Bergquist
8367199a2d
Merge pull request #11613 from knweiss/gosimple
Code simplification (gosimple)
2018-04-17 22:40:40 +02:00
Marcus Efraimsson
8a5cb088d3
Merge branch 'master' into readonly_dashboards 2018-04-17 10:50:04 +02:00
Karsten Weiss
be2d635078 Simplify error returns (gosimple)
This fixes:
pkg/api/avatar/avatar.go:261:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/log/file.go:102:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/metrics/graphitebridge/graphite.go:298:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/provisioning/provisioning.go:23:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/alert_notification.go:27:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/alert_notification.go:27:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/annotation.go:105:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/annotation.go:105:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/dashboard.go:351:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/dashboard.go:435:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/dashboard_acl.go:38:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/dashboard_acl.go:38:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/stats.go:22:2: 'if err != nil { return err }; return err' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/team.go:213:2: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:256:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:256:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:274:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:274:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:482:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
pkg/services/sqlstore/user.go:482:3: 'if err != nil { return err }; return nil' can be simplified to 'return err' (S1013)
2018-04-16 21:04:57 +02:00
Mario Trangoni
91fb2e07ce pkg: fix codespell issues 2018-04-13 20:31:29 +02:00
Marcus Efraimsson
6bbeb723ca Merge branch 'master' into readonly_dashboards 2018-04-05 20:30:27 +02:00
bergquist
d6faa3d06f provisioning: improve UX when saving provisioned dashboards 2018-03-26 15:08:46 +02:00
bergquist
b61bc72e2a provisioning: removes id from dashboard.json
if dashboard json files contains `id` we
will just remove it form the dashboard model
before importing it into the database.

closes #11138
2018-03-26 13:17:39 +02:00
Torkel Ödegaard
2f6e77af1e Merge branch 'master' into docs_v5.0 2018-02-21 10:47:14 +01:00
bergquist
4dc6074e79 provisioning: dont ignore sample yaml files
closes #10963
2018-02-20 08:40:37 +01:00
Marcus Efraimsson
53cd39fde5 Shouldn't be able to overwrite a dashboard if you don't have permissions (#10900)
* dashboards: new command for validating dashboard before update

Removes validation logic from saveDashboard and later on use the new command for validating
dashboard before saving a dashboard. This due to the fact that we need to validate permissions
for overwriting other dashboards by uid and title.

* dashboards: use the new command for validating dashboard before saving

Had to refactor dashboard provisioning a bit to be able to sidetrack the permission validation
in a somewhat reasonable way.
Adds some initial tests of the dashboard repository, but needs to be extended later. At least
now you can mock the dashboard guardian

* dashboards: removes validation logic in the save dashboard api layer

Use the dashboard repository solely for create/update dashboards and let it do all
the validation. One exception regarding quota validation which still is in api layer
since that logic is in a macaron middleware.
Need to move out-commented api tests later.

* dashboards: fix database tests for validate and saving dashboards

* dashboards: rename dashboard repository to dashboard service

Split the old dashboard repository interface in two new interfaces, IDashboardService and
IDashboardProvisioningService. Makes it more explicit when using it from the provisioning package
and there's no possibility of calling an incorrect method for saving a dashboard.

* database: make the InitTestDB function available to use from other packages

* dashboards: rename ValidateDashboardForUpdateCommand and some refactoring

* dashboards: integration tests of dashboard service

* dashboard: fix sqlstore test due to folder exist validation

* dashboards: move dashboard service integration tests to sqlstore package

Had to move it to the sqlstore package due to concurrency problems when running
against mysql and postgres. Using InitTestDB from two packages added conflicts
when clearing and running migrations on the test database

* dashboards: refactor how to find id to be used for save permission check

* dashboards: remove duplicated dashboard tests

* dashboards: cleanup dashboard service integration tests

* dashboards: handle save dashboard errors and return correct http status

* fix: remove log statement

* dashboards: import dashboard should use dashboard service

Had to move alerting commands to models package due to problems with import cycles of packages.

* dashboards: cleanup dashboard api tests and add some tests for post dashboard

* dashboards: rename dashboard service interfaces

* dashboards: rename dashboard guardian interface
2018-02-19 11:12:56 +01:00
Carl Bergquist
243b987758
Merge pull request #10910 from bergquist/provisioning_disable_deleting_dashboards
provisioning: adds setting to disable dashboard deletes
2018-02-15 08:28:10 +01:00
bergquist
ad42883fc7 provisioning: adds setting to disable dashboard deletes 2018-02-14 17:30:08 +01:00
Leonard Gram
fa1b92a12b
provisioning: uses unix epoch timestamps. (#10907)
* provisioning: uses unix epoch timestamps.
2018-02-14 15:28:30 +01:00
bergquist
dba087463a provisioing: always skip sample.yaml files 2018-02-14 11:33:58 +01:00
bergquist
165304a342 provisioning: handle nil configs 2018-02-14 11:22:24 +01:00
bergquist
84de76ff0a provisioning: code formating 2018-02-14 10:30:08 +01:00
bergquist
44baaeed8f provisioning: adds logs about deprecated config format 2018-02-14 10:30:08 +01:00
bergquist
b010e4df93 provisioning: support camelcase for dashboards configs 2018-02-14 10:30:08 +01:00
bergquist
4a35244cb9 provisioning: support camcelCase provisioning files 2018-02-14 10:30:08 +01:00
Leonard Gram
ba0285a3ec
provisioning: Warns the user when uid or title is re-used. (#10892)
* provisioning: Warns the user when uid or title is re-used.

Closes #10880
2018-02-13 15:47:02 +01:00
bergquist
f01890c3ff provisioning: better variable naming 2018-02-12 08:22:34 +01:00
bergquist
84fea7c148 provisioning: dont return error unless you want to cancel all operations 2018-02-09 15:43:58 +01:00
bergquist
5a76624003 provisioning: createWalkFn doesnt have to be attached to the filereader anymore 2018-02-09 15:33:54 +01:00
bergquist
59cd2d5102 provisioning: avoid caching and use updated field from db 2018-02-09 15:23:38 +01:00
bergquist
31f3fdcba3 provisioning: delete dashboards before insert/update 2018-02-09 12:17:58 +01:00
Leonard Gram
b549d29319 Merge branch 'master' into provisioning 2018-02-08 11:01:09 +01:00
bergquist
76dc7932a4 docs: describe uid for dashboard provisioning 2018-02-07 11:04:48 +01:00
bergquist
d62d5c7418 provisioning: delete dashboards from db when file is missing 2018-01-25 15:25:07 +01:00
Leonard Gram
1c034b7a73 fixes minor typo 2018-01-25 09:30:37 +01:00
bergquist
c3a768b3ed provsioning: dont stop grafana due to missing 2018-01-25 09:30:37 +01:00
bergquist
57e7048b8f provisioning: enables title changes for dashboards 2018-01-24 19:16:57 +01:00
bergquist
77a4ccb822 dashboards: save provisioning meta data 2018-01-23 21:54:30 +01:00
bergquist
67a9e6a71d provisioing: add lookup table provisioned dashboards 2018-01-23 21:52:55 +01:00
bergquist
7858965117 codestyle: extract code into methods 2018-01-18 12:04:12 +01:00
Carl Bergquist
d6667c4fa0
Merge pull request #10548 from StevenTobin/follow_symlinks
Make file_reader follow symlinks
2018-01-18 11:29:34 +01:00
stobin
f1813ae3a3 Make file_reader follow symlinks 2018-01-17 14:51:17 +00:00
bergquist
34d7f8a44f dashboards as cfg: property path replaces folder 2018-01-17 15:48:24 +01:00
Leonard Gram
183507964c Clearer naming for dashboard provisioning config.
Renames folder (in options) to path to make it
different from the grafana folder wherein the
dashboard will be created.
2018-01-16 17:40:14 +01:00
bergquist
1a6c2ea8d8 dashboards as cfg: logs error when trying to import dashboard with id
dashboard json cannot contain fixed id when importing from
disk. We used to override this but it didnt caught all problems
so now we block dashboards from beeing imported instead.

closes #10504
2018-01-15 12:26:43 +01:00
bergquist
f5e00e133b dashboards as cfg: moves dashcash into its own file 2017-12-28 13:37:02 +01:00
bergquist
237d469ed4 dashboards as cfg: create dashboard folders if missing
closes #10259
2017-12-28 13:33:11 +01:00
bergquist
f4078e1935 tests: for skipping with hidden folders 2017-12-27 15:04:49 +01:00
Torkel Ödegaard
c395237710 Merge branch Grafana v5 'develop' branch 2017-12-15 12:06:09 +01:00
Simon Aquino
5dbbf1826c Avoid ID validation before provisioning dashboards
Attempting to provision grafana using a previously exported
JSON dashboard with the ID field already set, might result in an error.
In fact, Grafana might believe that a dashboard with that
given ID already exists in the database, throwing an error if it doesn't.
(see pkg/services/sqlstore/dashboard.go#L32)

The dashboard provisioner should set the dashboard id to zero in order to
avoid this behaviour inducing the dashboard to be written to the DB
without ID validation.
2017-12-14 02:07:50 +01:00
bergquist
dd3dd407ad removes unused property 2017-12-13 13:12:50 +01:00
Torkel Ödegaard
2465fcbd6b fix: FolderId and IsFolder when saving dashboard 2017-12-13 10:00:54 +01:00
bergquist
0c5ef1453d fixes broken test 2017-12-08 11:33:15 +01:00
bergquist
5f5cdad97a improve error handling for datasources as cfg 2017-12-08 10:50:11 +01:00
bergquist
2e610cb256 dashboards as cfg: move dash/ds config files to /provisioning/* 2017-12-07 15:27:01 +01:00
bergquist
1dfa529941 dashboards as cfg: avoid walking fs in parallel 2017-12-07 15:27:01 +01:00
bergquist
b28ea0b407 dashboards as cfg: type 2017-12-07 15:27:01 +01:00
bergquist
099178466d dashboards as cfg: wire up dashboard repo 2017-12-07 15:27:01 +01:00
bergquist
288cc35529 dashboards as cfg: use gocache for caching 2017-12-07 15:27:01 +01:00
bergquist
f5eac2e91d dashboards as cfg: expose dashboard service as interface 2017-12-07 15:27:01 +01:00
bergquist
16f072b320 dashboards as cfg: move saving logic for dashboards into its own service 2017-12-07 15:27:01 +01:00
bergquist
9cebb23e01 dashboards as cfg: revert minor changes 2017-12-07 15:27:01 +01:00
bergquist
74e12c260f dashboards as cfg: move dashboard saving into its own service 2017-12-07 15:27:01 +01:00
bergquist
09cb0f378b dashboards as cfg: minor tweaks 2017-12-07 15:27:01 +01:00
bergquist
93e1d8a19c dashboards as cfg: make dashboard none editable by default 2017-12-07 15:27:01 +01:00