On modifie un peu le plugin de dim pour handle les bonnes choses, on ajoute un tool python, et on met mac_prises dans le dépot.

Ignore-this: a97c9dd382aae257e5d64b3fc14d0469

darcs-hash:20121211191448-b6762-f8705ea02bdfe778cd81d98ee52f2fa2533d68e0.gz
This commit is contained in:
Pierre-Elliott Bécue 2012-12-11 20:14:48 +01:00
parent fbc7f2c0f4
commit dfcda07054
6 changed files with 852 additions and 7 deletions

View file

@ -105,7 +105,7 @@ class Python(Bcfg2.Server.Plugin.Plugin,Bcfg2.Server.Plugin.Generator):
def __init__(self, core, datastore):
Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore)
# Les entrées pour bcfg2
self.Entries['ConfigFile'] = {}
self.Entries['Python'] = {}
# Correspondance entrée ConfigFile -> code
self.codes = {}
# Dico ID de requête GAM -> Dossier surveillé
@ -165,6 +165,7 @@ class Python(Bcfg2.Server.Plugin.Plugin,Bcfg2.Server.Plugin.Generator):
if event.filename[0] == '/' \
or event.filename.endswith(".COMPILED") \
or event.filename.endswith("~") \
or event.filename.endswith(".swp") \
or event.filename.startswith(".#"):
return
@ -195,13 +196,14 @@ class Python(Bcfg2.Server.Plugin.Plugin,Bcfg2.Server.Plugin.Generator):
if action in ['exists', 'created']:
debug("adding config file: %s" % identifier, 'green')
self.codes[identifier] = load_file(path, logger)
self.Entries['ConfigFile'][identifier] = self.BuildEntry
print "Python plugin : creating %s entry due to action %s" % (identifier, action)
self.Entries['Python'][identifier] = self.BuildEntry
elif action == 'changed':
self.codes[identifier] = load_file(path, logger)
elif action == 'deleted':
debug("deleting config file: %s" % identifier, 'red')
del self.codes[identifier]
del self.Entries['ConfigFile'][identifier]
del self.Entries['Python'][identifier]
elif posixpath.isdir(path):
if action in ['exists', 'created']:
@ -209,7 +211,7 @@ class Python(Bcfg2.Server.Plugin.Plugin,Bcfg2.Server.Plugin.Generator):
else:
logger.info('Ignoring file %s' % path)
def AddDirectoryMonitor(self, path):
'''Surveille un dossier avec FAM'''
if path not in self.handles.values():