[wpkg-users] intermittent loss of access to log file (with patch)

Christian chanlists at googlemail.com
Thu May 14 23:42:17 CEST 2015


Dear all,

some of our client machines only have access to the shares housing wpkg
via an openvpn tunnel. However, openvpn itself needs to be updated via
wpkg. I have accomplished this by encapsulating the install process in a
batch file which is copied to the local hard drive together with all
installation files required prior to the update by wpkg. wpkg then
starts the "installer batch file" from the local hard drive. The problem
is that wpkg.js dies after the "installer batch file" finishes because
it has lost access to the log file due to the intermittent disconnect of
the tunnel. Below you will find a patch relative to wpkg 1.3.1 which
checks whether the write to the log succeeds and, if not, tries to
re-initialize the log file. This has worked for me. Hope this helps
somebody else,

Christian

--- wpkg_orig.js        2015-05-14 23:31:39.385799500 +0200
+++ wpkg.js     2015-05-14 23:33:25.813080700 +0200
@@ -9133,7 +9133,14 @@
                var logFile = getLogFile();
                if (logFile != null) {
                        // Write log to file.
-                       logFile.WriteLine(getLogLine(logSeverity,
description));
+                       try {logFile.WriteLine(getLogLine(logSeverity,
description));
+                       } catch (err) {
+                               // In case the write failed, we have
lost the log file (possibly because of
+                               // an intermittent network disconnect.
In that case, try to re-initialize.
+                               initializeLog();
+                               logFile = getLogFile();
+                              
logFile.WriteLine(getLogLine(logSeverity, description));
+                       }
                } else {
                        // First write log line to buffer.
                        if (logBuffer != null) {
   



More information about the wpkg-users mailing list