Modify ↓
Ticket #242 (closed defect: fixed)
Cfg: only last probe gets used
Reported by: | [email protected]… | Owned by: | desai |
---|---|---|---|
Priority: | blocker | Milestone: | Bcfg2 0.8.5 Release |
Component: | bcfg2-server | Version: | |
Keywords: | cfg,probes | Cc: |
Description
Currently only the last executed probe will be saved and available for host interpolation.
Possible fix:
Index: Cfg.py =================================================================== --- Cfg.py (Revision 2451) +++ Cfg.py (Arbeitskopie) @@ -215,7 +215,8 @@ if self.interpolate: if metadata.hostname in probeData: for name, value in probeData[metadata.hostname].iteritems(): - filedata = filedata.replace("@@%[email protected]@"%name, value ) + if value != None: + filedata = filedata.replace("@@%[email protected]@" % name, value ) else: logger.warning("Cannot interpolate data for client: %s for config file: %s"% (metadata.hostname, basefile.name)) if self.paranoid: @@ -277,7 +278,10 @@ def ReceiveData(self, client, data): '''Receive probe results pertaining to client''' - probeData[client.hostname] = { data.get('name'):data.text } + try: + probeData[client.hostname].update({ data.get('name'):data.text }) + except KeyError: + probeData[client.hostname] = { data.get('name'):data.text } def AddDirectoryMonitor(self, name): '''Add new directory to FAM structures'''
Attachments
Change History
comment:1 Changed 16 years ago by anonymous
- Keywords cfg,probes added; probes removed
- Component changed from bcfg2-client to bcfg2-server
comment:2 Changed 16 years ago by bradshaw
I don't truely understand the issue, probes are named by the filename of the script, so there is no way to have 2 probes with the same name fighting to change the value.
comment:3 Changed 16 years ago by anonymous
Current behaviour:
>>> probeData = {} >>> probeData['host1'] = { 'probe1' : 'result1' } >>> probeData {'host1': {'probe1': 'result1'}} >>> probeData['host1'] = { 'probe2' : 'result2' } >>> probeData {'host1': {'probe2': 'result2'}}
Expected behvaiour (at least for me):
>>> probeData = {} >>> probeData['host1'] = { 'probe1' : 'result1' } >>> probeData {'host1': {'probe1': 'result1'}} >>> probeData['host1'].update( { 'probe2' : 'result2' } ) >>> probeData {'host1': {'probe1': 'result1', 'probe2': 'result2'}}
Note: See
TracTickets for help on using
tickets.