Merge lp:~gnuoy/charm-helpers/add-svc-params into lp:charm-helpers

Proposed by Liam Young
Status: Merged
Merged at revision: 640
Proposed branch: lp:~gnuoy/charm-helpers/add-svc-params
Merge into: lp:charm-helpers
Diff against target: 83 lines (+54/-9)
1 file modified
charmhelpers/contrib/openstack/amulet/deployment.py (+54/-9)
To merge this branch: bzr merge lp:~gnuoy/charm-helpers/add-svc-params
Reviewer Review Type Date Requested Status
James Page Approve
Review via email: mp+307153@code.launchpad.net
To post a comment you must log in.
639. By Liam Young

Add the ability to pass in the use_source and no_origin lists to stop having to raise changes to charm-helpers everytime a new service is added to an amulet test which should be added to the list

Revision history for this message
James Page (james-page) :
640. By Liam Young

Make the no_origin and use_source additive options additive to prevent the same list having to be replicated in charms

Revision history for this message
James Page (james-page) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'charmhelpers/contrib/openstack/amulet/deployment.py'
2--- charmhelpers/contrib/openstack/amulet/deployment.py 2016-09-20 16:43:28 +0000
3+++ charmhelpers/contrib/openstack/amulet/deployment.py 2016-09-30 09:13:10 +0000
4@@ -98,8 +98,47 @@
5
6 return other_services
7
8- def _add_services(self, this_service, other_services):
9- """Add services to the deployment and set openstack-origin/source."""
10+ def _add_services(self, this_service, other_services, use_source=None,
11+ no_origin=None):
12+ """Add services to the deployment and optionally set
13+ openstack-origin/source.
14+
15+ :param this_service dict: Service dictionary describing the service
16+ whose amulet tests are being run
17+ :param other_services dict: List of service dictionaries describing
18+ the services needed to support the target
19+ service
20+ :param use_source list: List of services which use the 'source' config
21+ option rather than 'openstack-origin'
22+ :param no_origin list: List of services which do not support setting
23+ the Cloud Archive.
24+ Service Dict:
25+ {
26+ 'name': str charm-name,
27+ 'units': int number of units,
28+ 'constraints': dict of juju constraints,
29+ 'location': str location of charm,
30+ }
31+ eg
32+ this_service = {
33+ 'name': 'openvswitch-odl',
34+ 'constraints': {'mem': '8G'},
35+ }
36+ other_services = [
37+ {
38+ 'name': 'nova-compute',
39+ 'units': 2,
40+ 'constraints': {'mem': '4G'},
41+ 'location': cs:~bob/xenial/nova-compute
42+ },
43+ {
44+ 'name': 'mysql',
45+ 'constraints': {'mem': '2G'},
46+ },
47+ {'neutron-api-odl'}]
48+ use_source = ['mysql']
49+ no_origin = ['neutron-api-odl']
50+ """
51 self.log.info('OpenStackAmuletDeployment: adding services')
52
53 other_services = self._determine_branch_locations(other_services)
54@@ -110,16 +149,22 @@
55 services = other_services
56 services.append(this_service)
57
58+ use_source = use_source or []
59+ no_origin = no_origin or []
60+
61 # Charms which should use the source config option
62- use_source = ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
63- 'ceph-osd', 'ceph-radosgw', 'ceph-mon', 'ceph-proxy']
64+ use_source = list(set(
65+ use_source + ['mysql', 'mongodb', 'rabbitmq-server', 'ceph',
66+ 'ceph-osd', 'ceph-radosgw', 'ceph-mon',
67+ 'ceph-proxy']))
68
69 # Charms which can not use openstack-origin, ie. many subordinates
70- no_origin = ['cinder-ceph', 'hacluster', 'neutron-openvswitch', 'nrpe',
71- 'openvswitch-odl', 'neutron-api-odl', 'odl-controller',
72- 'cinder-backup', 'nexentaedge-data',
73- 'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw',
74- 'cinder-nexentaedge', 'nexentaedge-mgmt']
75+ no_origin = list(set(
76+ no_origin + ['cinder-ceph', 'hacluster', 'neutron-openvswitch',
77+ 'nrpe', 'openvswitch-odl', 'neutron-api-odl',
78+ 'odl-controller', 'cinder-backup', 'nexentaedge-data',
79+ 'nexentaedge-iscsi-gw', 'nexentaedge-swift-gw',
80+ 'cinder-nexentaedge', 'nexentaedge-mgmt']))
81
82 if self.openstack:
83 for svc in services:

Subscribers

People subscribed via source and target branches