[wpkg-users] Setting a variable in a profile doesnt over-rides that set in a package

Ronny ladiko at web.de
Thu Jan 26 23:39:28 CET 2012



Am 26.01.2012 23:30, schrieb Rainer Meier:
> Hi Ronny,
>
>> I took a look at the named topic. So the current order for variables 
>> in 1.3.0
>> is: Host, Profile, Package
>
> Host variables overriding profile variables overriding package variables.
>
>
>> I guess every package and host has to be assigned to a profile. 
>> Variables are
>> mostly *used* in packages, but if the package itself define a "general"
>> variable, it doesnt matter if i want to exclude some hosts by using a 
>> different
>> variable there. So for 1.3.0 the solution would be to only define the 
>> variable
>> in profiles.
>
> Of course a variable which is named differently is not overridden, 
> nowhere.
>
>
>> So i need to have a general profile which defines a standard value 
>> and for the
>> "special" hosts, i need to define a second profile *after* the 
>> general profile,
>> which depends on the general profile, but defines another value for this
>> variable. But whenever i assign a value in a package, there is no way to
>> override it? In my mind this is not the way it should work. If it 
>> works like
>> that, i would never be able to define a variable variable inside a 
>> package,
>> strange thing...
>
> Either I do not understand it the way you write it or you got the 
> latest change (fix in 1.3.1-RC2) wrong. Now any variable in profile or 
> host named the same as in a package will override the one defined in 
> the package.
> If you define the same variable twice on the same level (e.g. multiple 
> times "VAR" in different profiles all assigned to the same host), then 
> they are applied in order of profile inclusion. I strongly recommend 
> not to do such setups.
>
> As you can read in the last entry of bug 262 the current 
> implementation also allows conditional variables in order to define 
> variables ONLY in case it has not been defined yet - effectively 
> allowing you to prevent overriding a variable.
>
> The issue described in report 262 is exactly that it would be better 
> if a variable on host level overrides one defined in the package. 
> Effectively allowing to specify different values for individual hosts. 
> With WPKG 1.3.0 implementation this is not possible unless the package 
> uses a conditional variable which prevents the package to re-define 
> the variable if it is already set.
>
>
>> So i will stay with 1.3.0 for the moment and will define the changing 
>> variable
>> in the profiles only...
>
> As written in report 262 this will not work. First of all the package 
> variable in 1.3.0 has highest priority. So defining VAR=profile in the 
> profile and VAR=package in the package will make WPKG use the value 
> "package" in package commands.
>
> For 1.3.1-RC2 the same example would use "profile" as the value in 
> commands.
>
> br,
> Rainer
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?

Regards Ronny



More information about the wpkg-users mailing list