Modify

Ticket #241 (closed defect: fixed)

Opened 16 years ago

Last modified 16 years ago

Cfg: probes will fail to execute

Reported by: [email protected] Owned by: desai
Priority: blocker Milestone: Bcfg2 0.8.5 Release
Component: bcfg2-server Version:
Keywords: cfg, probes Cc:

Description

bcfg2 with Gamin.

When using Cfg with probes, I created a directory repo/Probes/ where I put all my probe files.

Gamin adds the directory repo/Probes to the probes to be executed on the client.

The bcfg2 client will fail with the followjng message:

GetProbes completed successfully
Failed to execute probe: /home/gogo/subversion/svn-mj/trunk/bcfg2-repository/Probes
Traceback (most recent call last):
  File "/usr/sbin/bcfg2", line 95, in run_probe
    script.write(probe.text)
TypeError: argument 1 must be string or read-only character buffer, not None
Failed to Execute probes

Also if another directory under repo/Probes/ gets created, the error will appear since probe.text is None.

Attachments

Change History

comment:1 Changed 16 years ago by [email protected]

I suggest the following workaround:

Index: bcfg2
===================================================================
--- bcfg2       (Revision 2451)
+++ bcfg2       (Arbeitskopie)
@@ -92,7 +92,8 @@
             try:
                 script.write("#!%s\n" %
                              (probe.attrib.get('interpreter', '/bin/sh')))
-                script.write(probe.text)
+                if probe.text != None:
+                    script.write(probe.text)
                 script.close()
                 os.chmod(script.name, 0755)
                 ret.text = os.popen(script.name).read().strip()

A better solution would be to only add files as probes under repo/Probes.

comment:2 Changed 16 years ago by bradshaw

  • Status changed from new to closed
  • Resolution set to fixed

So I decided to fix this on the server side instead of the client. I added code so if the probe file is empty it is not included in the config being sent to the client. This fixes the problem and also some of the fallout where we could have probedata that is empty. look at rev 2453

WARNING! You need to establish a session before you can create or edit tickets. Otherwise the ticket will get treated as spam.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.