|
|
|
|
53
|
// corresponding dashboards from Grafana. It then sleeps for the time specified
|
53
|
// corresponding dashboards from Grafana. It then sleeps for the time specified
|
54
|
// in the configuration file, before starting its next iteration.
|
54
|
// in the configuration file, before starting its next iteration.
|
55
|
// Returns an error if there was an issue checking the Git repository status,
|
55
|
// Returns an error if there was an issue checking the Git repository status,
|
56
|
-// synchronising it, reading the files' contents or discussing with the Grafana
|
|
|
57
|
-// API
|
|
|
|
|
56
|
+// synchronising it, reading the files' contents, filtering out ignored files,
|
|
|
57
|
+// or discussing with the Grafana API.
|
58
|
func poller(
|
58
|
func poller(
|
59
|
cfg *config.Config, repo *git.Repository, client *grafana.Client,
|
59
|
cfg *config.Config, repo *git.Repository, client *grafana.Client,
|
60
|
delRemoved bool,
|
60
|
delRemoved bool,
|
|
|
|
|
118
|
// Get a map containing the latest known content of each added,
|
118
|
// Get a map containing the latest known content of each added,
|
119
|
// modified and removed file.
|
119
|
// modified and removed file.
|
120
|
mergedContents := mergeContents(modified, removed, filesContents, previousFilesContents)
|
120
|
mergedContents := mergeContents(modified, removed, filesContents, previousFilesContents)
|
|
|
121
|
+
|
|
|
122
|
+ // Filter out all files that are supposed to be ignored by the
|
|
|
123
|
+ // dashboard manager.
|
|
|
124
|
+ if err = common.FilterIgnored(&mergedContents, cfg); err != nil {
|
|
|
125
|
+ return
|
|
|
126
|
+ }
|
|
|
127
|
+
|
121
|
// Push the contents of the files that were added or modified to the
|
128
|
// Push the contents of the files that were added or modified to the
|
122
|
// Grafana API.
|
129
|
// Grafana API.
|
123
|
common.PushFiles(modified, mergedContents, client)
|
130
|
common.PushFiles(modified, mergedContents, client)
|