[wpkg-users] Setting a variable in a profile doesnt over-rides that set in a package
Rainer Meier
r.meier at wpkg.org
Fri Jan 27 00:07:53 CET 2012
Hi Ronny,
On 26.01.2012 23:39, Ronny wrote:
> So for all wpkg-versions >= 1.3.0 what about this example:
>
> <profile id="general">
> <variable name='MyVariable' value='general' />
> <package package-id="abc" />
> {...}
> <package package-id="xyz" />
> </profile>
>
> <profile id="special">
> <variable name='MyVariable' value='special' />
> <depends profile-id="general" />
> </profile>
>
> If i assign the host generalPC to the profile 'general' the value for
> 'MyVariable' should always be 'general', but what is the value for the host
> specialPC which is only assigned to the profile 'special', what would be the
> value of 'MyVariable' for this host?
This is exactly the case I recommended to avoid. But to answer your question.
WPKG 1.3.0 and 1.3.0 will both evaluate MyVariable as follows:
generalPC: general
specialPC: special
I've quickly tested this with WPKG 1.3.1-RC2. The reason is that WPKG
specifically applies profile variables exactly in this order.
If you want to be 100% sure then define the profile 'general' in a way which
prevents it overwriting MyVariable, no matter in which order it is applied:
<profile id="general">
<variable name='MyVariable' value='general'>
<condition>
<check type="host" condition="environment" value="MyVariable=^$" />
</condition>
</variable>
<package package-id="abc" />
{...}
<package package-id="xyz" />
</profile>
<profile id="special">
<variable name='MyVariable' value='special' />
<depends profile-id="general" />
</profile>
This will make absolutely sure that MyVariable is not set to 'general' if it is
already defined before.
br,
Rainer
More information about the wpkg-users
mailing list