Commit Graph

44 Commits

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