Merge lp:~corey.bryant/charms/trusty/keystone/git-1531612 into lp:~openstack-charmers-archive/charms/trusty/keystone/next

Proposed by Corey Bryant
Status: Merged
Merged at revision: 198
Proposed branch: lp:~corey.bryant/charms/trusty/keystone/git-1531612
Merge into: lp:~openstack-charmers-archive/charms/trusty/keystone/next
Diff against target: 266 lines (+103/-22)
7 files modified
charm-helpers-hooks.yaml (+1/-1)
charmhelpers/contrib/openstack/context.py (+12/-2)
charmhelpers/contrib/openstack/templates/haproxy.cfg (+3/-2)
charmhelpers/contrib/openstack/utils.py (+6/-9)
charmhelpers/fetch/giturl.py (+2/-5)
charmhelpers/payload/archive.py (+73/-0)
unit_tests/test_keystone_contexts.py (+6/-3)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/keystone/git-1531612
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+281958@code.launchpad.net
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16803 keystone-next for corey.bryant mp281958
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16803/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15697 keystone-next for corey.bryant mp281958
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.

Full unit test output: http://paste.ubuntu.com/14434924/
Build: http://10.245.162.77:8080/job/charm_unit_test/15697/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8578 keystone-next for corey.bryant mp281958
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8578/

196. By Liam Young

[hopem, r=gnuoy] Fix upgrade breakage whereby if upgrading from
version of charm that did not support
db-initialised peer setting db ops get stuck
waiting infinitely for db to be intialised.

Closes-Bug: 1519035

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16836 keystone-next for corey.bryant mp281958
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16836/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15722 keystone-next for corey.bryant mp281958
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.

Full unit test output: http://paste.ubuntu.com/14438187/
Build: http://10.245.162.77:8080/job/charm_unit_test/15722/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16842 keystone-next for corey.bryant mp281958
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16842/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15729 keystone-next for corey.bryant mp281958
    UNIT FAIL: unit-test failed

UNIT Results (max last 2 lines):
make: *** [test] Error 1
ERROR:root:Make target returned non-zero.

Full unit test output: http://paste.ubuntu.com/14438584/
Build: http://10.245.162.77:8080/job/charm_unit_test/15729/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #16850 keystone-next for corey.bryant mp281958
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/16850/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15736 keystone-next for corey.bryant mp281958
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/15736/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8605 keystone-next for corey.bryant mp281958
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8605/

197. By Corey Bryant

[corey.bryant,r=osci] Sync charm-helpers.

Enable sync of payload.archive, sync charm-helpers, and fixup unit test failures.

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #17080 keystone-next for corey.bryant mp281958
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/17080/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #15955 keystone-next for corey.bryant mp281958
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/15955/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #8690 keystone-next for corey.bryant mp281958
    AMULET OK: passed

Build: http://10.245.162.77:8080/job/charm_amulet_test/8690/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charm-helpers-hooks.yaml'
2--- charm-helpers-hooks.yaml 2015-08-06 11:52:27 +0000
3+++ charm-helpers-hooks.yaml 2016-01-11 14:23:26 +0000
4@@ -11,7 +11,7 @@
5 - cluster
6 - contrib.python
7 - contrib.unison
8- - payload.execd
9+ - payload
10 - contrib.peerstorage
11 - contrib.network.ip
12 - contrib.python.packages
13
14=== modified file 'charmhelpers/contrib/openstack/context.py'
15--- charmhelpers/contrib/openstack/context.py 2016-01-04 21:27:51 +0000
16+++ charmhelpers/contrib/openstack/context.py 2016-01-11 14:23:26 +0000
17@@ -57,6 +57,7 @@
18 get_nic_hwaddr,
19 mkdir,
20 write_file,
21+ pwgen,
22 )
23 from charmhelpers.contrib.hahelpers.cluster import (
24 determine_apache_port,
25@@ -87,6 +88,8 @@
26 is_bridge_member,
27 )
28 from charmhelpers.contrib.openstack.utils import get_host_ip
29+from charmhelpers.core.unitdata import kv
30+
31 CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
32 ADDRESS_TYPES = ['admin', 'internal', 'public']
33
34@@ -636,11 +639,18 @@
35 ctxt['ipv6'] = True
36 ctxt['local_host'] = 'ip6-localhost'
37 ctxt['haproxy_host'] = '::'
38- ctxt['stat_port'] = ':::8888'
39 else:
40 ctxt['local_host'] = '127.0.0.1'
41 ctxt['haproxy_host'] = '0.0.0.0'
42- ctxt['stat_port'] = ':8888'
43+
44+ ctxt['stat_port'] = '8888'
45+
46+ db = kv()
47+ ctxt['stat_password'] = db.get('stat-password')
48+ if not ctxt['stat_password']:
49+ ctxt['stat_password'] = db.set('stat-password',
50+ pwgen(32))
51+ db.flush()
52
53 for frontend in cluster_hosts:
54 if (len(cluster_hosts[frontend]['backends']) > 1 or
55
56=== modified file 'charmhelpers/contrib/openstack/templates/haproxy.cfg'
57--- charmhelpers/contrib/openstack/templates/haproxy.cfg 2015-12-07 23:14:00 +0000
58+++ charmhelpers/contrib/openstack/templates/haproxy.cfg 2016-01-11 14:23:26 +0000
59@@ -33,13 +33,14 @@
60 timeout server 30000
61 {%- endif %}
62
63-listen stats {{ stat_port }}
64+listen stats
65+ bind {{ local_host }}:{{ stat_port }}
66 mode http
67 stats enable
68 stats hide-version
69 stats realm Haproxy\ Statistics
70 stats uri /
71- stats auth admin:password
72+ stats auth admin:{{ stat_password }}
73
74 {% if frontends -%}
75 {% for service, ports in service_ports.items() -%}
76
77=== modified file 'charmhelpers/contrib/openstack/utils.py'
78--- charmhelpers/contrib/openstack/utils.py 2016-01-05 11:46:02 +0000
79+++ charmhelpers/contrib/openstack/utils.py 2016-01-11 14:23:26 +0000
80@@ -593,7 +593,7 @@
81 return yaml.load(projects_yaml)
82
83
84-def git_clone_and_install(projects_yaml, core_project, depth=1):
85+def git_clone_and_install(projects_yaml, core_project):
86 """
87 Clone/install all specified OpenStack repositories.
88
89@@ -643,6 +643,9 @@
90 for p in projects['repositories']:
91 repo = p['repository']
92 branch = p['branch']
93+ depth = '1'
94+ if 'depth' in p.keys():
95+ depth = p['depth']
96 if p['name'] == 'requirements':
97 repo_dir = _git_clone_and_install_single(repo, branch, depth,
98 parent_dir, http_proxy,
99@@ -687,19 +690,13 @@
100 """
101 Clone and install a single git repository.
102 """
103- dest_dir = os.path.join(parent_dir, os.path.basename(repo))
104-
105 if not os.path.exists(parent_dir):
106 juju_log('Directory already exists at {}. '
107 'No need to create directory.'.format(parent_dir))
108 os.mkdir(parent_dir)
109
110- if not os.path.exists(dest_dir):
111- juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
112- repo_dir = install_remote(repo, dest=parent_dir, branch=branch,
113- depth=depth)
114- else:
115- repo_dir = dest_dir
116+ juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
117+ repo_dir = install_remote(repo, dest=parent_dir, branch=branch, depth=depth)
118
119 venv = os.path.join(parent_dir, 'venv')
120
121
122=== modified file 'charmhelpers/fetch/giturl.py'
123--- charmhelpers/fetch/giturl.py 2016-01-04 21:27:51 +0000
124+++ charmhelpers/fetch/giturl.py 2016-01-11 14:23:26 +0000
125@@ -22,7 +22,6 @@
126 filter_installed_packages,
127 apt_install,
128 )
129-from charmhelpers.core.host import mkdir
130
131 if filter_installed_packages(['git']) != []:
132 apt_install(['git'])
133@@ -50,8 +49,8 @@
134 cmd = ['git', '-C', dest, 'pull', source, branch]
135 else:
136 cmd = ['git', 'clone', source, dest, '--branch', branch]
137- if depth:
138- cmd.extend(['--depth', depth])
139+ if depth:
140+ cmd.extend(['--depth', depth])
141 check_call(cmd)
142
143 def install(self, source, branch="master", dest=None, depth=None):
144@@ -62,8 +61,6 @@
145 else:
146 dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched",
147 branch_name)
148- if not os.path.exists(dest_dir):
149- mkdir(dest_dir, perms=0o755)
150 try:
151 self.clone(source, dest_dir, branch, depth)
152 except OSError as e:
153
154=== added file 'charmhelpers/payload/archive.py'
155--- charmhelpers/payload/archive.py 1970-01-01 00:00:00 +0000
156+++ charmhelpers/payload/archive.py 2016-01-11 14:23:26 +0000
157@@ -0,0 +1,73 @@
158+# Copyright 2014-2015 Canonical Limited.
159+#
160+# This file is part of charm-helpers.
161+#
162+# charm-helpers is free software: you can redistribute it and/or modify
163+# it under the terms of the GNU Lesser General Public License version 3 as
164+# published by the Free Software Foundation.
165+#
166+# charm-helpers is distributed in the hope that it will be useful,
167+# but WITHOUT ANY WARRANTY; without even the implied warranty of
168+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
169+# GNU Lesser General Public License for more details.
170+#
171+# You should have received a copy of the GNU Lesser General Public License
172+# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
173+
174+import os
175+import tarfile
176+import zipfile
177+from charmhelpers.core import (
178+ host,
179+ hookenv,
180+)
181+
182+
183+class ArchiveError(Exception):
184+ pass
185+
186+
187+def get_archive_handler(archive_name):
188+ if os.path.isfile(archive_name):
189+ if tarfile.is_tarfile(archive_name):
190+ return extract_tarfile
191+ elif zipfile.is_zipfile(archive_name):
192+ return extract_zipfile
193+ else:
194+ # look at the file name
195+ for ext in ('.tar', '.tar.gz', '.tgz', 'tar.bz2', '.tbz2', '.tbz'):
196+ if archive_name.endswith(ext):
197+ return extract_tarfile
198+ for ext in ('.zip', '.jar'):
199+ if archive_name.endswith(ext):
200+ return extract_zipfile
201+
202+
203+def archive_dest_default(archive_name):
204+ archive_file = os.path.basename(archive_name)
205+ return os.path.join(hookenv.charm_dir(), "archives", archive_file)
206+
207+
208+def extract(archive_name, destpath=None):
209+ handler = get_archive_handler(archive_name)
210+ if handler:
211+ if not destpath:
212+ destpath = archive_dest_default(archive_name)
213+ if not os.path.isdir(destpath):
214+ host.mkdir(destpath)
215+ handler(archive_name, destpath)
216+ return destpath
217+ else:
218+ raise ArchiveError("No handler for archive")
219+
220+
221+def extract_tarfile(archive_name, destpath):
222+ "Unpack a tar archive, optionally compressed"
223+ archive = tarfile.open(archive_name)
224+ archive.extractall(destpath)
225+
226+
227+def extract_zipfile(archive_name, destpath):
228+ "Unpack a zip file"
229+ archive = zipfile.ZipFile(archive_name)
230+ archive.extractall(destpath)
231
232=== modified file 'unit_tests/test_keystone_contexts.py'
233--- unit_tests/test_keystone_contexts.py 2015-12-07 14:04:38 +0000
234+++ unit_tests/test_keystone_contexts.py 2016-01-11 14:23:26 +0000
235@@ -91,10 +91,11 @@
236 @patch('charmhelpers.contrib.openstack.context.related_units')
237 @patch('charmhelpers.contrib.openstack.context.relation_get')
238 @patch('charmhelpers.contrib.openstack.context.log')
239+ @patch('charmhelpers.contrib.openstack.context.kv')
240 @patch('__builtin__.open')
241 def test_haproxy_context_service_enabled(
242- self, mock_open, mock_log, mock_relation_get, mock_related_units,
243- mock_unit_get, mock_relation_ids, mock_config,
244+ self, mock_open, mock_kv, mock_log, mock_relation_get,
245+ mock_related_units, mock_unit_get, mock_relation_ids, mock_config,
246 mock_get_address_in_network, mock_get_netmask_for_address,
247 mock_api_port):
248 os.environ['JUJU_UNIT_NAME'] = 'keystone'
249@@ -108,6 +109,7 @@
250 mock_get_netmask_for_address.return_value = '255.255.255.0'
251 self.determine_apache_port.return_value = '34'
252 mock_api_port.return_value = '12'
253+ mock_kv().get.return_value = 'abcdefghijklmnopqrstuvwxyz123456'
254
255 ctxt = context.HAProxyContext()
256
257@@ -118,7 +120,8 @@
258 'public_port': '12'},
259 'local_host': '127.0.0.1',
260 'haproxy_host': '0.0.0.0',
261- 'stat_port': ':8888',
262+ 'stat_port': '8888',
263+ 'stat_password': 'abcdefghijklmnopqrstuvwxyz123456',
264 'service_ports': {'admin-port': ['12', '34'],
265 'public-port': ['12', '34']},
266 'default_backend': '1.2.3.4',

Subscribers

People subscribed via source and target branches