Merge lp:~james-page/charms/trusty/swift-proxy/network-splits-https into lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next

Proposed by James Page
Status: Merged
Merged at revision: 62
Proposed branch: lp:~james-page/charms/trusty/swift-proxy/network-splits-https
Merge into: lp:~openstack-charmers-archive/charms/trusty/swift-proxy/next
Diff against target: 590 lines (+180/-178)
10 files modified
config.yaml (+0/-22)
hooks/charmhelpers/contrib/network/ip.py (+2/-0)
hooks/charmhelpers/contrib/openstack/amulet/deployment.py (+30/-33)
hooks/charmhelpers/contrib/openstack/context.py (+68/-32)
hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg (+15/-11)
hooks/swift_context.py (+1/-25)
hooks/swift_hooks.py (+18/-10)
tests/basic_deployment.py (+1/-2)
tests/charmhelpers/contrib/amulet/deployment.py (+15/-10)
tests/charmhelpers/contrib/openstack/amulet/deployment.py (+30/-33)
To merge this branch: bzr merge lp:~james-page/charms/trusty/swift-proxy/network-splits-https
Reviewer Review Type Date Requested Status
Liam Young (community) Needs Fixing
Review via email: mp+236903@code.launchpad.net

Description of the change

Add support for HTTPS+HA with multiple network endpoints

To post a comment you must log in.
70. By James Page

Resync

71. By James Page

Drop use-https and associate configuration options

Revision history for this message
Liam Young (gnuoy) wrote :

hooks/swift_context.py:10:1: F401 'CA_CERT_PATH' imported but unused
hooks/swift_context.py:31:1: F401 'get_ca_cert' imported but unused
hooks/swift_context.py:31:1: F401 'get_cert' imported but unused
hooks/swift_context.py:36:1: F401 'b64decode' imported but unused
Makefile:5: recipe for target 'lint' failed
make: *** [lint] Error 1

+1 once ^ are fixed

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'config.yaml'
--- config.yaml 2014-09-25 16:43:34 +0000
+++ config.yaml 2014-10-02 20:31:34 +0000
@@ -63,28 +63,6 @@
63 type: string63 type: string
64 description: |64 description: |
65 Base64 encoded SSL key to use with certificate specified as ssl_cert.65 Base64 encoded SSL key to use with certificate specified as ssl_cert.
66 # Locally generated CA Cert info (only use without keystone)
67 # These options are deprecated and will be removed sometime
68 use-https:
69 default: "yes"
70 type: string
71 description: Whether to listen on HTTPS
72 country:
73 default: US
74 type: string
75 description: Country
76 state:
77 default: ST
78 type: string
79 description: State
80 locale:
81 default: City
82 type: string
83 description: Locale
84 common-name:
85 default: CN
86 type: string
87 description: Common Name
88 # General Swift Proxy configuration66 # General Swift Proxy configuration
89 bind-port:67 bind-port:
90 default: 808068 default: 8080
9169
=== modified file 'hooks/charmhelpers/contrib/network/ip.py'
--- hooks/charmhelpers/contrib/network/ip.py 2014-09-30 12:57:13 +0000
+++ hooks/charmhelpers/contrib/network/ip.py 2014-10-02 20:31:34 +0000
@@ -57,6 +57,8 @@
57 else:57 else:
58 if fatal:58 if fatal:
59 not_found_error_out()59 not_found_error_out()
60 else:
61 return None
6062
61 _validate_cidr(network)63 _validate_cidr(network)
62 network = netaddr.IPNetwork(network)64 network = netaddr.IPNetwork(network)
6365
=== modified file 'hooks/charmhelpers/contrib/openstack/amulet/deployment.py'
--- hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2014-09-26 12:41:28 +0000
+++ hooks/charmhelpers/contrib/openstack/amulet/deployment.py 2014-10-02 20:31:34 +0000
@@ -1,6 +1,3 @@
1from bzrlib.branch import Branch
2import os
3import re
4from charmhelpers.contrib.amulet.deployment import (1from charmhelpers.contrib.amulet.deployment import (
5 AmuletDeployment2 AmuletDeployment
6)3)
@@ -13,62 +10,62 @@
13 that is specifically for use by OpenStack charms.10 that is specifically for use by OpenStack charms.
14 """11 """
1512
16 def __init__(self, series=None, openstack=None, source=None):13 def __init__(self, series=None, openstack=None, source=None, stable=True):
17 """Initialize the deployment environment."""14 """Initialize the deployment environment."""
18 super(OpenStackAmuletDeployment, self).__init__(series)15 super(OpenStackAmuletDeployment, self).__init__(series)
19 self.openstack = openstack16 self.openstack = openstack
20 self.source = source17 self.source = source
2118 self.stable = stable
22 def _is_dev_branch(self):19 # Note(coreycb): this needs to be changed when new next branches come
23 """Determine if branch being tested is a dev (i.e. next) branch."""20 # out.
24 branch = Branch.open(os.getcwd())21 self.current_next = "trusty"
25 parent = branch.get_parent()
26 pattern = re.compile("^.*/next/$")
27 if (pattern.match(parent)):
28 return True
29 else:
30 return False
3122
32 def _determine_branch_locations(self, other_services):23 def _determine_branch_locations(self, other_services):
33 """Determine the branch locations for the other services.24 """Determine the branch locations for the other services.
3425
35 If the branch being tested is a dev branch, then determine the26 Determine if the local branch being tested is derived from its
36 development branch locations for the other services. Otherwise,27 stable or next (dev) branch, and based on this, use the corresonding
37 the default charm store branches will be used."""28 stable or next branches for the other_services."""
38 name = 029 base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
39 if self._is_dev_branch():30
40 updated_services = []31 if self.stable:
41 for svc in other_services:32 for svc in other_services:
42 if svc[name] in ['mysql', 'mongodb', 'rabbitmq-server']:33 temp = 'lp:charms/{}'
43 location = 'lp:charms/{}'.format(svc[name])34 svc['location'] = temp.format(svc['name'])
35 else:
36 for svc in other_services:
37 if svc['name'] in base_charms:
38 temp = 'lp:charms/{}'
39 svc['location'] = temp.format(svc['name'])
44 else:40 else:
45 temp = 'lp:~openstack-charmers/charms/trusty/{}/next'41 temp = 'lp:~openstack-charmers/charms/{}/{}/next'
46 location = temp.format(svc[name])42 svc['location'] = temp.format(self.current_next,
47 updated_services.append(svc + (location,))43 svc['name'])
48 other_services = updated_services
49 return other_services44 return other_services
5045
51 def _add_services(self, this_service, other_services):46 def _add_services(self, this_service, other_services):
52 """Add services to the deployment and set openstack-origin/source."""47 """Add services to the deployment and set openstack-origin/source."""
53 name = 0
54 other_services = self._determine_branch_locations(other_services)48 other_services = self._determine_branch_locations(other_services)
49
55 super(OpenStackAmuletDeployment, self)._add_services(this_service,50 super(OpenStackAmuletDeployment, self)._add_services(this_service,
56 other_services)51 other_services)
52
57 services = other_services53 services = other_services
58 services.append(this_service)54 services.append(this_service)
59 use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']55 use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
56 'ceph-osd', 'ceph-radosgw']
6057
61 if self.openstack:58 if self.openstack:
62 for svc in services:59 for svc in services:
63 if svc[name] not in use_source:60 if svc['name'] not in use_source:
64 config = {'openstack-origin': self.openstack}61 config = {'openstack-origin': self.openstack}
65 self.d.configure(svc[name], config)62 self.d.configure(svc['name'], config)
6663
67 if self.source:64 if self.source:
68 for svc in services:65 for svc in services:
69 if svc[name] in use_source:66 if svc['name'] in use_source:
70 config = {'source': self.source}67 config = {'source': self.source}
71 self.d.configure(svc[name], config)68 self.d.configure(svc['name'], config)
7269
73 def _configure_services(self, configs):70 def _configure_services(self, configs):
74 """Configure all of the services."""71 """Configure all of the services."""
7572
=== modified file 'hooks/charmhelpers/contrib/openstack/context.py'
--- hooks/charmhelpers/contrib/openstack/context.py 2014-09-26 14:54:16 +0000
+++ hooks/charmhelpers/contrib/openstack/context.py 2014-10-02 20:31:34 +0000
@@ -52,6 +52,7 @@
52from charmhelpers.contrib.network.ip import (52from charmhelpers.contrib.network.ip import (
53 get_address_in_network,53 get_address_in_network,
54 get_ipv6_addr,54 get_ipv6_addr,
55 get_netmask_for_address,
55 format_ipv6_addr,56 format_ipv6_addr,
56 is_address_in_network57 is_address_in_network
57)58)
@@ -408,6 +409,9 @@
408 return ctxt409 return ctxt
409410
410411
412ADDRESS_TYPES = ['admin', 'internal', 'public']
413
414
411class HAProxyContext(OSContextGenerator):415class HAProxyContext(OSContextGenerator):
412 interfaces = ['cluster']416 interfaces = ['cluster']
413417
@@ -420,7 +424,6 @@
420 if not relation_ids('cluster'):424 if not relation_ids('cluster'):
421 return {}425 return {}
422426
423 cluster_hosts = {}
424 l_unit = local_unit().replace('/', '-')427 l_unit = local_unit().replace('/', '-')
425428
426 if config('prefer-ipv6'):429 if config('prefer-ipv6'):
@@ -428,17 +431,49 @@
428 else:431 else:
429 addr = unit_get('private-address')432 addr = unit_get('private-address')
430433
431 cluster_hosts[l_unit] = get_address_in_network(config('os-internal-network'),434 cluster_hosts = {}
432 addr)435
433436 # NOTE(jamespage): build out map of configured network endpoints
434 for rid in relation_ids('cluster'):437 # and associated backends
435 for unit in related_units(rid):438 for addr_type in ADDRESS_TYPES:
436 _unit = unit.replace('/', '-')439 laddr = get_address_in_network(
437 addr = relation_get('private-address', rid=rid, unit=unit)440 config('os-{}-network'.format(addr_type)))
438 cluster_hosts[_unit] = addr441 if laddr:
442 cluster_hosts[laddr] = {}
443 cluster_hosts[laddr]['network'] = "{}/{}".format(
444 laddr,
445 get_netmask_for_address(laddr)
446 )
447 cluster_hosts[laddr]['backends'] = {}
448 cluster_hosts[laddr]['backends'][l_unit] = laddr
449 for rid in relation_ids('cluster'):
450 for unit in related_units(rid):
451 _unit = unit.replace('/', '-')
452 _laddr = relation_get('{}-address'.format(addr_type),
453 rid=rid, unit=unit)
454 if _laddr:
455 cluster_hosts[laddr]['backends'][_unit] = _laddr
456
457 # NOTE(jamespage) no split configurations found, just use
458 # private addresses
459 if not cluster_hosts:
460 cluster_hosts[addr] = {}
461 cluster_hosts[addr]['network'] = "{}/{}".format(
462 addr,
463 get_netmask_for_address(addr)
464 )
465 cluster_hosts[addr]['backends'] = {}
466 cluster_hosts[addr]['backends'][l_unit] = addr
467 for rid in relation_ids('cluster'):
468 for unit in related_units(rid):
469 _unit = unit.replace('/', '-')
470 _laddr = relation_get('private-address',
471 rid=rid, unit=unit)
472 if _laddr:
473 cluster_hosts[addr]['backends'][_unit] = _laddr
439474
440 ctxt = {475 ctxt = {
441 'units': cluster_hosts,476 'frontends': cluster_hosts,
442 }477 }
443478
444 if config('haproxy-server-timeout'):479 if config('haproxy-server-timeout'):
@@ -455,12 +490,13 @@
455 ctxt['haproxy_host'] = '0.0.0.0'490 ctxt['haproxy_host'] = '0.0.0.0'
456 ctxt['stat_port'] = ':8888'491 ctxt['stat_port'] = ':8888'
457492
458 if len(cluster_hosts.keys()) > 1:493 for frontend in cluster_hosts:
459 # Enable haproxy when we have enough peers.494 if len(cluster_hosts[frontend]['backends']) > 1:
460 log('Ensuring haproxy enabled in /etc/default/haproxy.')495 # Enable haproxy when we have enough peers.
461 with open('/etc/default/haproxy', 'w') as out:496 log('Ensuring haproxy enabled in /etc/default/haproxy.')
462 out.write('ENABLED=1\n')497 with open('/etc/default/haproxy', 'w') as out:
463 return ctxt498 out.write('ENABLED=1\n')
499 return ctxt
464 log('HAProxy context is incomplete, this unit has no peers.')500 log('HAProxy context is incomplete, this unit has no peers.')
465 return {}501 return {}
466502
@@ -722,22 +758,22 @@
722758
723class OSConfigFlagContext(OSContextGenerator):759class OSConfigFlagContext(OSContextGenerator):
724760
725 """761 """
726 Responsible for adding user-defined config-flags in charm config to a762 Responsible for adding user-defined config-flags in charm config to a
727 template context.763 template context.
728764
729 NOTE: the value of config-flags may be a comma-separated list of765 NOTE: the value of config-flags may be a comma-separated list of
730 key=value pairs and some Openstack config files support766 key=value pairs and some Openstack config files support
731 comma-separated lists as values.767 comma-separated lists as values.
732 """768 """
733769
734 def __call__(self):770 def __call__(self):
735 config_flags = config('config-flags')771 config_flags = config('config-flags')
736 if not config_flags:772 if not config_flags:
737 return {}773 return {}
738774
739 flags = config_flags_parser(config_flags)775 flags = config_flags_parser(config_flags)
740 return {'user_config_flags': flags}776 return {'user_config_flags': flags}
741777
742778
743class SubordinateConfigContext(OSContextGenerator):779class SubordinateConfigContext(OSContextGenerator):
744780
=== modified file 'hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg'
--- hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2014-09-26 14:54:16 +0000
+++ hooks/charmhelpers/contrib/openstack/templates/haproxy.cfg 2014-10-02 20:31:34 +0000
@@ -34,17 +34,21 @@
34 stats uri /34 stats uri /
35 stats auth admin:password35 stats auth admin:password
3636
37{% if units -%}37{% if frontends -%}
38{% for service, ports in service_ports.iteritems() -%}38{% for service, ports in service_ports.iteritems() -%}
39listen {{ service }}_ipv4 0.0.0.0:{{ ports[0] }}39frontend tcp-in_{{ service }}
40 balance roundrobin40 bind *:{{ ports[0] }}
41 {% for unit, address in units.iteritems() -%}41 bind :::{{ ports[0] }}
42 server {{ unit }} {{ address }}:{{ ports[1] }} check42 {% for frontend in frontends -%}
43 {% endfor %}43 acl net_{{ frontend }} dst {{ frontends[frontend]['network'] }}
44listen {{ service }}_ipv6 :::{{ ports[0] }}44 use_backend {{ service }}_{{ frontend }} if net_{{ frontend }}
45 balance roundrobin45 {% endfor %}
46 {% for unit, address in units.iteritems() -%}46{% for frontend in frontends -%}
47 server {{ unit }} {{ address }}:{{ ports[1] }} check47backend {{ service }}_{{ frontend }}
48 {% endfor %}48 balance leastconn
49 {% for unit, address in frontends[frontend]['backends'].iteritems() -%}
50 server {{ unit }} {{ address }}:{{ ports[1] }} check
51 {% endfor %}
52{% endfor -%}
49{% endfor -%}53{% endfor -%}
50{% endif -%}54{% endif -%}
5155
=== added symlink 'hooks/cluster-relation-departed'
=== target is u'swift_hooks.py'
=== modified file 'hooks/swift_context.py'
--- hooks/swift_context.py 2014-09-25 06:20:53 +0000
+++ hooks/swift_context.py 2014-10-02 20:31:34 +0000
@@ -85,33 +85,9 @@
8585
86class ApacheSSLContext(SSLContext):86class ApacheSSLContext(SSLContext):
87 interfaces = ['https']87 interfaces = ['https']
88 external_ports = [determine_apache_port(config('bind-port'))]88 external_ports = [config('bind-port')]
89 service_namespace = 'swift'89 service_namespace = 'swift'
9090
91 def configure_cert(self):
92 if not os.path.isdir('/etc/apache2/ssl'):
93 os.mkdir('/etc/apache2/ssl')
94 ssl_dir = os.path.join('/etc/apache2/ssl/', self.service_namespace)
95 if not os.path.isdir(ssl_dir):
96 os.mkdir(ssl_dir)
97 cert, key = get_cert()
98 # Swift specific - generate a cert by default if not using
99 # a) user supplied cert or b) keystone signed cert
100 if None in [cert, key]:
101 cert, key = generate_cert()
102 with open(os.path.join(ssl_dir, 'cert'), 'w') as cert_out:
103 cert_out.write(b64decode(cert))
104 with open(os.path.join(ssl_dir, 'key'), 'w') as key_out:
105 key_out.write(b64decode(key))
106 ca_cert = get_ca_cert()
107 if ca_cert:
108 with open(CA_CERT_PATH, 'w') as ca_out:
109 ca_out.write(b64decode(ca_cert))
110 subprocess.check_call(['update-ca-certificates'])
111
112 def __call__(self):
113 return super(ApacheSSLContext, self).__call__()
114
11591
116class SwiftRingContext(OSContextGenerator):92class SwiftRingContext(OSContextGenerator):
11793
11894
=== modified file 'hooks/swift_hooks.py'
--- hooks/swift_hooks.py 2014-09-30 07:48:30 +0000
+++ hooks/swift_hooks.py 2014-10-02 20:31:34 +0000
@@ -62,6 +62,8 @@
62 is_ipv662 is_ipv6
63)63)
6464
65from charmhelpers.contrib.openstack.context import ADDRESS_TYPES
66
65extra_pkgs = [67extra_pkgs = [
66 "haproxy",68 "haproxy",
67 "python-jinja2"69 "python-jinja2"
@@ -223,22 +225,28 @@
223 do_openstack_upgrade(CONFIGS)225 do_openstack_upgrade(CONFIGS)
224 for r_id in relation_ids('identity-service'):226 for r_id in relation_ids('identity-service'):
225 keystone_joined(relid=r_id)227 keystone_joined(relid=r_id)
228 [cluster_joined(rid) for rid in relation_ids('cluster')]
226229
227230
228@hooks.hook('cluster-relation-joined')231@hooks.hook('cluster-relation-joined')
229def cluster_joined(relation_id=None):232def cluster_joined(relation_id=None):
233 for addr_type in ADDRESS_TYPES:
234 address = get_address_in_network(
235 config('os-{}-network'.format(addr_type))
236 )
237 if address:
238 relation_set(
239 relation_id=relation_id,
240 relation_settings={'{}-address'.format(addr_type): address}
241 )
230 if config('prefer-ipv6'):242 if config('prefer-ipv6'):
231 private_addr = get_ipv6_addr(exc_list=[config('vip')])[0]243 private_addr = get_ipv6_addr(exc_list=[config('vip')])[0]
232 else:244 relation_set(relation_id=relation_id,
233 private_addr = unit_get('private-address')245 relation_settings={'private-address': private_addr})
234246
235 address = get_address_in_network(config('os-internal-network'),247
236 private_addr)248@hooks.hook('cluster-relation-changed',
237 relation_set(relation_id=relation_id,249 'cluster-relation-departed')
238 relation_settings={'private-address': address})
239
240
241@hooks.hook('cluster-relation-changed')
242@restart_on_change(restart_map())250@restart_on_change(restart_map())
243def cluster_changed():251def cluster_changed():
244 CONFIGS.write_all()252 CONFIGS.write_all()
245253
=== modified file 'tests/basic_deployment.py'
--- tests/basic_deployment.py 2014-07-11 16:57:37 +0000
+++ tests/basic_deployment.py 2014-10-02 20:31:34 +0000
@@ -58,8 +58,7 @@
58 'admin-token': 'ubuntutesting'}58 'admin-token': 'ubuntutesting'}
59 swift_proxy_config = {'zone-assignment': 'manual',59 swift_proxy_config = {'zone-assignment': 'manual',
60 'replicas': '1',60 'replicas': '1',
61 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae',61 'swift-hash': 'fdfef9d4-8b06-11e2-8ac0-531c923c8fae'}
62 'use-https': 'no'}
63 swift_storage_config = {'zone': '1',62 swift_storage_config = {'zone': '1',
64 'block-device': 'vdb',63 'block-device': 'vdb',
65 'overwrite': 'true'}64 'overwrite': 'true'}
6665
=== modified file 'tests/charmhelpers/contrib/amulet/deployment.py'
--- tests/charmhelpers/contrib/amulet/deployment.py 2014-09-26 12:41:28 +0000
+++ tests/charmhelpers/contrib/amulet/deployment.py 2014-10-02 20:31:34 +0000
@@ -25,25 +25,30 @@
2525
26 Add services to the deployment where this_service is the local charm26 Add services to the deployment where this_service is the local charm
27 that we're testing and other_services are the other services that27 that we're testing and other_services are the other services that
28 are being used in the amulet tests.28 are being used in the local amulet tests.
29 """29 """
30 name, units, location = range(3)30 if this_service['name'] != os.path.basename(os.getcwd()):
3131 s = this_service['name']
32 if this_service[name] != os.path.basename(os.getcwd()):
33 s = this_service[name]
34 msg = "The charm's root directory name needs to be {}".format(s)32 msg = "The charm's root directory name needs to be {}".format(s)
35 amulet.raise_status(amulet.FAIL, msg=msg)33 amulet.raise_status(amulet.FAIL, msg=msg)
3634
37 self.d.add(this_service[name], units=this_service[units])35 if 'units' not in this_service:
36 this_service['units'] = 1
37
38 self.d.add(this_service['name'], units=this_service['units'])
3839
39 for svc in other_services:40 for svc in other_services:
40 if len(svc) > 2:41 if 'location' in svc:
41 branch_location = svc[location]42 branch_location = svc['location']
42 elif self.series:43 elif self.series:
43 branch_location = 'cs:{}/{}'.format(self.series, svc[name]),44 branch_location = 'cs:{}/{}'.format(self.series, svc['name']),
44 else:45 else:
45 branch_location = None46 branch_location = None
46 self.d.add(svc[name], charm=branch_location, units=svc[units])47
48 if 'units' not in svc:
49 svc['units'] = 1
50
51 self.d.add(svc['name'], charm=branch_location, units=svc['units'])
4752
48 def _add_relations(self, relations):53 def _add_relations(self, relations):
49 """Add all of the relations for the services."""54 """Add all of the relations for the services."""
5055
=== modified file 'tests/charmhelpers/contrib/openstack/amulet/deployment.py'
--- tests/charmhelpers/contrib/openstack/amulet/deployment.py 2014-09-26 12:41:28 +0000
+++ tests/charmhelpers/contrib/openstack/amulet/deployment.py 2014-10-02 20:31:34 +0000
@@ -1,6 +1,3 @@
1from bzrlib.branch import Branch
2import os
3import re
4from charmhelpers.contrib.amulet.deployment import (1from charmhelpers.contrib.amulet.deployment import (
5 AmuletDeployment2 AmuletDeployment
6)3)
@@ -13,62 +10,62 @@
13 that is specifically for use by OpenStack charms.10 that is specifically for use by OpenStack charms.
14 """11 """
1512
16 def __init__(self, series=None, openstack=None, source=None):13 def __init__(self, series=None, openstack=None, source=None, stable=True):
17 """Initialize the deployment environment."""14 """Initialize the deployment environment."""
18 super(OpenStackAmuletDeployment, self).__init__(series)15 super(OpenStackAmuletDeployment, self).__init__(series)
19 self.openstack = openstack16 self.openstack = openstack
20 self.source = source17 self.source = source
2118 self.stable = stable
22 def _is_dev_branch(self):19 # Note(coreycb): this needs to be changed when new next branches come
23 """Determine if branch being tested is a dev (i.e. next) branch."""20 # out.
24 branch = Branch.open(os.getcwd())21 self.current_next = "trusty"
25 parent = branch.get_parent()
26 pattern = re.compile("^.*/next/$")
27 if (pattern.match(parent)):
28 return True
29 else:
30 return False
3122
32 def _determine_branch_locations(self, other_services):23 def _determine_branch_locations(self, other_services):
33 """Determine the branch locations for the other services.24 """Determine the branch locations for the other services.
3425
35 If the branch being tested is a dev branch, then determine the26 Determine if the local branch being tested is derived from its
36 development branch locations for the other services. Otherwise,27 stable or next (dev) branch, and based on this, use the corresonding
37 the default charm store branches will be used."""28 stable or next branches for the other_services."""
38 name = 029 base_charms = ['mysql', 'mongodb', 'rabbitmq-server']
39 if self._is_dev_branch():30
40 updated_services = []31 if self.stable:
41 for svc in other_services:32 for svc in other_services:
42 if svc[name] in ['mysql', 'mongodb', 'rabbitmq-server']:33 temp = 'lp:charms/{}'
43 location = 'lp:charms/{}'.format(svc[name])34 svc['location'] = temp.format(svc['name'])
35 else:
36 for svc in other_services:
37 if svc['name'] in base_charms:
38 temp = 'lp:charms/{}'
39 svc['location'] = temp.format(svc['name'])
44 else:40 else:
45 temp = 'lp:~openstack-charmers/charms/trusty/{}/next'41 temp = 'lp:~openstack-charmers/charms/{}/{}/next'
46 location = temp.format(svc[name])42 svc['location'] = temp.format(self.current_next,
47 updated_services.append(svc + (location,))43 svc['name'])
48 other_services = updated_services
49 return other_services44 return other_services
5045
51 def _add_services(self, this_service, other_services):46 def _add_services(self, this_service, other_services):
52 """Add services to the deployment and set openstack-origin/source."""47 """Add services to the deployment and set openstack-origin/source."""
53 name = 0
54 other_services = self._determine_branch_locations(other_services)48 other_services = self._determine_branch_locations(other_services)
49
55 super(OpenStackAmuletDeployment, self)._add_services(this_service,50 super(OpenStackAmuletDeployment, self)._add_services(this_service,
56 other_services)51 other_services)
52
57 services = other_services53 services = other_services
58 services.append(this_service)54 services.append(this_service)
59 use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph']55 use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
56 'ceph-osd', 'ceph-radosgw']
6057
61 if self.openstack:58 if self.openstack:
62 for svc in services:59 for svc in services:
63 if svc[name] not in use_source:60 if svc['name'] not in use_source:
64 config = {'openstack-origin': self.openstack}61 config = {'openstack-origin': self.openstack}
65 self.d.configure(svc[name], config)62 self.d.configure(svc['name'], config)
6663
67 if self.source:64 if self.source:
68 for svc in services:65 for svc in services:
69 if svc[name] in use_source:66 if svc['name'] in use_source:
70 config = {'source': self.source}67 config = {'source': self.source}
71 self.d.configure(svc[name], config)68 self.d.configure(svc['name'], config)
7269
73 def _configure_services(self, configs):70 def _configure_services(self, configs):
74 """Configure all of the services."""71 """Configure all of the services."""

Subscribers

People subscribed via source and target branches