upgrades-migrations / preupgrade-assistant-modules

Modules for the Preupgrade Assistant tool. Disclaimer: It was fun. R.I.P. :-)
GNU General Public License v3.0
3 stars 11 forks source link

services/tomcat #100

Closed jmazanek closed 6 years ago

jmazanek commented 6 years ago
jmazanek commented 6 years ago

There are many instances in the code, where os.system() is called without explicit check for a return code and it looks like it always returns False, regardless of the exit status of the called system command. @pirat89 @bocekm , please run the following test (in attached file ) on some RHEL 7.5 system to reproduce the issue. Please let me know, if I am missing something

python_os_system_test.txt

pirat89 commented 6 years ago

Discussed in person. The os.system returns exit code correctly. But 0 (zero) value is False in python and non-zero value is True, which is oposite logic in compare to Bash.

jmazanek commented 6 years ago

How the original code worked?:

  1. If the tomcat6 package is installed on the source system, it should contain /etc/tomcat6/ directory containing configuration files and /usr/share/tomcat6/webapps containing webapps.

  2. Preupgrade assistant module fixes some of the incompatibilities in the configuration files.

  3. At the target system, the package is renamed to tomcat.Post-upgrade script was supposed to migrate the original webapps as well as modified configuration files to new destinations on the target system - /usr/share/tomcat/webapps and /etc/tomcat respectively.

  4. The original module didn't succeed in migrating files as expected and printed error messages into the upgrade.log

What this change fixes and how to test it?:

Module migrates modified configuration files, as well as webapps, into the new destinations as expected.

  1. Check that package tomcat6 is installed on the source system and appropriate directories exist.

  2. Upgrade system using p-a and r-u-t.

  3. After the upgrade the files should be correctly migrated to the new destinations and no related Error messages should be printed into the preupgrade.log.

AloisMahdal commented 6 years ago

qa_ack: Test according to above changes.

At least, test manually with merely the tomcat6 being installed; ideally there would be some kind of "hello world" appllication that could be proven to be working before and after the upgrade.

pirat89 commented 6 years ago

Resolves: https://github.com/upgrades-migrations/preupgrade-assistant-modules/issues/55

drehak commented 6 years ago

Tested the module with @AloisMahdal and as it appears, apps in /usr/share/tomcat6/webapps still don't get migrated (with virtually no differences between Brew build and PR#100).

Sep 19 REDACTED kernel: acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
Sep 19 REDACTED kernel: acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
Sep 19 REDACTED upgrade-post[29456]: warning: /usr/lib64/security/classpath.security saved as /usr/lib64/security/classpath.security.rpmsave
Sep 19 REDACTED upgrade-post[29456]: Warning: The original /usr/share/tomcat6/webapps directory does not exist now, which means that you probably did not have your own web applications on the original system, or a different path was used. In the case that you had some web applications previously, copy them to a new directory: /usr/share/tomcat/webapps.
Sep 19 REDACTED upgrade-post[29456]: Error: The tomcat6 configuration files have not been moved to the new tomcatdirectory. Move the files manually.
Sep 19 REDACTED upgrade-post[29456]: redhat_upgrade_tool.util WARNING: failed to remove /system-upgrade-root: [Errno 16] Device or resource busy: '/system-upgrade-root/mnt'
:: [   FAIL   ] :: no warn/error/fail/fatal in upgrade.log (Expected 1, got 0)

Builds tested:

preupgrade-assistant-el6toel7-0.7.6-1.el6.noarch
preupgrade-assistant-el6toel7-0.7.6-0.201809140228Z.PR100.el6_8.noarch
AloisMahdal commented 6 years ago

Thanks, @drehak! I've dug a bit deeper and actually the error messages have --sort of-- changed:

 upgrade-post[PID]: Warning: The original /usr/share/tomcat6/webapps directory does not exist now, which means that you probably did not have your own web applications on the original system, or a different path was used. In the case that you had some web applications previously, copy them to a new directory: /usr/share/tomcat/webapps.
-upgrade-post[PID]: /bin/mv: cannot stat '/etc/tomcat6//*': No such file or directory
+upgrade-post[PID]: /bin/cp: cannot stat '/etc/tomcat6//*': No such file or directory
 upgrade-post[PID]: Error: The tomcat6 configuration files have not been moved to the new tomcatdirectory. Move the files manually.

So yeah, it was broken before and it's broken still. Full logs: brew-upgrade.log and p100-upgrade.log

pirat89 commented 6 years ago

oh man... :face_with_head_bandage: :broken_heart: ... :prayer_beads: :pray:

pirat89 commented 6 years ago

FOR QA: Just small modification for the @jmazanek instructions: Modified configuration files are migrated into the new location (/etc/tomcat). In case the configuration files on the source system are default, just the default config files of the target system are used. There is not printed error message mentioned above about copying in case all config files are defaults (in that case, the directory has been removed during uninstallation of tomcat6), the info message is printed.

AloisMahdal commented 6 years ago

Tested by re-running @drehak 's test with preupgrade-assistant-el6toel7-0.7.6-0.201810031757Z.PR100.el6_8.

Works as expected; the error message is gone, and even the sample app is migrated and runs after the re-boot.

Thanks!

pirat89 commented 6 years ago

@drehak @AloisMahdal thanks guys for great work! :)