modoboa / modoboa-installer

An installer for Modoboa
MIT License
254 stars 135 forks source link

Fixed frozen apt install during Modoboa upgrade when package already installed with old config file #539

Closed softwarecreations closed 5 months ago

softwarecreations commented 6 months ago

Fixes apt-get install when package already exists with an old config file. The updated code automatically installs the package-maintainer's version of any config files that come with the package.

Resolves issue Upgrade freezes while installing nginx #538

Steps to reproduce

./run.py --upgrade <your domain> Before image

This is the reason image image

After my patch I restored the VM to the point prior to the attempted upgrade. Re-attempt the upgrade. nginx installs successfully! image

codecov[bot] commented 6 months ago

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 54.40%. Comparing base (715a5e3) to head (7dcf69b). Report is 1 commits behind head on master.

Files Patch % Lines
modoboa_installer/package.py 0.00% 2 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #539 +/- ## ======================================= Coverage 54.40% 54.40% ======================================= Files 10 10 Lines 761 761 ======================================= Hits 414 414 Misses 347 347 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

tonioo commented 5 months ago

@softwarecreations The installer is supposed to be run on a fresh server...

softwarecreations commented 5 months ago

@tonioo I see that you're saying that now. But installer has an upgrade option... that implies that you can upgrade an existing server. It doesn't say anywhere in the Readme that the installer must be run on a fresh server with nothing on it. I am not arguing with you, I'm just saying that was not clear.

Likely common scenario Regardless, reality is that people will try run the installer on a server that already has something on it. Even something like nginx is used by countless projects and web-services.

Best way forward? I think it's good that the installer tells apt to use the package-maintainer's config files. What is the harm in that? Without telling apt your preference, the installer crashes if an old config file is found. What I discovered when I told apt to use the package-maintainer's config files, is that the old config files were simply renamed (not deleted) so there was no real harm. The end result was a working installation rather than a crashed installer.

By the way I did solve my problem shown in the screenshot. Unrelated to this conversation. The installer was behaving badly until I deleted my old config file.