Explorar el Código

Filter out ignored files

Brendan Abolivier hace 6 años
padre
commit
f3a5030df0
Firmado por: Brendan Abolivier <contact@brendanabolivier.com> ID clave GPG: 8EF1500759F70623
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9
    2
      src/pusher/poller/poller.go

+ 9
- 2
src/pusher/poller/poller.go Ver fichero

@@ -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)