June 15th, 2017 : GUI Improvements, logging feature, reboot now working, and more.
I went ahead with creating the logging feature before getting the reboot/recovery working given that it is useful in debugging other work, it’s been more beneficial. I’ve added a simple log() function and calls to it at several points of interest. The PowerShell scripts can also read and write to the log.
PowerShell Elevation and the Reboot
I was under the impression I’d already been running my PowerShell scripts as Admin but this week I found a better solution for ensuring the installer is in an administrator role. Credit goes to Ben Armstrong, the Hyper-V Program Manager for sharing his script elevation strategy on his Microsoft blog, https://blogs.msdn.microsoft.com/virtual_pc_guy/2010/09/23/a-self-elevating-powershell-script/. The installer now prompts the user and performs a reboot at the appropriate time in setting up the Linux Subsystem.
Added catch() and clean_up() functions
Rather than repeat code such as checking if the status is “timed_out,” I created a catch() function to call each time the status is anything other than the expected value. clean_up() was also added to remove the registry key and finish up once Plone is installed, avoiding more repetition.
While working on the logging feature I thought it would be nice to have a running copy of these progress messages displayed to the user as the installer proceeds. I once again researched more about the tkinter package; using the grid geometry manager I was able to really reduce the complexity of the GUI code and produce a more aesthetic interface. The user now gets to see text about what the installer is doing and I’ve fixed the fact that before, the user could press “Okay” again and mess with the state of installation.
Simple Fix : Installing Plone on WSL instance
WSL/Bash installed successfully, but the next step (running plone.sh within it) was having permissions problems (E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied). I remember one of the members of the original team was trying to avoid sudo so the user didn’t have to type their password (interrupt automation of the installer) but I had no problem with adding it. This is fixed now, I’ll be sure to instruct the user to remember their password as WSL is set up so they can enter it once to switch to super user and complete the installation.
reStructuredText and Sphinx
Translated existing docs to RST using Sphinx, added some helpful cross-referencing between items. Added documentation for enabledWSL.ps1, installWSL.ps1, freshwin10.ps1 and a few others.
Meeting in person with Kim Nguyen
This week Kim and I met on campus where the project originated to talk about progress. With his help I ironed out a few details and confirmed with him that a couple strategies I’m taking do make sense for the project. I also met a couple gentleman there who work with Plone on a regular basis, maybe I can meet with them again to discuss options for configuring and adding to the installer functionality now that I’ve got a good handle on the main installation code.
Fix: “Fatal Error!”
After a couple test runs I realized that when there is any error in WinPloneInstaller.py, I get the fatal error message. Putting two and two together I determined that sometimes this error was a problem with registry permissions (especially when the installer was trying to recover after reboot, it didn’t have permission to the registry key it had created itself during the last run!) I found https://stackoverflow.com/questions/41870408/python-winreg-module-access-denied and tried the suggestions there (modified my calls to wingreg.OpenKey and winreg.SetValueEx) and the problem is solved. Any time there is another problem in the Python code we will see this Fatal Error message from the executable, however.