File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -173,14 +173,14 @@ func (cw *CertWatcher) ReadCertificate() error {
173
173
174
174
func (cw * CertWatcher ) handleEvent (event fsnotify.Event ) {
175
175
// Only care about events which may modify the contents of the file.
176
- if ! (isWrite (event ) || isRemove (event ) || isCreate (event )) {
176
+ if ! (isWrite (event ) || isRemove (event ) || isCreate (event ) || isRename ( event ) ) {
177
177
return
178
178
}
179
179
180
180
log .V (1 ).Info ("certificate event" , "event" , event )
181
181
182
182
// If the file was removed, re-add the watch.
183
- if isRemove (event ) {
183
+ if isRemove (event ) || isRename ( event ) {
184
184
if err := cw .watcher .Add (event .Name ); err != nil {
185
185
log .Error (err , "error re-watching file" )
186
186
}
@@ -202,3 +202,7 @@ func isCreate(event fsnotify.Event) bool {
202
202
func isRemove (event fsnotify.Event ) bool {
203
203
return event .Op .Has (fsnotify .Remove )
204
204
}
205
+
206
+ func isRename (event fsnotify.Event ) bool {
207
+ return event .Op .Has (fsnotify .Rename )
208
+ }
You can’t perform that action at this time.
0 commit comments