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

Proposed by Corey Bryant
Status: Merged
Merged at revision: 99
Proposed branch: lp:~corey.bryant/charms/trusty/openstack-dashboard/git-1531612
Merge into: lp:~openstack-charmers-archive/charms/trusty/openstack-dashboard/next
Diff against target: 244 lines (+56/-34)
6 files modified
charm-helpers-hooks.yaml (+1/-1)
hooks/charmhelpers/contrib/openstack/context.py (+12/-2)
hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg (+3/-2)
hooks/charmhelpers/contrib/openstack/utils.py (+6/-9)
hooks/charmhelpers/core/host.py (+34/-17)
hooks/charmhelpers/fetch/giturl.py (+0/-3)
To merge this branch: bzr merge lp:~corey.bryant/charms/trusty/openstack-dashboard/git-1531612
Reviewer Review Type Date Requested Status
OpenStack Charmers Pending
Review via email: mp+281999@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 #16832 openstack-dashboard-next for corey.bryant mp281999
    LINT OK: passed

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

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

charm_unit_test #15718 openstack-dashboard-next for corey.bryant mp281999
    UNIT OK: passed

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

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

charm_amulet_test #8603 openstack-dashboard-next for corey.bryant mp281999
    AMULET OK: passed

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

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-07-31 13:11:17 +0000
3+++ charm-helpers-hooks.yaml 2016-01-08 13:52:40 +0000
4@@ -10,5 +10,5 @@
5 - contrib.storage
6 - contrib.network.ip
7 - contrib.python.packages
8- - payload.execd
9+ - payload
10 - contrib.charmsupport
11
12=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
13--- hooks/charmhelpers/contrib/openstack/context.py 2016-01-04 21:30:55 +0000
14+++ hooks/charmhelpers/contrib/openstack/context.py 2016-01-08 13:52:40 +0000
15@@ -57,6 +57,7 @@
16 get_nic_hwaddr,
17 mkdir,
18 write_file,
19+ pwgen,
20 )
21 from charmhelpers.contrib.hahelpers.cluster import (
22 determine_apache_port,
23@@ -87,6 +88,8 @@
24 is_bridge_member,
25 )
26 from charmhelpers.contrib.openstack.utils import get_host_ip
27+from charmhelpers.core.unitdata import kv
28+
29 CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
30 ADDRESS_TYPES = ['admin', 'internal', 'public']
31
32@@ -636,11 +639,18 @@
33 ctxt['ipv6'] = True
34 ctxt['local_host'] = 'ip6-localhost'
35 ctxt['haproxy_host'] = '::'
36- ctxt['stat_port'] = ':::8888'
37 else:
38 ctxt['local_host'] = '127.0.0.1'
39 ctxt['haproxy_host'] = '0.0.0.0'
40- ctxt['stat_port'] = ':8888'
41+
42+ ctxt['stat_port'] = '8888'
43+
44+ db = kv()
45+ ctxt['stat_password'] = db.get('stat-password')
46+ if not ctxt['stat_password']:
47+ ctxt['stat_password'] = db.set('stat-password',
48+ pwgen(32))
49+ db.flush()
50
51 for frontend in cluster_hosts:
52 if (len(cluster_hosts[frontend]['backends']) > 1 or
53
54=== modified file 'hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg'
55--- hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2015-12-07 23:18:18 +0000
56+++ hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2016-01-08 13:52:40 +0000
57@@ -33,13 +33,14 @@
58 timeout server 30000
59 {%- endif %}
60
61-listen stats {{ stat_port }}
62+listen stats
63+ bind {{ local_host }}:{{ stat_port }}
64 mode http
65 stats enable
66 stats hide-version
67 stats realm Haproxy\ Statistics
68 stats uri /
69- stats auth admin:password
70+ stats auth admin:{{ stat_password }}
71
72 {% if frontends -%}
73 {% for service, ports in service_ports.items() -%}
74
75=== modified file 'hooks/charmhelpers/contrib/openstack/utils.py'
76--- hooks/charmhelpers/contrib/openstack/utils.py 2016-01-05 11:52:32 +0000
77+++ hooks/charmhelpers/contrib/openstack/utils.py 2016-01-08 13:52:40 +0000
78@@ -593,7 +593,7 @@
79 return yaml.load(projects_yaml)
80
81
82-def git_clone_and_install(projects_yaml, core_project, depth=1):
83+def git_clone_and_install(projects_yaml, core_project):
84 """
85 Clone/install all specified OpenStack repositories.
86
87@@ -643,6 +643,9 @@
88 for p in projects['repositories']:
89 repo = p['repository']
90 branch = p['branch']
91+ depth = '1'
92+ if 'depth' in p.keys():
93+ depth = p['depth']
94 if p['name'] == 'requirements':
95 repo_dir = _git_clone_and_install_single(repo, branch, depth,
96 parent_dir, http_proxy,
97@@ -687,19 +690,13 @@
98 """
99 Clone and install a single git repository.
100 """
101- dest_dir = os.path.join(parent_dir, os.path.basename(repo))
102-
103 if not os.path.exists(parent_dir):
104 juju_log('Directory already exists at {}. '
105 'No need to create directory.'.format(parent_dir))
106 os.mkdir(parent_dir)
107
108- if not os.path.exists(dest_dir):
109- juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
110- repo_dir = install_remote(repo, dest=parent_dir, branch=branch,
111- depth=depth)
112- else:
113- repo_dir = dest_dir
114+ juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch))
115+ repo_dir = install_remote(repo, dest=parent_dir, branch=branch, depth=depth)
116
117 venv = os.path.join(parent_dir, 'venv')
118
119
120=== modified file 'hooks/charmhelpers/core/host.py'
121--- hooks/charmhelpers/core/host.py 2016-01-04 21:30:55 +0000
122+++ hooks/charmhelpers/core/host.py 2016-01-08 13:52:40 +0000
123@@ -72,7 +72,9 @@
124 stopped = service_stop(service_name)
125 upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
126 sysv_file = os.path.join(initd_dir, service_name)
127- if os.path.exists(upstart_file):
128+ if init_is_systemd():
129+ service('disable', service_name)
130+ elif os.path.exists(upstart_file):
131 override_path = os.path.join(
132 init_dir, '{}.override'.format(service_name))
133 with open(override_path, 'w') as fh:
134@@ -80,9 +82,9 @@
135 elif os.path.exists(sysv_file):
136 subprocess.check_call(["update-rc.d", service_name, "disable"])
137 else:
138- # XXX: Support SystemD too
139 raise ValueError(
140- "Unable to detect {0} as either Upstart {1} or SysV {2}".format(
141+ "Unable to detect {0} as SystemD, Upstart {1} or"
142+ " SysV {2}".format(
143 service_name, upstart_file, sysv_file))
144 return stopped
145
146@@ -94,7 +96,9 @@
147 Reenable starting again at boot. Start the service"""
148 upstart_file = os.path.join(init_dir, "{}.conf".format(service_name))
149 sysv_file = os.path.join(initd_dir, service_name)
150- if os.path.exists(upstart_file):
151+ if init_is_systemd():
152+ service('enable', service_name)
153+ elif os.path.exists(upstart_file):
154 override_path = os.path.join(
155 init_dir, '{}.override'.format(service_name))
156 if os.path.exists(override_path):
157@@ -102,9 +106,9 @@
158 elif os.path.exists(sysv_file):
159 subprocess.check_call(["update-rc.d", service_name, "enable"])
160 else:
161- # XXX: Support SystemD too
162 raise ValueError(
163- "Unable to detect {0} as either Upstart {1} or SysV {2}".format(
164+ "Unable to detect {0} as SystemD, Upstart {1} or"
165+ " SysV {2}".format(
166 service_name, upstart_file, sysv_file))
167
168 started = service_running(service_name)
169@@ -115,23 +119,29 @@
170
171 def service(action, service_name):
172 """Control a system service"""
173- cmd = ['service', service_name, action]
174+ if init_is_systemd():
175+ cmd = ['systemctl', action, service_name]
176+ else:
177+ cmd = ['service', service_name, action]
178 return subprocess.call(cmd) == 0
179
180
181-def service_running(service):
182+def service_running(service_name):
183 """Determine whether a system service is running"""
184- try:
185- output = subprocess.check_output(
186- ['service', service, 'status'],
187- stderr=subprocess.STDOUT).decode('UTF-8')
188- except subprocess.CalledProcessError:
189- return False
190+ if init_is_systemd():
191+ return service('is-active', service_name)
192 else:
193- if ("start/running" in output or "is running" in output):
194- return True
195- else:
196+ try:
197+ output = subprocess.check_output(
198+ ['service', service_name, 'status'],
199+ stderr=subprocess.STDOUT).decode('UTF-8')
200+ except subprocess.CalledProcessError:
201 return False
202+ else:
203+ if ("start/running" in output or "is running" in output):
204+ return True
205+ else:
206+ return False
207
208
209 def service_available(service_name):
210@@ -146,6 +156,13 @@
211 return True
212
213
214+SYSTEMD_SYSTEM = '/run/systemd/system'
215+
216+
217+def init_is_systemd():
218+ return os.path.isdir(SYSTEMD_SYSTEM)
219+
220+
221 def adduser(username, password=None, shell='/bin/bash', system_user=False,
222 primary_group=None, secondary_groups=None):
223 """
224
225=== modified file 'hooks/charmhelpers/fetch/giturl.py'
226--- hooks/charmhelpers/fetch/giturl.py 2016-01-04 21:30:55 +0000
227+++ hooks/charmhelpers/fetch/giturl.py 2016-01-08 13:52:40 +0000
228@@ -22,7 +22,6 @@
229 filter_installed_packages,
230 apt_install,
231 )
232-from charmhelpers.core.host import mkdir
233
234 if filter_installed_packages(['git']) != []:
235 apt_install(['git'])
236@@ -62,8 +61,6 @@
237 else:
238 dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched",
239 branch_name)
240- if not os.path.exists(dest_dir):
241- mkdir(dest_dir, perms=0o755)
242 try:
243 self.clone(source, dest_dir, branch, depth)
244 except OSError as e:

Subscribers

People subscribed via source and target branches