@@ -49,6 +49,7 @@ type Config struct {
49
49
TemporaryDirectory string
50
50
GlobalWorkDirectory string
51
51
NodeList []string
52
+ ExcludePathPatterns []string
52
53
53
54
// Invocation dependent params
54
55
@@ -164,7 +165,7 @@ func (s *Syncer) prepareDatabase(ctx context.Context) error {
164
165
}
165
166
166
167
func (s * Syncer ) applyPolicy () (* filelist.CloseParser , error ) {
167
- options := []options.PolicyOptioner {
168
+ policyOpts := []options.PolicyOptioner {
168
169
scaleadpt .PolicyOpt .SnapshotName (s .Config .SnapshotName ),
169
170
scaleadpt .PolicyOpt .Subpath (s .Config .Subpath ),
170
171
scaleadpt .PolicyOpt .TempDir (s .Config .TemporaryDirectory ),
@@ -180,16 +181,24 @@ func (s *Syncer) applyPolicy() (*filelist.CloseParser, error) {
180
181
fields ["global_work_directory" ] = s .Config .GlobalWorkDirectory
181
182
fields ["node_list" ] = s .Config .NodeList
182
183
183
- options = append (
184
- options ,
184
+ policyOpts = append (
185
+ policyOpts ,
185
186
scaleadpt .PolicyOpt .GlobalWorkDirectory (s .Config .GlobalWorkDirectory ),
186
187
scaleadpt .PolicyOpt .NodeList (s .Config .NodeList ),
187
188
)
188
189
}
189
190
191
+ opts := []options.FilelistPolicyOptioner {
192
+ filelist .Opt .PolicyOpts (policyOpts ... ),
193
+ }
194
+
195
+ if len (s .Config .ExcludePathPatterns ) > 0 {
196
+ opts = append (opts , filelist .Opt .ExcludePathPatterns (s .Config .ExcludePathPatterns ))
197
+ }
198
+
190
199
s .fieldLogger .WithFields (fields ).Info ("Starting applying list policy" )
191
200
192
- parser , err := filelist .ApplyPolicy (s .Config .FileSystem , options ... )
201
+ parser , err := filelist .ApplyPolicy (s .Config .FileSystem , opts ... )
193
202
if err != nil {
194
203
return nil , errors .Wrap (err , "(*Syncer).applyPolicy: apply policy on file system" )
195
204
}
0 commit comments