bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HostRange bug


From: Jim Wight
Subject: HostRange bug
Date: Mon, 06 Sep 2004 10:13:51 +0100

There appears to be a bug in the handling of HostRange in 2.1.10 and
earlier which may mean - it is certainly true in some circumstances -
that it is not possible to use HostRange more than once.

Given the following in cfagent.conf:

classes:
   foo = ( HostRange(foo, 01-40) )
   bar = ( HostRange(mill, 01-40) )

bar does not get set when cfagent is run on mill01 - mill40.

The arrowed lines in the following section from -d2 debugging:

HandleFunctionObject(HostRange(foo, 01-40))
IsBuiltinFunction(HostRange(foo, 01-40))
IsBuiltinFunction: HostRange(foo, 01-40)
ExpandVarstring(foo, 01-40)
HandleFunction: HostRange(foo, 01-40)
FunctionStringToCode(HostRange)
SRDEBUG in HandleHostRange()
SRDEBUG args=foo, 01-40 value=
SRDEBUG in FuzzyHostParse(): foo, 01-40
SplitStringAsItemList(foo, 01-40,,)
Appending [foo]
Appending [ 01-40]
SRDEBUG start=1 end=40 num_matched=2
SRDEBUG syntax is okay
SRDEBUG in FuzzyHostMatch(): mill04 vs foo, 01-40    <========
SplitStringAsItemList(foo, 01-40,,)
Appending [foo]
Appending [ 01-40]
SRDEBUG extracted string 04
SRDEBUG extracted int 4
SRDEBUG FuzzyHostMatch() mill04 is in (1..40)
SRDEBUG extracted basename mill
SRDEBUG basename check: mill vs foo...
SRDEBUG FuzzyHostMatch() failed: basename mill does not match foo
SRDEBUG FAILURE
ExpandVarstring(XX_CF_opposite_any_XX)
[No match of class XX_CF_opposite_any_XX]

HandleFunctionObject(HostRange(mill, 01-40))
IsBuiltinFunction(HostRange(mill, 01-40))
IsBuiltinFunction: HostRange(mill, 01-40)
ExpandVarstring(mill, 01-40)
HandleFunction: HostRange(mill, 01-40)
FunctionStringToCode(HostRange)
SRDEBUG in HandleHostRange()
SRDEBUG args=mill, 01-40 value=
SRDEBUG in FuzzyHostParse(): mill, 01-40
SplitStringAsItemList(mill, 01-40,,)
Appending [mill]
Appending [ 01-40]
SRDEBUG start=1 end=40 num_matched=2
SRDEBUG syntax is okay
SRDEBUG in FuzzyHostMatch(): mill vs mill, 01-40      <========
SplitStringAsItemList(mill, 01-40,,)
Appending [mill]
Appending [ 01-40]
SRDEBUG FuzzyHostMatch() failed: did not extract int from the end of mill
SRDEBUG FAILURE
ExpandVarstring(XX_CF_opposite_any_XX)
[No match of class XX_CF_opposite_any_XX]

show that VDEFAULTBINSERVER.name is getting corrupted between calls to
HandleHostRange (in functions.c).

The arrowed line in the second case is correct if run on millxx where xx
falls outside the range 1-40, i.e. it reads:

SRDEBUG in FuzzyHostMatch(): millxx vs mill, 01-40

And if 'bar = ' is the only HostRange line, bar gets set for mill01 -
mill40.

Jim








reply via email to

[Prev in Thread] Current Thread [Next in Thread]