瀏覽代碼

Filter out ignored files

Brendan Abolivier 6 年之前
父節點
當前提交
f3a5030df0
簽署人: Brendan Abolivier <contact@brendanabolivier.com> GPG 金鑰 ID: 8EF1500759F70623
共有 1 個檔案被更改,包括 9 行新增2 行删除
  1. 9
    2
      src/pusher/poller/poller.go

+ 9
- 2
src/pusher/poller/poller.go 查看文件

@@ -53,8 +53,8 @@ func Setup(cfg *config.Config, client *grafana.Client, delRemoved bool) error {
53 53
 // corresponding dashboards from Grafana. It then sleeps for the time specified
54 54
 // in the configuration file, before starting its next iteration.
55 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 58
 func poller(
59 59
 	cfg *config.Config, repo *git.Repository, client *grafana.Client,
60 60
 	delRemoved bool,
@@ -118,6 +118,13 @@ func poller(
118 118
 			// Get a map containing the latest known content of each added,
119 119
 			// modified and removed file.
120 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 128
 			// Push the contents of the files that were added or modified to the
122 129
 			// Grafana API.
123 130
 			common.PushFiles(modified, mergedContents, client)