Bug 35078 - apache config broken between unpacking and installation of univention-nagios-server
apache config broken between unpacking and installation of univention-nagios-...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Monitoring (Prometheus or Nagios)
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 3.2-3-errata
Assigned To: Alexander Kramer
Alexander Kläser
:
Depends on:
Blocks: 35894
  Show dependency treegraph
 
Reported: 2014-06-10 10:14 CEST by Felix Botner
Modified: 2014-09-11 10:06 CEST (History)
6 users (show)

See Also:
What kind of report is it?: ---
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
add symlink to postint and prerm (1.90 KB, patch)
2014-07-25 14:48 CEST, Alexander Kramer
Details | Diff
update.log (7.61 KB, text/plain)
2014-09-03 10:28 CEST, Stefan Gohmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2014-06-10 10:14:02 CEST
univention-nagios-server creates a symlink /etc/apache2/conf.d/nagios3.conf during unpacking (debian/univention-nagios-server.links), but the actual source /etc/nagios3/apache2.conf is not present until installation of univention-nagios-server (it is a ucr template). So between unpacking and installation of univention-nagios-server we have a broken symlink in /etc/apache2/conf.d apache wont restart/start. This can be a problem for other packages (see ticket 2014051621006435).

We should create the symlink /etc/apache2/conf.d/nagios3.conf in the postinst, after the config template was committed and remove the symlink in the prerm.
Comment 1 Markus Frosch 2014-06-11 11:07:40 CEST
I would suggest the following workaround for now:

diff --git a/debian/icinga-cgi.postinst b/debian/icinga-cgi.postinst
index 95b91fb..c3c5e4a 100644
--- a/debian/icinga-cgi.postinst
+++ b/debian/icinga-cgi.postinst
@@ -47,6 +47,14 @@ case "$1" in
 
     COMMON_STATE=$(dpkg-query -f '${Status}' -W 'apache2.2-common' 2>/dev/null | awk '{print $3}' || true)
 
+    # UNIVENTION WORKAROUND
+    # see https://forge.univention.org/bugzilla/show_bug.cgi?id=35078
+    if [ -L /etc/apache2/conf.d/nagios3.conf ]; then
+        if [ ! -f /etc/nagios3/apache2.conf ]; then
+            touch /etc/nagios3/apache2.conf
+        fi
+    fi
+
     # NEW method for Apache >= 2.4
     if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then
         . /usr/share/apache2/apache2-maintscript-helper
Comment 2 Alexander Kramer univentionstaff 2014-07-25 14:48:37 CEST
Created attachment 6025 [details]
add symlink to postint and prerm

As Felix has suggested, I
- removed the symlink from u*-n*-server.links
- added it to u*-n*-server.postint and u*-n*-server.prerm
Comment 3 Alexander Kramer univentionstaff 2014-07-25 14:50:01 CEST
patch assigned pls let me know if i should prepare it for erratum ;)
Comment 4 Alexander Kläser univentionstaff 2014-09-02 12:43:24 CEST
(In reply to Alexander Kramer from comment #3)
> patch assigned pls let me know if i should prepare it for erratum ;)

Patch looks good, please apply it.
Comment 5 Alexander Kramer univentionstaff 2014-09-02 16:01:09 CEST
For ucs 3.2-3:
- Added patch to svn r53255
- Adapted YAML file r53258
- Packages has been build:
Source: univention-nagios
Version: 7.0.6-5
Distribution: unstable
Urgency: low
Maintainer: Alexander Kramer <kramer@univention.de>
Date: Tue, 02 Sep 2014 15:04:31 +0200
Changes: 
 univention-nagios (7.0.6-5) unstable; urgency=low
 .
   * FIX broken apache config (Bug #35078)
-----
For ucs 4.0:
- Added patch to svn r53260
- Packages has been build:
Source: univention-nagios
Version: 8.0.0-2
Distribution: unstable
Urgency: low
Maintainer: Alexander Kramer <kramer@univention.de>
Date: Tue, 02 Sep 2014 15:43:07 +0200
Changes: 
 univention-nagios (8.0.0-2) unstable; urgency=low
 .
   * FIX broken apache config (Bug #35078)
Comment 6 Stefan Gohmann univentionstaff 2014-09-03 10:28:17 CEST
After updating to the latest pre erratum (see update.log):

root@master321:~# /etc/init.d/apache2 restart
apache2: Syntax error on line 227 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/nagios3.conf: No such file or directory
Action 'configtest' failed.
The Apache error log may have more information.
 failed!
root@master321:~#

See jenkins test result:
 http://jenkins.knut.univention.de:8080/job/UCS-3.2/job/UCS-3.2-3/job/Autotest%20MultiEnv/15/testReport/
Comment 7 Stefan Gohmann univentionstaff 2014-09-03 10:28:42 CEST
Created attachment 6085 [details]
update.log
Comment 8 Florian Best univentionstaff 2014-09-03 11:06:41 CEST
btw: why saving it under /etc/apache2/conf.d/nagios3.conf? It would be easier to put it into /etc/apache2/site-available/ and use the apache tool "a2ensite" and "a2dissite".
Comment 9 Alexander Kramer univentionstaff 2014-09-03 13:41:40 CEST
Found the error. I have forgotten a / in the symlink:
old: ln -s etc/nagios3/apache2.conf /etc/apache2/conf.d/nagios3.conf
new: ln -s /etc/nagios3/apache2.conf /etc/apache2/conf.d/nagios3.conf

r53293 r53294


Package: univention-nagios
Version: 7.0.6-6.269.201409031311
Scope: errata3.2-3

Package: univention-nagios
Version: 8.0.0-3.270.201409031311
Branch: ucs_4.0-0

Tested it with a locally build on ucs3.2-3 and ucs4.0-0 the error disappeared.
If you prefer the suggestion from Florain please let me know and i will change it.
Comment 10 Alexander Kläser univentionstaff 2014-09-03 14:42:58 CEST
(In reply to Alexander Kramer from comment #9)
> Found the error. I have forgotten a / in the symlink:
> old: ln -s etc/nagios3/apache2.conf /etc/apache2/conf.d/nagios3.conf
> new: ln -s /etc/nagios3/apache2.conf /etc/apache2/conf.d/nagios3.conf
> 
> r53293 r53294
> 
> 
> Package: univention-nagios
> Version: 7.0.6-6.269.201409031311
> Scope: errata3.2-3
> 
> Package: univention-nagios
> Version: 8.0.0-3.270.201409031311
> Branch: ucs_4.0-0
> 
> Tested it with a locally build on ucs3.2-3 and ucs4.0-0 the error
> disappeared.

Changes look good to me. There was no broken link after unpacking and after the postinst scripts the link was working fine. The update was fine.

I updated the package version in the YAML file.

Changes have been merged to 4.0.

→ VERIFIED

> If you prefer the suggestion from Florain please let me know and i will
> change it.

Good hint from Florian, but let us leave it in the form it is right now. I am not sure whether this would have any other implications.
Comment 11 Janek Walkenhorst univentionstaff 2014-09-10 17:40:39 CEST
http://errata.univention.de/ucs/3.2/198.html