Merge lp:~lomov-as/charms/trusty/cf-go-router/trunk into lp:~cf-charmers/charms/trusty/cf-go-router/trunk

Proposed by Alex Lomov
Status: Merged
Approved by: Alexandr Prismakov
Approved revision: 24
Merged at revision: 24
Proposed branch: lp:~lomov-as/charms/trusty/cf-go-router/trunk
Merge into: lp:~cf-charmers/charms/trusty/cf-go-router/trunk
Diff against target: 81 lines (+32/-13)
2 files modified
hooks/charmhelpers/contrib/cloudfoundry/common.py (+8/-6)
hooks/charmhelpers/contrib/cloudfoundry/contexts.py (+24/-7)
To merge this branch: bzr merge lp:~lomov-as/charms/trusty/cf-go-router/trunk
Reviewer Review Type Date Requested Status
Alexandr Prismakov (community) Approve
Review via email: mp+219174@code.launchpad.net

Description of the change

Use new versions of cf-loggregator

Changed relation names

To post a comment you must log in.
Revision history for this message
Alex Lomov (lomov-as) wrote :

Please take a look.

Revision history for this message
Alexandr Prismakov (prismakov) wrote :

Reviewed, looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/charmhelpers/contrib/cloudfoundry/common.py'
2--- hooks/charmhelpers/contrib/cloudfoundry/common.py 2014-04-13 18:00:04 +0000
3+++ hooks/charmhelpers/contrib/cloudfoundry/common.py 2014-05-12 11:23:58 +0000
4@@ -48,9 +48,9 @@
5 gid = grp.getgrnam(group).gr_gid
6 for root, dirs, files in os.walk(path):
7 for momo in dirs:
8- os.lchown(os.path.join(root, momo), uid, gid)
9- for momo in files:
10- os.lchown(os.path.join(root, momo), uid, gid)
11+ os.chown(os.path.join(root, momo), uid, gid)
12+ for momo in files:
13+ os.chown(os.path.join(root, momo), uid, gid)
14
15
16 @contextmanager
17@@ -63,7 +63,9 @@
18
19
20 def prepare_cloudfoundry_environment(config_data, packages):
21- add_source(config_data['source'], config_data.get('key'))
22- apt_update(fatal=True)
23- apt_install(packages=filter_installed_packages(packages), fatal=True)
24+ if 'source' in config_data:
25+ add_source(config_data['source'], config_data.get('key'))
26+ apt_update(fatal=True)
27+ if packages:
28+ apt_install(packages=filter_installed_packages(packages), fatal=True)
29 host.adduser('vcap')
30
31=== modified file 'hooks/charmhelpers/contrib/cloudfoundry/contexts.py'
32--- hooks/charmhelpers/contrib/cloudfoundry/contexts.py 2014-04-03 18:19:32 +0000
33+++ hooks/charmhelpers/contrib/cloudfoundry/contexts.py 2014-05-12 11:23:58 +0000
34@@ -29,19 +29,30 @@
35 return hookenv.config()
36
37
38+class StorableContext(object):
39+
40+ def store_context(self, file_name, config_data):
41+ with open(file_name, 'w') as file_stream:
42+ yaml.dump(config_data, file_stream)
43+
44+ def read_context(self, file_name):
45+ with open(file_name, 'r') as file_stream:
46+ data = yaml.load(file_stream)
47+ if not data:
48+ raise OSError("%s is empty" % file_name)
49+ return data
50+
51+
52 # Stores `config_data` hash into yaml file with `file_name` as a name
53 # if `file_name` already exists, then it loads data from `file_name`.
54-class StoredContext(OSContextGenerator):
55+class StoredContext(OSContextGenerator, StorableContext):
56+
57 def __init__(self, file_name, config_data):
58 self.data = config_data
59 if os.path.exists(file_name):
60- with open(file_name, 'r') as file_stream:
61- self.data = yaml.load(file_stream)
62- if not self.data:
63- raise OSError("%s is empty" % file_name)
64+ self.data = self.read_context(file_name)
65 else:
66- with open(file_name, 'w') as file_stream:
67- yaml.dump(config_data, file_stream)
68+ self.store_context(file_name, config_data)
69 self.data = config_data
70
71 def __call__(self):
72@@ -64,3 +75,9 @@
73 class RouterContext(RelationContext):
74 interface = 'router'
75 required_keys = ['domain']
76+
77+
78+class LoggregatorContext(RelationContext):
79+ interface = 'loggregator'
80+ required_keys = ['shared_secret', 'loggregator_address']
81+

Subscribers

People subscribed via source and target branches