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