Merge lp:~corey.bryant/charms/trusty/nova-cloud-controller/git-1531612 into lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next
- Trusty Tahr (14.04)
- git-1531612
- Merge into next
Proposed by
Corey Bryant
Status: | Merged |
---|---|
Merged at revision: | 208 |
Proposed branch: | lp:~corey.bryant/charms/trusty/nova-cloud-controller/git-1531612 |
Merge into: | lp:~openstack-charmers-archive/charms/trusty/nova-cloud-controller/next |
Diff against target: |
246 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/nova-cloud-controller/git-1531612 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Liam Young (community) | Approve | ||
Review via email: mp+281962@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : | # |
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_unit_test #15699 nova-cloud-
UNIT OK: passed
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote : | # |
charm_amulet_test #8581 nova-cloud-
AMULET OK: passed
Build: http://
Revision history for this message
Liam Young (gnuoy) wrote : | # |
Approve
Revision history for this message
Liam Young (gnuoy) : | # |
review:
Approve
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:10:41 +0000 | |||
3 | +++ charm-helpers-hooks.yaml 2016-01-08 03:12:58 +0000 | |||
4 | @@ -8,7 +8,7 @@ | |||
5 | 8 | - contrib.storage | 8 | - contrib.storage |
6 | 9 | - contrib.peerstorage | 9 | - contrib.peerstorage |
7 | 10 | - contrib.hahelpers | 10 | - contrib.hahelpers |
9 | 11 | - payload.execd | 11 | - payload |
10 | 12 | - contrib.network.ip | 12 | - contrib.network.ip |
11 | 13 | - contrib.peerstorage | 13 | - contrib.peerstorage |
12 | 14 | - contrib.python.packages | 14 | - contrib.python.packages |
13 | 15 | 15 | ||
14 | === modified file 'hooks/charmhelpers/contrib/openstack/context.py' | |||
15 | --- hooks/charmhelpers/contrib/openstack/context.py 2016-01-04 21:29:34 +0000 | |||
16 | +++ hooks/charmhelpers/contrib/openstack/context.py 2016-01-08 03:12:58 +0000 | |||
17 | @@ -57,6 +57,7 @@ | |||
18 | 57 | get_nic_hwaddr, | 57 | get_nic_hwaddr, |
19 | 58 | mkdir, | 58 | mkdir, |
20 | 59 | write_file, | 59 | write_file, |
21 | 60 | pwgen, | ||
22 | 60 | ) | 61 | ) |
23 | 61 | from charmhelpers.contrib.hahelpers.cluster import ( | 62 | from charmhelpers.contrib.hahelpers.cluster import ( |
24 | 62 | determine_apache_port, | 63 | determine_apache_port, |
25 | @@ -87,6 +88,8 @@ | |||
26 | 87 | is_bridge_member, | 88 | is_bridge_member, |
27 | 88 | ) | 89 | ) |
28 | 89 | from charmhelpers.contrib.openstack.utils import get_host_ip | 90 | from charmhelpers.contrib.openstack.utils import get_host_ip |
29 | 91 | from charmhelpers.core.unitdata import kv | ||
30 | 92 | |||
31 | 90 | CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt' | 93 | CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt' |
32 | 91 | ADDRESS_TYPES = ['admin', 'internal', 'public'] | 94 | ADDRESS_TYPES = ['admin', 'internal', 'public'] |
33 | 92 | 95 | ||
34 | @@ -636,11 +639,18 @@ | |||
35 | 636 | ctxt['ipv6'] = True | 639 | ctxt['ipv6'] = True |
36 | 637 | ctxt['local_host'] = 'ip6-localhost' | 640 | ctxt['local_host'] = 'ip6-localhost' |
37 | 638 | ctxt['haproxy_host'] = '::' | 641 | ctxt['haproxy_host'] = '::' |
38 | 639 | ctxt['stat_port'] = ':::8888' | ||
39 | 640 | else: | 642 | else: |
40 | 641 | ctxt['local_host'] = '127.0.0.1' | 643 | ctxt['local_host'] = '127.0.0.1' |
41 | 642 | ctxt['haproxy_host'] = '0.0.0.0' | 644 | ctxt['haproxy_host'] = '0.0.0.0' |
43 | 643 | ctxt['stat_port'] = ':8888' | 645 | |
44 | 646 | ctxt['stat_port'] = '8888' | ||
45 | 647 | |||
46 | 648 | db = kv() | ||
47 | 649 | ctxt['stat_password'] = db.get('stat-password') | ||
48 | 650 | if not ctxt['stat_password']: | ||
49 | 651 | ctxt['stat_password'] = db.set('stat-password', | ||
50 | 652 | pwgen(32)) | ||
51 | 653 | db.flush() | ||
52 | 644 | 654 | ||
53 | 645 | for frontend in cluster_hosts: | 655 | for frontend in cluster_hosts: |
54 | 646 | if (len(cluster_hosts[frontend]['backends']) > 1 or | 656 | if (len(cluster_hosts[frontend]['backends']) > 1 or |
55 | 647 | 657 | ||
56 | === modified file 'hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg' | |||
57 | --- hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2015-12-07 22:44:00 +0000 | |||
58 | +++ hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2016-01-08 03:12:58 +0000 | |||
59 | @@ -33,13 +33,14 @@ | |||
60 | 33 | timeout server 30000 | 33 | timeout server 30000 |
61 | 34 | {%- endif %} | 34 | {%- endif %} |
62 | 35 | 35 | ||
64 | 36 | listen stats {{ stat_port }} | 36 | listen stats |
65 | 37 | bind {{ local_host }}:{{ stat_port }} | ||
66 | 37 | mode http | 38 | mode http |
67 | 38 | stats enable | 39 | stats enable |
68 | 39 | stats hide-version | 40 | stats hide-version |
69 | 40 | stats realm Haproxy\ Statistics | 41 | stats realm Haproxy\ Statistics |
70 | 41 | stats uri / | 42 | stats uri / |
72 | 42 | stats auth admin:password | 43 | stats auth admin:{{ stat_password }} |
73 | 43 | 44 | ||
74 | 44 | {% if frontends -%} | 45 | {% if frontends -%} |
75 | 45 | {% for service, ports in service_ports.items() -%} | 46 | {% for service, ports in service_ports.items() -%} |
76 | 46 | 47 | ||
77 | === modified file 'hooks/charmhelpers/contrib/openstack/utils.py' | |||
78 | --- hooks/charmhelpers/contrib/openstack/utils.py 2016-01-05 11:43:58 +0000 | |||
79 | +++ hooks/charmhelpers/contrib/openstack/utils.py 2016-01-08 03:12:58 +0000 | |||
80 | @@ -593,7 +593,7 @@ | |||
81 | 593 | return yaml.load(projects_yaml) | 593 | return yaml.load(projects_yaml) |
82 | 594 | 594 | ||
83 | 595 | 595 | ||
85 | 596 | def git_clone_and_install(projects_yaml, core_project, depth=1): | 596 | def git_clone_and_install(projects_yaml, core_project): |
86 | 597 | """ | 597 | """ |
87 | 598 | Clone/install all specified OpenStack repositories. | 598 | Clone/install all specified OpenStack repositories. |
88 | 599 | 599 | ||
89 | @@ -643,6 +643,9 @@ | |||
90 | 643 | for p in projects['repositories']: | 643 | for p in projects['repositories']: |
91 | 644 | repo = p['repository'] | 644 | repo = p['repository'] |
92 | 645 | branch = p['branch'] | 645 | branch = p['branch'] |
93 | 646 | depth = '1' | ||
94 | 647 | if 'depth' in p.keys(): | ||
95 | 648 | depth = p['depth'] | ||
96 | 646 | if p['name'] == 'requirements': | 649 | if p['name'] == 'requirements': |
97 | 647 | repo_dir = _git_clone_and_install_single(repo, branch, depth, | 650 | repo_dir = _git_clone_and_install_single(repo, branch, depth, |
98 | 648 | parent_dir, http_proxy, | 651 | parent_dir, http_proxy, |
99 | @@ -687,19 +690,13 @@ | |||
100 | 687 | """ | 690 | """ |
101 | 688 | Clone and install a single git repository. | 691 | Clone and install a single git repository. |
102 | 689 | """ | 692 | """ |
103 | 690 | dest_dir = os.path.join(parent_dir, os.path.basename(repo)) | ||
104 | 691 | |||
105 | 692 | if not os.path.exists(parent_dir): | 693 | if not os.path.exists(parent_dir): |
106 | 693 | juju_log('Directory already exists at {}. ' | 694 | juju_log('Directory already exists at {}. ' |
107 | 694 | 'No need to create directory.'.format(parent_dir)) | 695 | 'No need to create directory.'.format(parent_dir)) |
108 | 695 | os.mkdir(parent_dir) | 696 | os.mkdir(parent_dir) |
109 | 696 | 697 | ||
116 | 697 | if not os.path.exists(dest_dir): | 698 | juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch)) |
117 | 698 | juju_log('Cloning git repo: {}, branch: {}'.format(repo, branch)) | 699 | repo_dir = install_remote(repo, dest=parent_dir, branch=branch, depth=depth) |
112 | 699 | repo_dir = install_remote(repo, dest=parent_dir, branch=branch, | ||
113 | 700 | depth=depth) | ||
114 | 701 | else: | ||
115 | 702 | repo_dir = dest_dir | ||
118 | 703 | 700 | ||
119 | 704 | venv = os.path.join(parent_dir, 'venv') | 701 | venv = os.path.join(parent_dir, 'venv') |
120 | 705 | 702 | ||
121 | 706 | 703 | ||
122 | === modified file 'hooks/charmhelpers/core/host.py' | |||
123 | --- hooks/charmhelpers/core/host.py 2016-01-04 21:29:34 +0000 | |||
124 | +++ hooks/charmhelpers/core/host.py 2016-01-08 03:12:58 +0000 | |||
125 | @@ -72,7 +72,9 @@ | |||
126 | 72 | stopped = service_stop(service_name) | 72 | stopped = service_stop(service_name) |
127 | 73 | upstart_file = os.path.join(init_dir, "{}.conf".format(service_name)) | 73 | upstart_file = os.path.join(init_dir, "{}.conf".format(service_name)) |
128 | 74 | sysv_file = os.path.join(initd_dir, service_name) | 74 | sysv_file = os.path.join(initd_dir, service_name) |
130 | 75 | if os.path.exists(upstart_file): | 75 | if init_is_systemd(): |
131 | 76 | service('disable', service_name) | ||
132 | 77 | elif os.path.exists(upstart_file): | ||
133 | 76 | override_path = os.path.join( | 78 | override_path = os.path.join( |
134 | 77 | init_dir, '{}.override'.format(service_name)) | 79 | init_dir, '{}.override'.format(service_name)) |
135 | 78 | with open(override_path, 'w') as fh: | 80 | with open(override_path, 'w') as fh: |
136 | @@ -80,9 +82,9 @@ | |||
137 | 80 | elif os.path.exists(sysv_file): | 82 | elif os.path.exists(sysv_file): |
138 | 81 | subprocess.check_call(["update-rc.d", service_name, "disable"]) | 83 | subprocess.check_call(["update-rc.d", service_name, "disable"]) |
139 | 82 | else: | 84 | else: |
140 | 83 | # XXX: Support SystemD too | ||
141 | 84 | raise ValueError( | 85 | raise ValueError( |
143 | 85 | "Unable to detect {0} as either Upstart {1} or SysV {2}".format( | 86 | "Unable to detect {0} as SystemD, Upstart {1} or" |
144 | 87 | " SysV {2}".format( | ||
145 | 86 | service_name, upstart_file, sysv_file)) | 88 | service_name, upstart_file, sysv_file)) |
146 | 87 | return stopped | 89 | return stopped |
147 | 88 | 90 | ||
148 | @@ -94,7 +96,9 @@ | |||
149 | 94 | Reenable starting again at boot. Start the service""" | 96 | Reenable starting again at boot. Start the service""" |
150 | 95 | upstart_file = os.path.join(init_dir, "{}.conf".format(service_name)) | 97 | upstart_file = os.path.join(init_dir, "{}.conf".format(service_name)) |
151 | 96 | sysv_file = os.path.join(initd_dir, service_name) | 98 | sysv_file = os.path.join(initd_dir, service_name) |
153 | 97 | if os.path.exists(upstart_file): | 99 | if init_is_systemd(): |
154 | 100 | service('enable', service_name) | ||
155 | 101 | elif os.path.exists(upstart_file): | ||
156 | 98 | override_path = os.path.join( | 102 | override_path = os.path.join( |
157 | 99 | init_dir, '{}.override'.format(service_name)) | 103 | init_dir, '{}.override'.format(service_name)) |
158 | 100 | if os.path.exists(override_path): | 104 | if os.path.exists(override_path): |
159 | @@ -102,9 +106,9 @@ | |||
160 | 102 | elif os.path.exists(sysv_file): | 106 | elif os.path.exists(sysv_file): |
161 | 103 | subprocess.check_call(["update-rc.d", service_name, "enable"]) | 107 | subprocess.check_call(["update-rc.d", service_name, "enable"]) |
162 | 104 | else: | 108 | else: |
163 | 105 | # XXX: Support SystemD too | ||
164 | 106 | raise ValueError( | 109 | raise ValueError( |
166 | 107 | "Unable to detect {0} as either Upstart {1} or SysV {2}".format( | 110 | "Unable to detect {0} as SystemD, Upstart {1} or" |
167 | 111 | " SysV {2}".format( | ||
168 | 108 | service_name, upstart_file, sysv_file)) | 112 | service_name, upstart_file, sysv_file)) |
169 | 109 | 113 | ||
170 | 110 | started = service_running(service_name) | 114 | started = service_running(service_name) |
171 | @@ -115,23 +119,29 @@ | |||
172 | 115 | 119 | ||
173 | 116 | def service(action, service_name): | 120 | def service(action, service_name): |
174 | 117 | """Control a system service""" | 121 | """Control a system service""" |
176 | 118 | cmd = ['service', service_name, action] | 122 | if init_is_systemd(): |
177 | 123 | cmd = ['systemctl', action, service_name] | ||
178 | 124 | else: | ||
179 | 125 | cmd = ['service', service_name, action] | ||
180 | 119 | return subprocess.call(cmd) == 0 | 126 | return subprocess.call(cmd) == 0 |
181 | 120 | 127 | ||
182 | 121 | 128 | ||
184 | 122 | def service_running(service): | 129 | def service_running(service_name): |
185 | 123 | """Determine whether a system service is running""" | 130 | """Determine whether a system service is running""" |
192 | 124 | try: | 131 | if init_is_systemd(): |
193 | 125 | output = subprocess.check_output( | 132 | return service('is-active', service_name) |
188 | 126 | ['service', service, 'status'], | ||
189 | 127 | stderr=subprocess.STDOUT).decode('UTF-8') | ||
190 | 128 | except subprocess.CalledProcessError: | ||
191 | 129 | return False | ||
194 | 130 | else: | 133 | else: |
198 | 131 | if ("start/running" in output or "is running" in output): | 134 | try: |
199 | 132 | return True | 135 | output = subprocess.check_output( |
200 | 133 | else: | 136 | ['service', service_name, 'status'], |
201 | 137 | stderr=subprocess.STDOUT).decode('UTF-8') | ||
202 | 138 | except subprocess.CalledProcessError: | ||
203 | 134 | return False | 139 | return False |
204 | 140 | else: | ||
205 | 141 | if ("start/running" in output or "is running" in output): | ||
206 | 142 | return True | ||
207 | 143 | else: | ||
208 | 144 | return False | ||
209 | 135 | 145 | ||
210 | 136 | 146 | ||
211 | 137 | def service_available(service_name): | 147 | def service_available(service_name): |
212 | @@ -146,6 +156,13 @@ | |||
213 | 146 | return True | 156 | return True |
214 | 147 | 157 | ||
215 | 148 | 158 | ||
216 | 159 | SYSTEMD_SYSTEM = '/run/systemd/system' | ||
217 | 160 | |||
218 | 161 | |||
219 | 162 | def init_is_systemd(): | ||
220 | 163 | return os.path.isdir(SYSTEMD_SYSTEM) | ||
221 | 164 | |||
222 | 165 | |||
223 | 149 | def adduser(username, password=None, shell='/bin/bash', system_user=False, | 166 | def adduser(username, password=None, shell='/bin/bash', system_user=False, |
224 | 150 | primary_group=None, secondary_groups=None): | 167 | primary_group=None, secondary_groups=None): |
225 | 151 | """ | 168 | """ |
226 | 152 | 169 | ||
227 | === modified file 'hooks/charmhelpers/fetch/giturl.py' | |||
228 | --- hooks/charmhelpers/fetch/giturl.py 2016-01-04 21:29:34 +0000 | |||
229 | +++ hooks/charmhelpers/fetch/giturl.py 2016-01-08 03:12:58 +0000 | |||
230 | @@ -22,7 +22,6 @@ | |||
231 | 22 | filter_installed_packages, | 22 | filter_installed_packages, |
232 | 23 | apt_install, | 23 | apt_install, |
233 | 24 | ) | 24 | ) |
234 | 25 | from charmhelpers.core.host import mkdir | ||
235 | 26 | 25 | ||
236 | 27 | if filter_installed_packages(['git']) != []: | 26 | if filter_installed_packages(['git']) != []: |
237 | 28 | apt_install(['git']) | 27 | apt_install(['git']) |
238 | @@ -62,8 +61,6 @@ | |||
239 | 62 | else: | 61 | else: |
240 | 63 | dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched", | 62 | dest_dir = os.path.join(os.environ.get('CHARM_DIR'), "fetched", |
241 | 64 | branch_name) | 63 | branch_name) |
242 | 65 | if not os.path.exists(dest_dir): | ||
243 | 66 | mkdir(dest_dir, perms=0o755) | ||
244 | 67 | try: | 64 | try: |
245 | 68 | self.clone(source, dest_dir, branch, depth) | 65 | self.clone(source, dest_dir, branch, depth) |
246 | 69 | except OSError as e: | 66 | except OSError as e: |
charm_lint_check #16810 nova-cloud- controller- next for corey.bryant mp281962
LINT OK: passed
Build: http:// 10.245. 162.77: 8080/job/ charm_lint_ check/16810/