[wpkg-users] Host match disruptive changes in 1.2?

Rainer Meier r.meier at wpkg.org
Tue Jul 19 13:33:26 CEST 2011


Hi Marco,

On 19.07.2011 12:37, Marco Gaiarin wrote:
>
> Really i've not understood the new ''host matching'' schema, or i'm
> missing something, but something big.
>
> I've switched to wpkg.js 1.2, and at the fist run on a test machine:
>
>   2011-07-19 11:54:26, DEBUG   : Initialized temporary local log file: C:\WINDOWS\TEMP\wpkg-logInit.log
>   2011-07-19 11:54:26, DEBUG   : Initializing new log file: C:\WINDOWS\TEMP\wpkg-voldemort.log
>   2011-07-19 11:54:26, DEBUG   : Reboot-Cmd is standard.
>   2011-07-19 11:54:26, DEBUG   : WPKG 1.2 starting...
>   2011-07-19 11:54:26, DEBUG   : Base directory is '\\FILE\wpkg'.
>   2011-07-19 11:54:26, DEBUG   : Log level is 255
>   2011-07-19 11:54:26, DEBUG   : Trying to read XML file: \\FILE\wpkg\profiles.xml
>   2011-07-19 11:54:26, DEBUG   : Successfully loaded XML file: \\FILE\wpkg\profiles.xml
>   2011-07-19 11:54:26, DEBUG   : Trying to read XML files from directory: \\FILE\wpkg\profiles
>   [...]
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/profiles/ced.xml
>   [...]
>   2011-07-19 11:54:27, DEBUG   : Trying to read XML file: \\FILE\wpkg\hosts.xml
>   2011-07-19 11:54:27, DEBUG   : Successfully loaded XML file: \\FILE\wpkg\hosts.xml
>   2011-07-19 11:54:27, DEBUG   : Trying to read XML files from directory: \\FILE\wpkg\hosts
>   [...]
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/hosts/ced.xml
>   [...]
>   2011-07-19 11:54:27, DEBUG   : Trying to read XML file: \\FILE\wpkg\packages.xml
>   2011-07-19 11:54:27, DEBUG   : Successfully loaded XML file: \\FILE\wpkg\packages.xml
>   2011-07-19 11:54:27, DEBUG   : Trying to read XML files from directory: \\FILE\wpkg\packages
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/packages/kb979682.xml
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/packages/qmc.xml
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/packages/7zip.xml
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/packages/quicktime.xml
>   2011-07-19 11:54:27, DEBUG   : Reading XML file: //FILE/wpkg/packages/reader.xml
>   [...]
>   2011-07-19 11:54:34, DEBUG   : Found network service: {6703392F-0C4E-44B4-AE97-24BAB72D9374}
>   2011-07-19 11:54:34, DEBUG   : Reading DHCP address.
>   2011-07-19 11:54:34, DEBUG   : Found DHCP address: 10.5.2.240
>   2011-07-19 11:54:34, DEBUG   : Host operating system: microsoft windows xp professional, , sp3, 5.1.2600
>   2011-07-19 11:54:34, DEBUG   : Domain Name: sanvito
>   2011-07-19 11:54:35, DEBUG   : Found computer group: Domain Computers
>   2011-07-19 11:54:35, DEBUG   : Found system locale: 410
>   2011-07-19 11:54:35, DEBUG   : Host properties: hostname='voldemort'|architecture='x86'|os='microsoft windows xp professional, , sp3, 5.1.2600'|ipaddresses='10.5.2.240'|domain name='sanvito'|groups='Domain Computers'|lcid='410'
>   2011-07-19 11:54:35, DEBUG   : Single-match mode. Host match finished.
>   2011-07-19 11:54:35, DEBUG   : Profiles applying to the current host:|default|
>   2011-07-19 11:54:35, DEBUG   : Reading settings file: C:\WINDOWS\system32\wpkg.xml
>   2011-07-19 11:54:35, DEBUG   : Trying to read XML file: C:\WINDOWS\system32\wpkg.xml
>   2011-07-19 11:54:35, DEBUG   : Successfully loaded XML file: C:\WINDOWS\system32\wpkg.xml
>   2011-07-19 11:54:35, DEBUG   : Saving current environment
>   2011-07-19 11:54:35, DEBUG   : Getting profiles which apply to this node.
>   2011-07-19 11:54:35, DEBUG   : Applying profile: default
>   2011-07-19 11:54:35, DEBUG   : Adding profile dependencies of profile 'default': 'base'
>   2011-07-19 11:54:35, DEBUG   : Adding package with ID 'xptweaks-disable-csc' to profile packages.
>   [...]
>
> computer voldemort (really, a virtual machine, on my linux box lily; yes,
> harry was my previous one ;) was on profile 'ced', but wpkg.js now
> match profile 'defult'.

This seems to be quite strange to me. As the way to read hosts from host.xml or 
hosts/*.xml was not altered. If you did not use multiple match mode previously 
then also WPKG 1.1.3-RCx should have matched the "default" profile only.


> \\FILE\wpkg\hosts.xml contains:
>
> 	<host name=".+" profile-id="default" />
>
> while //FILE/wpkg/hosts/ced.xml contains:
>
> 	<wpkg>
> 	<host name="voldemort" profile-id="ced" />
> 	<host name="neobe" profile-id="ced" />
> 	</wpkg>
>
> What happens?!

If no applyMultiple option is used WPKG will just match the host entries 
one-by-one and then stop if one which matches is found. This is unrelated to the 
new extended host matching capabilities in WPKG 1.2 as you seem to use only the 
"name" attribute which was left untouched exactly for backwards compatibility 
reason.

Could you run WPKG 1.1.x on the same host to prove what happens? With the 
information you provide it seems to be logical and intentional for me that the 
"default" profile is applied to the host since your name="." would match all the 
hosts. If you don't intend to match them all then make sure hosts.xml does not 
contain such a "catch all" host entry which will match any host name. Either 
sort the host entries in your hosts.xml or make sure you literally sort your 
hosts/*.xml files and only the last one contains such a "catch all" entry.


 > I've seen 'applyMultiple' option, but:
>
> 1) why break ''retrocompatibility''?!

If it does, then this was not intentional. WPKG 1.2 is supposed to deliver the 
same host matching capabilities as WPKG 1.1.2. If it does not I ask you to 
provide a full log run with WPKG 1.1.2 and one with WPKG 1.2 to see the 
difference in host matching.

Note: Unless you use the applyMultiple switch or config.xml flag WPKG will only 
apply the first profile which matches (which is "default" in your case). If you 
would like that "default" and in addition you get also "ced" assigned, then you 
can do this in two ways:

- Enable applyMultiple option so WPKG continues to include all profiles which
   match.
- Create a dependency from "ced" to "default" and make sure to remove the direct
   match of the "default" profile.


> 2) how can i assign a single profile (applyMultiple=false) while having
>   a ''default'' assigned profile?

There is no such thing like a default-profile which is always applied. WPKG will 
simply either apply the first matching profile or all profiles which match.

If you would like to refer to a "default" profile which is included in the 
package tree for this host on each execution you can define dependencies between 
profiles.

For example:
<profiles>
   <profile id="ced">
     <depends profile-id="default" />
     <package package-id="xy" />
     ...
   </profile>
</profiles>

Then make sure to remove the ".*" matching from your hosts.xml so the host will 
match only to your more-specific definition in ced.xml. The profile "ced" will 
also inherit automatically all packages defined in the "default" profile.


So either let WPKG match multiple profiles or make sure the profile which first 
matches the host includes all packages assigned to the host.

The "applyMultiple" switch has been introduced exactly for the purpose of 
keeping backwards compatibility as WPKG was traditionally only matching one 
profile. So typically the profiles would have to be specified in a defined order 
descending from most specific to most generic:

<wpkg>
   <host name="lab-host1" profile-id="concrete-host1-profile" />
   <host name="lab-host2" profile-id="concrete-host2-profile" />
   <host name="lab-.*" profile-id="profile-for-all-remaining-lab-hosts" />
   <host name=".*" profile-id="all-host-not-matched-before" />
</wpkg>

So in traditional matching a host named "lab-host2" would get the 
"concrete-host2-profile" assigned. And yes, only this profile.

A host named "lab-hostX" would get the profile 
"profile-for-all-remaining-lab-hosts" assigned. And yes, only this profile.

A host named "foobar" would get the "all-host-not-matched-before" profile assigned.

If "applyMultiple" is enabled then:
A host named "lab-host2" would get "concrete-host2-profile" AND 
"profile-for-all-remaining-lab-hosts" AND "all-host-not-matched-before" assigned.

A host named "lab-hostX" would get the profile 
"profile-for-all-remaining-lab-hosts" AND "all-host-not-matched-before" assigned.

A host named "foobar" would get the "all-host-not-matched-before" profile 
assigned only.

Please carefully review your host tree for potential overmatching in case you 
use applyMultiple as it might have unexpected side-effects especially when using 
regular expressions.

br,
Rainer



More information about the wpkg-users mailing list