From 6fffddf1cc3e73bf831fb3bbe36c928d1ebb8c77 Mon Sep 17 00:00:00 2001 From: Michael Fenn Date: Fri, 24 May 2013 12:11:55 -0400 Subject: Cfg: Handle bogus created events as changed It is possible for the FAM (gamin in particular) to send a created event for a file that already exists if the file is updated in a particular way. I suppose that the event is technically correct since a new inode really was created, but the file is only changed from bcfg2's point of view. For instance, the "atomic" copy-to-temp-then-move-over-top method that rsync uses will expose this behavior. Example: rsync -a --temp-dir=/var/tmp --delete-after \ --exclude Packages/cache --exclude Packages/keys \ --exclude Reporting/DirectStore --exclude probed.xml \ /var/lib/bcfg2/ $OTHERSERVER:/var/lib/bcfg2 --- src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py index ffe93c25b..c6ac9d8dc 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py @@ -520,7 +520,9 @@ class CfgEntrySet(Bcfg2.Server.Plugin.EntrySet, return elif hdlr.ignore(event, basename=self.path): return - elif action == 'changed': + # we only get here if event.filename in self.entries, so handle + # created event like changed + elif action == 'changed' or action == 'created': self.entries[event.filename].handle_event(event) return elif action == 'deleted': -- cgit v1.2.3-1-g7c22