Re: [Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:test-coverage into charm-k8s-wordpress:master

2021-01-14 Thread Canonical IS Mergebot
This merge proposal is being monitored by mergebot. Change the status to 
Approved to merge.
-- 
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396312
Your team Wordpress Charmers is requested to review the proposed merge of 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:test-coverage into 
charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:test-coverage into charm-k8s-wordpress:master

2021-01-14 Thread Tom Haddon
Tom Haddon has proposed merging 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:test-coverage into 
charm-k8s-wordpress:master.

Commit message:
Increase test coverage from 78% to 88% on charm.py, and fix bug with detecting 
leader in _get_initial_password

Requested reviews:
  Wordpress Charmers (wordpress-charmers)

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396312
-- 
Your team Wordpress Charmers is requested to review the proposed merge of 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:test-coverage into 
charm-k8s-wordpress:master.
diff --git a/.gitignore b/.gitignore
index ed12673..f02053e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 build
 *.charm
+*.swp
 .tox
 .coverage
 __pycache__
diff --git a/config.yaml b/config.yaml
index acb10d3..55c3b0b 100644
--- a/config.yaml
+++ b/config.yaml
@@ -103,6 +103,6 @@ options:
   wp_plugin_openstack-objectstorage_config:
 type: string
 description: |
-  YAML dictionary with keys named after wordpress settings and the desired values.
-  Please note that the settings will be reset to values provided every time hooks run
+  YAML dictionary with keys named after WordPress settings and the desired values.
+  Please note that the settings will be reset to values provided every time hooks run.
 default: ""
diff --git a/src/charm.py b/src/charm.py
index 7a8f492..cba136a 100755
--- a/src/charm.py
+++ b/src/charm.py
@@ -409,7 +409,7 @@ class WordpressCharm(CharmBase):
 or return an empty string if we're not."""
 initial_password = self.leader_data["initial_password"]
 if not initial_password:
-if self.unit.is_leader:
+if self.unit.is_leader():
 initial_password = password_generator()
 self.leader_data["initial_password"] = initial_password
 return initial_password
@@ -423,5 +423,5 @@ class WordpressCharm(CharmBase):
 event.fail("Initial password has not been set yet.")
 
 
-if __name__ == "__main__":
+if __name__ == "__main__":  # pragma: no cover
 main(WordpressCharm)
diff --git a/tests/unit/test_charm.py b/tests/unit/test_charm.py
index dfd2883..0c3de68 100644
--- a/tests/unit/test_charm.py
+++ b/tests/unit/test_charm.py
@@ -15,12 +15,16 @@ from ops.model import (
 MaintenanceStatus,
 )
 
-from test_wordpress import TEST_MODEL_CONFIG
+from test_wordpress import (
+TEST_MODEL_CONFIG_MINIMAL,
+TEST_MODEL_CONFIG_FULL,
+)
 
 
 class TestWordpressCharm(unittest.TestCase):
 
-test_model_config = TEST_MODEL_CONFIG
+test_model_config = TEST_MODEL_CONFIG_FULL
+test_model_config_minimal = TEST_MODEL_CONFIG_MINIMAL
 
 def setUp(self):
 self.harness = testing.Harness(WordpressCharm)
@@ -34,10 +38,10 @@ class TestWordpressCharm(unittest.TestCase):
 # connection details from the charm config.
 charm = self.harness.charm
 self.assertFalse(charm.state.has_db_relation)
-self.assertEqual(charm.state.db_host, TEST_MODEL_CONFIG["db_host"])
-self.assertEqual(charm.state.db_name, TEST_MODEL_CONFIG["db_name"])
-self.assertEqual(charm.state.db_user, TEST_MODEL_CONFIG["db_user"])
-self.assertEqual(charm.state.db_password, TEST_MODEL_CONFIG["db_password"])
+self.assertEqual(charm.state.db_host, TEST_MODEL_CONFIG_FULL["db_host"])
+self.assertEqual(charm.state.db_name, TEST_MODEL_CONFIG_FULL["db_name"])
+self.assertEqual(charm.state.db_user, TEST_MODEL_CONFIG_FULL["db_user"])
+self.assertEqual(charm.state.db_password, TEST_MODEL_CONFIG_FULL["db_password"])
 
 # Add a relation and remote unit providing connection details.
 # TODO: ops-lib-mysql should have a helper to set the relation data.
@@ -175,8 +179,8 @@ class TestWordpressCharm(unittest.TestCase):
 }
 self.assertEqual(self.harness.charm.make_pod_resources(), expected)
 
-# And now test with no tls config.
-self.harness.update_config({"tls_secret_name": ""})
+# And now test with minimal config.
+self.harness.update_config(self.test_model_config_minimal)
 expected = {
 'kubernetesResources': {
 'ingressResources': [
@@ -200,28 +204,6 @@ class TestWordpressCharm(unittest.TestCase):
 ]
 },
 },
-{
-'host': 'cool-newsite.org',
-'http': {
-'paths': [
-{
-'path': '/',
-'backend': {'serviceName': 'wordpress', 'servicePort': 80},
-}
-]
-

Re: [Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Canonical IS Mergebot
Change successfully merged at revision 8c24b6f7c4cdaed2f4a19309ab8d142b7c603c5c
-- 
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread noreply
The proposal to merge 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface 
into charm-k8s-wordpress:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Tom Haddon
The proposal to merge 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface 
into charm-k8s-wordpress:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Canonical IS Mergebot
Failed to merge change (unable to merge source repository due to conflicts), 
setting status to needs review.
-- 
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Canonical IS Mergebot
The proposal to merge 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface 
into charm-k8s-wordpress:master has been updated.

Status: Approved => Needs review

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Tom Haddon
The proposal to merge 
~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface 
into charm-k8s-wordpress:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress:use-leadership-interface into charm-k8s-wordpress:master

2021-01-14 Thread Thomas Cuthbert
Review: Approve

LGTM +1
-- 
https://code.launchpad.net/~mthaddon/charm-k8s-wordpress/+git/charm-k8s-wordpress/+merge/396194
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:additional_hostnames into charm-k8s-wordpress:master

2021-01-14 Thread noreply
The proposal to merge ~tcuthbert/charm-k8s-wordpress:additional_hostnames into 
charm-k8s-wordpress:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/395661
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:additional_hostnames into charm-k8s-wordpress:master

2021-01-14 Thread Canonical IS Mergebot
Change successfully merged at revision 15142081bbd9396aa0b66ba97fbaec1ae8033877
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/395661
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


[Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:additional_hostnames into charm-k8s-wordpress:master

2021-01-14 Thread Tom Haddon
The proposal to merge ~tcuthbert/charm-k8s-wordpress:additional_hostnames into 
charm-k8s-wordpress:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/395661
-- 
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp


Re: [Wordpress-charmers] [Merge] ~tcuthbert/charm-k8s-wordpress:additional_hostnames into charm-k8s-wordpress:master

2021-01-14 Thread Tom Haddon
Review: Approve

LGTM, thx
-- 
https://code.launchpad.net/~tcuthbert/charm-k8s-wordpress/+git/charm-k8s-wordpress-1/+merge/395661
Your team Wordpress Charmers is subscribed to branch charm-k8s-wordpress:master.

-- 
Mailing list: https://launchpad.net/~wordpress-charmers
Post to : wordpress-charmers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~wordpress-charmers
More help   : https://help.launchpad.net/ListHelp