wordpress-charmers team mailing list archive
-
wordpress-charmers team
-
Mailing list archive
-
Message #00327
[Merge] ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master
Thomas Cuthbert has proposed merging ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master.
Requested reviews:
Wordpress Charmers (wordpress-charmers)
For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/384807
--
Your team Wordpress Charmers is requested to review the proposed merge of ~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress:master into charm-k8s-wordpress:master.
diff --git a/files/docker-php.conf b/files/docker-php.conf
new file mode 100644
index 0000000..3c1ccf2
--- /dev/null
+++ b/files/docker-php.conf
@@ -0,0 +1,26 @@
+PassEnv SWIFT_URL
+
+<FilesMatch \.php$>
+ SetHandler application/x-httpd-php
+</FilesMatch>
+
+<Location "/wp-admin">
+ Header Set Cache-Control "max-age=0, no-store"
+</Location>
+
+DirectoryIndex disabled
+DirectoryIndex index.php index.html
+
+<Directory /var/www/>
+ Options -Indexes
+ AllowOverride All
+ RewriteEngine On
+ RewriteBase /
+ RewriteRule ^index\.php$ - [L]
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule . /index.php [L]
+</Directory>
+
+ProxyPass /wp-content/uploads/ ${SWIFT_URL}
+ProxyPassReverse /wp-content/uploads/ ${SWIFT_URL}
diff --git a/mod/operator b/mod/operator
index 11a1849..63e7d9e 160000
--- a/mod/operator
+++ b/mod/operator
@@ -1 +1 @@
-Subproject commit 11a1849205d750e28aaa4a13938b5864659f928b
+Subproject commit 63e7d9e4dc2a38a3fbc5623ff504eb18173e3f41
diff --git a/src/charm.py b/src/charm.py
index 3dd8162..a4cd679 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -8,7 +8,7 @@ from yaml import safe_load
from wordpress import Wordpress
-sys.path.append("lib") # noqa: E402
+sys.path.append("lib")
from ops.charm import CharmBase, CharmEvents
from ops.framework import EventBase, EventSource, StoredState
@@ -161,27 +161,29 @@ class WordpressK8sCharm(CharmBase):
def make_pod_resources(self):
resources = {
"kubernetesResources": {
- "ingressResources": [{
- "name": self.app.name,
- "spec": {
- "rules": [{
- "host": self.model.config["blog_hostname"],
- "http": {
- "paths": [{
- "path": "/",
- "backend": {
- "serviceName": self.app.name,
- "servicePort": 80
- }
- }]
- }
- }],
- "tls": [{
- "hosts": [self.model.config["blog_hostname"]],
- "secretName": self.model.config["tls_secret_name"],
- }],
+ "ingressResources": [
+ {
+ "name": self.app.name,
+ "spec": {
+ "rules": [
+ {
+ "host": self.model.config["blog_hostname"],
+ "http": {
+ "paths": [
+ {"path": "/", "backend": {"serviceName": self.app.name, "servicePort": 80}}
+ ]
+ },
+ }
+ ],
+ "tls": [
+ {
+ "hosts": [self.model.config["blog_hostname"]],
+ "secretName": self.model.config["tls_secret_name"],
+ }
+ ],
+ },
}
- }]
+ ]
}
}
@@ -209,10 +211,9 @@ class WordpressK8sCharm(CharmBase):
"imageDetails": {"imagePath": config["image"]},
"ports": ports,
"config": secure_pod_config,
- "kubernetes": {
- "readinessProbe": {"exec": {"command": ["/srv/wordpress-helpers/ready.sh"]}},
- }}
- ]
+ "kubernetes": {"readinessProbe": {"exec": {"command": ["/srv/wordpress-helpers/ready.sh"]}}},
+ }
+ ],
}
out = io.StringIO()
diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
index f2cba7f..d5772ba 100644
--- a/tests/unit/test_charm.py
+++ b/tests/unit/test_charm.py
@@ -4,8 +4,8 @@ import copy
import unittest
import sys
-sys.path.append('lib') # noqa: E402
-sys.path.append('src') # noqa: E402
+sys.path.append('lib')
+sys.path.append('src')
from charm import WordpressK8sCharm
from ops import testing
@@ -31,7 +31,7 @@ class TestWordpressK8sCharm(unittest.TestCase):
# Test for invalid model config.
want_msg_fmt = "Missing required config: {}"
- want_keys = ("image", "db_host", "db_name", "db_user", "db_password")
+ want_keys = ("image", "db_host", "db_name", "db_user", "db_password", "tls_secret_name")
for wanted_key in want_keys:
self.harness.charm.model.config[wanted_key] = ""
want_false = self.harness.charm.is_valid_config()
diff --git a/tests/unit/test_wordpress.py b/tests/unit/test_wordpress.py
index 32fdb43..5ebc90a 100644
--- a/tests/unit/test_wordpress.py
+++ b/tests/unit/test_wordpress.py
@@ -6,7 +6,7 @@ import sys
import unittest
import yaml
-sys.path.append("src") # noqa: E402
+sys.path.append("src")
import charm
import wordpress
diff --git a/tox.ini b/tox.ini
index 9427268..dbbb20f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -33,7 +33,7 @@ commands = black --skip-string-normalization --line-length=120 src/ tests/
deps = black
[testenv:lint]
-commands = flake8 src/ tests/
+commands = flake8 --ignore=E402 src/ tests/
deps = flake8
[flake8]
Follow ups