Commit Graph

157 Commits

Author SHA1 Message Date
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