Merge lp:~bac/charms/trusty/wordpress/correct-wp-content into lp:charms/trusty/wordpress

Proposed by Brad Crittenden
Status: Merged
Merged at revision: 88
Proposed branch: lp:~bac/charms/trusty/wordpress/correct-wp-content
Merge into: lp:charms/trusty/wordpress
Diff against target: 187 lines (+143/-2) (has conflicts)
6 files modified
config.yaml (+2/-2)
tests/00-setup (+5/-0)
tests/01-standard (+53/-0)
tests/02-memcached (+65/-0)
tests/helper.py (+17/-0)
tests/tests.yaml (+1/-0)
Conflict adding file tests.  Moved existing file to tests.moved.
To merge this branch: bzr merge lp:~bac/charms/trusty/wordpress/correct-wp-content
Reviewer Review Type Date Requested Status
Cory Johns (community) Approve
Review via email: mp+319138@code.launchpad.net

Description of the change

Fix the example in config.yaml for wp-content as the old one does not exist.

To post a comment you must log in.
Revision history for this message
Cory Johns (johnsca) wrote :

This has been merged and released as cs:trusty/wordpress-5

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2012-12-11 19:45:08 +0000
3+++ config.yaml 2017-03-06 22:26:49 +0000
4@@ -3,12 +3,12 @@
5 type: string
6 default: "single"
7 description: |
8- This is the tuning level for the WordPress setup. There are three options: "bare", "single", and "optimized". "bare" will give you a nearly un-altered WordPress setup, as if you'd downloaded and set it up yourself. "single" will provide you with everything you need to run a singlular unit of WordPress. This doesn't take in to consideration that you'll be scaling at all. However, it will allow you to use WordPress free of any troubles and pesky limitations that typically happen during "optimized". While you _can_ scale out with this setting I encourage you read the README "optimized" will give you a hardened WordPress setup. Some of the features in the Admin panel will be locked down and theme edits/plugins can only be updated through he charm. This is the recommended setup for those who are in serious need of constant scaling.
9+ This is the tuning level for the WordPress setup. There are three options: "bare", "single", and "optimized". "bare" will give you a nearly un-altered WordPress setup, as if you downloaded and set it up yourself. "single" will provide you with everything you need to run a singlular unit of WordPress. This does not take in to consideration that you will be scaling at all. However, it will allow you to use WordPress free of any troubles and pesky limitations that typically happen during "optimized". While you _can_ scale out with this setting I encourage you read the README "optimized" will give you a hardened WordPress setup. Some of the features in the Admin panel will be locked down and theme edits/plugins can only be updated through he charm. This is the recommended setup for those who are in serious need of constant scaling.
10 wp-content:
11 type: string
12 default: ""
13 description: |
14- This is a full repository path to where the WordPress wp-contents can be found. At this time Git, BZR, SVN, and HG are supported. An example of what a wp-content repository should look like can be found at http://github.com/jujutools/wordpress-site.
15+ This is a full repository path to where the WordPress wp-contents can be found. At this time Git, BZR, SVN, and HG are supported. An example of what a wp-content repository should look like can be found at https://github.com/marcoceppi/wordpress-demo.
16 debug:
17 type: string
18 default: "no"
19
20=== added directory 'tests'
21=== renamed directory 'tests' => 'tests.moved'
22=== added file 'tests/00-setup'
23--- tests/00-setup 1970-01-01 00:00:00 +0000
24+++ tests/00-setup 2017-03-06 22:26:49 +0000
25@@ -0,0 +1,5 @@
26+#!/bin/bash
27+
28+sudo add-apt-repository -y ppa:juju/stable
29+sudo apt-get update
30+sudo apt-get install -y amulet python3-requests
31
32=== added file 'tests/01-standard'
33--- tests/01-standard 1970-01-01 00:00:00 +0000
34+++ tests/01-standard 2017-03-06 22:26:49 +0000
35@@ -0,0 +1,53 @@
36+#!/usr/bin/python3
37+
38+import os
39+import amulet
40+import requests
41+
42+import helper
43+
44+d = amulet.Deployment(series='precise')
45+d.add('mysql')
46+d.add('wordpress')
47+d.relate('mysql:db', 'wordpress:db')
48+d.expose('wordpress')
49+
50+try:
51+ # Create the deployment described above, give us 900 seconds to do it
52+ d.setup(timeout=900)
53+ # Setup will only make sure the services are deployed, related, and in a
54+ # "started" state. We can employ the sentries to actually make sure there
55+ # are no more hooks being executed on any of the nodes.
56+ d.sentry.wait()
57+except amulet.helpers.TimeoutError:
58+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
59+except:
60+ # Something else has gone wrong, raise the error so we can see it and this
61+ # will automatically "FAIL" the test.
62+ raise
63+
64+# Shorten the names a little to make working with unit data easier
65+wp_unit = d.sentry.unit['wordpress/0']
66+mysql_unit = d.sentry.unit['mysql/0']
67+
68+# WordPress requires user input to "finish" a setup. This code is contained in
69+# the helper.py file found in the lib directory. If it's not able to complete
70+# the WordPress setup we need to quit the test, not as failed per se, but as a
71+# SKIPed test since we can't accurately setup the environment
72+try:
73+ helper.finish_setup(wp_unit.info['public-address'], password='amulet-test')
74+except:
75+ amulet.raise_status(amulet.SKIP, msg="Unable to finish WordPress setup")
76+
77+home_page = requests.get('http://%s/' % wp_unit.info['public-address'], proxies=None)
78+home_page.raise_for_status() # Make sure it's not 5XX error
79+
80+# Fetch the wp-info.php file contents from the unit, then we can attempt to
81+# re-build it from the relation data and insure it's working as expected.
82+wp_cfg = wp_unit.file_contents('/var/www/wp-info.php')
83+
84+# Since relation data is unique per unit per service we don't want to grab
85+# what WordPress sent to MySQL. No, we want the data that MySQL sent to
86+# WordPress. Using this command we say, "get what MySQL sent via the 'db'
87+# relation to WordPress's 'db' relation.
88+relation_data = mysql_unit.relation('db', 'wordpress:db')
89
90=== added file 'tests/02-memcached'
91--- tests/02-memcached 1970-01-01 00:00:00 +0000
92+++ tests/02-memcached 2017-03-06 22:26:49 +0000
93@@ -0,0 +1,65 @@
94+#!/usr/bin/python3
95+
96+import os
97+import amulet
98+import requests
99+
100+import helper
101+
102+d = amulet.Deployment(series='precise')
103+d.add('mysql')
104+d.add('wordpress')
105+d.relate('mysql:db', 'wordpress:db')
106+d.expose('wordpress')
107+d.add('memcached')
108+
109+try:
110+ # Create the deployment described above, give us 900 seconds to do it
111+ d.setup(timeout=900)
112+ # Setup will only make sure the services are deployed, related, and in a
113+ # "started" state. We can employ the sentries to actually make sure there
114+ # are no more hooks being executed on any of the nodes.
115+ d.sentry.wait()
116+except amulet.helpers.TimeoutError:
117+ amulet.raise_status(amulet.SKIP, msg="Environment wasn't stood up in time")
118+except:
119+ # Something else has gone wrong, raise the error so we can see it and this
120+ # will automatically "FAIL" the test.
121+ raise
122+
123+# Shorten the names a little to make working with unit data easier
124+wp_unit = d.sentry.unit['wordpress/0']
125+mysql_unit = d.sentry.unit['mysql/0']
126+
127+# WordPress requires user input to "finish" a setup. This code is contained in
128+# the helper.py file found in the lib directory. If it's not able to complete
129+# the WordPress setup we need to quit the test, not as failed per se, but as a
130+# SKIPed test since we can't accurately setup the environment
131+try:
132+ helper.finish_setup(wp_unit.info['public-address'], password='amulet-test')
133+except:
134+ amulet.raise_status(amulet.SKIP, msg="Unable to finish WordPress setup")
135+
136+home_page = requests.get('http://%s/' % wp_unit.info['public-address'], proxies=None)
137+home_page.raise_for_status() # Make sure it's not 5XX error
138+
139+d.relate('wordpress:cache', 'memcached:cache')
140+
141+# Since we've changed the schema of our deployment, we need to run setup again
142+
143+try:
144+ # Default timeout should be enough time to get memcached up and related
145+ d.setup()
146+ d.sentry.wait()
147+except amulet.helpers.TimeoutError:
148+ amulet.raise_status(amulet.SKIP, msg="Memcached wasn't stood up in time.")
149+except:
150+ # Incase deployer throws an error
151+ raise
152+
153+# Verify WordPress still responds with a 200
154+home_page = requests.get('http://%s/' % wp_unit.info['public-address'], proxies=None)
155+home_page.raise_for_status()
156+
157+# Verify the WordPress plugin was installed correctly
158+wp_unit.directory('/var/www/wp-content/plugins/wp-ffpc')
159
160=== added file 'tests/__init__.py'
161=== added file 'tests/helper.py'
162--- tests/helper.py 1970-01-01 00:00:00 +0000
163+++ tests/helper.py 2017-03-06 22:26:49 +0000
164@@ -0,0 +1,17 @@
165+import requests
166+
167+
168+def finish_setup(unit, user='admin', password=None):
169+ h = {'User-Agent': 'Mozilla/5.0 Gecko/20100101 Firefox/12.0',
170+ 'Content-Type': 'application/x-www-form-urlencoded',
171+ 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*',
172+ 'Accept-Encoding': 'gzip, deflate'}
173+
174+ r = requests.post('http://%s/wp-admin/install.php?step=2' % unit,
175+ headers=h, data={'weblog_title': 'Amulet Test %s' % unit,
176+ 'user_name': user, 'admin_password': password,
177+ 'admin_email': 'test@example.tld',
178+ 'admin_password2': password,
179+ 'Submit': 'Install WordPress'}, proxies=None)
180+
181+ r.raise_for_status()
182
183=== added file 'tests/tests.yaml'
184--- tests/tests.yaml 1970-01-01 00:00:00 +0000
185+++ tests/tests.yaml 2017-03-06 22:26:49 +0000
186@@ -0,0 +1,1 @@
187+tests: "0*"

Subscribers

People subscribed via source and target branches

to all changes: