← Back to team overview

nagios-charmers team mailing list archive

[Merge] ~addyess/charm-nagios:lp1849578-ssl_overwrites_include_directives into charm-nagios:master

 

Adam Dyess has proposed merging ~addyess/charm-nagios:lp1849578-ssl_overwrites_include_directives into charm-nagios:master.

Commit message:
Create a safe directory for include directives from subordinate charms
/etc/apache2/vhost.d/

Include any *.include file from this directory when generating ssl vhost config

Requested reviews:
  Nagios Charm developers (nagios-charmers)

For more details, see:
https://code.launchpad.net/~addyess/charm-nagios/+git/charm-nagios/+merge/387090
-- 
Your team Nagios Charm developers is requested to review the proposed merge of ~addyess/charm-nagios:lp1849578-ssl_overwrites_include_directives into charm-nagios:master.
diff --git a/.gitignore b/.gitignore
index e650362..fea92c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,6 @@ data/*.pem
 data/*.key
 data/*.crt
 data/*.csr
+.tox/
+.idea
+repo-info
\ No newline at end of file
diff --git a/Makefile b/Makefile
index 9d48829..22955cf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,22 @@
 #!/usr/bin/make
 PYTHON := /usr/bin/python3
 export PYTHONPATH := hooks
+PROJECTPATH = $(dir $(realpath $(MAKEFILE_LIST)))
+CHARM_NAME = $(notdir $(PROJECTPATH:%/=%))
+ifndef CHARM_BUILD_DIR
+    CHARM_BUILD_DIR := /tmp/$(CHARM_NAME)-builds
+    $(warning Warning CHARM_BUILD_DIR was not set, defaulting to $(CHARM_BUILD_DIR))
+endif
 
 default:
 	echo Nothing to do
 
+build:
+	@echo "Building charm to base directory $(CHARM_BUILD_DIR)/$(CHARM_NAME)"
+	@-git describe --tags > ./repo-info
+	@mkdir -p $(CHARM_BUILD_DIR)/$(CHARM_NAME)
+	@cp -r * $(CHARM_BUILD_DIR)/$(CHARM_NAME)
+
 # Primitive test runner. Someone please fix this.
 test:
 	tests/00-setup
diff --git a/hooks/templates/default-ssl.tmpl b/hooks/templates/default-ssl.tmpl
index 1e8a5fb..e87548a 100644
--- a/hooks/templates/default-ssl.tmpl
+++ b/hooks/templates/default-ssl.tmpl
@@ -173,5 +173,6 @@
 	# MSIE 7 and newer should be able to use keepalive
 	BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
 
+	IncludeOptional /etc/apache2/vhost.d/*.include
 </VirtualHost>
 </IfModule>
diff --git a/hooks/upgrade-charm b/hooks/upgrade-charm
index a80743b..3538e21 100755
--- a/hooks/upgrade-charm
+++ b/hooks/upgrade-charm
@@ -331,6 +331,12 @@ def update_apache():
     with open('hooks/templates/default-ssl.tmpl', 'r') as f:
         templateDef = f.read()
 
+    # Create directory for extra *.include files installed by subordinates
+    try:
+        os.makedirs('/etc/apache2/vhost.d/')
+    except OSError:
+        pass
+
     t = Template(templateDef)
     with open('/etc/apache2/sites-available/default-ssl.conf', 'w') as f:
         f.write(t.render(template_values))

Follow ups