txlb.config.AdminConfig class treats webRefresh attribute as of type other than float

Bug #299675 reported by Shaival Varma
2
Affects Status Importance Assigned to Milestone
txLoadBalancer
Fix Committed
Medium
Duncan McGreggor

Bug Description

This report is for txLoadBalancer-1.1.0

txlb.config.AdminConfig.__init__ sets webRefresh to 30 (type int) on line 390, and txlb.config.AdminConfig.loadWeb loads it as a bool on line 421.

The inconsistency causes problems. For example, txlb.manager.checkConfigChanges writes the attribute out to disk as a number, but loads it back as a bool. As a result, the boolean condition on line 76 always evaluates to true and a new file is written to disk even though the configuration has not been changed.

The webRefresh attribute should be numeric. In addition to fixing the bug, this will bring the implementation in line with the documentation in txLoadBalancer-1.1.0\doc\xmlreference.txt. I have chosen to make it a float that the refresh interval can be set to fractions of seconds.

The fix appears to be to modify txlb.config.AdminConfig.__init__ at line 390:
        self.webRefresh = 30
to:
        self.webRefresh = 30.0

and txlb.config.AdminConfig.loadWeb at line 421:
            self.webRefresh = util.boolify(webNode.getAttribute('refresh'))
to:
            self.webRefresh = float(webNode.getAttribute('refresh'))

Revision history for this message
Shaival Varma (svarma-shff) wrote :
Changed in txloadbalancer:
assignee: nobody → oubiwann
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Duncan McGreggor (oubiwann) wrote :

Shaival, thanks for the report and the fix!

This has been committed to trunk in revision 220.

Changed in txloadbalancer:
status: In Progress → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.