[wpkg-users] What happens if assigned packages disappear - proof of concept

Falko Trojahn ftrojahn at smi-softmark.de
Wed Jun 14 12:14:52 CEST 2006


Hi all,

in short:
I've tried to find a solution for that: if one of the split package 
files has incorrect syntax, whole wpkg process is broken. I made a 
patch for this (see bottom). But this remembered me of another 
problem: if the syntax (of one or all packages.xml files) is 
correct, but a package is accidentially missing or renamed, the 
package is deinstalled on all workstations, despite of it's 
assignment in hosts.xml and profiles.xml.

long term:
I tried a patch for wpkg.js 0.9.9-test3 (see bottom) which does the 
following: if the syntax of one of the xml files in a subdirectory 
is broken, an error is thrown, but the file is ignored, and wpkg
goes on for the rest of the files.

Example: I made a test with packages/firefox.xml containing e.g.
packages firefox15, firefox-ext-webdeveloper which depends from 
firefox15. Tests included "uncorrecting" syntax of the firefox.xml 
file and changing names of the packages when having correct syntax.

As a side effect I recognised, that all packages contained in the 
file with the false syntax are instantly removed. I remembered that
I came across this earlier. In the upper example, if firefox15 is 
renamed to firefox16, nothing is removed since 
firefox-ext-webdeveloper depends on firefox15, this is missing, only 
an error is thrown about the dependancy problem.

But if I rename the 2nd package e.g. to firefox-ext-webdevelop 
(could be an writing error, hence) this package is instantly removed.

_Is this really intended behaviour?_

I think, the following would be smoother/more correct:

Provided that a host is assigned to a profile, a package is included 
in this profile, and the package is installed on a workstation.
If in this situation the package disappears, but the 
host/profile/package assignement is intact, wpkg should assume an 
error and should _not_ remove this package!

What do you mean? I wouldn't like to wake up one morning with 
hundred's  of workstations without office ;-)

Best regards,
Falko



Proof-of-concept-patch against 0.9.9-test3 -
  syntax errors in certain xml files are ignored

Attention:
At the moment, if the packages which are included in the incorrect
file are installed, they are automatically removed despite
of their assignments in hosts.xml and profiles.xml
if there is an syntax error.

--- wpkg.js.org 2006-06-13 16:15:10.000000000 +0000
+++ wpkg.js     2006-06-14 09:23:26.000000000 +0000
@@ -2101,12 +2101,23 @@
         }^M
         else {^M
                 if( xslPath != null ) {^M
+                       try {^M
                         var xmlDoc = new 
ActiveXObject("Msxml2.DOMDocument.3.0")^M
                         xmlDoc.async="false"^M
                         xmlDoc.validateOnParse = false;^M
                         xmlDoc.loadXML( source.transformNode( 
xslPath ) );^M
                         return xmlDoc.documentElement;^M
                 }^M
+                       catch(e)^M
+                       {^M
+                               /* error loading file xmlPath */^M
+                               if (debug) {
+                                       info ("Error reading file: 
"+xmlPath+" !");^M
+                                       info ("Error was: " + 
e.description);^M
+                               }^M
+                               return source.documentElement;^M
+                       }^M
+               }^M
                 else {^M
                         return source.documentElement;^M
                 }^M



_______________________________________________
wpkg-users mailing list
wpkg-users at lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users




More information about the wpkg-users mailing list