cf-charmers team mailing list archive
-
cf-charmers team
-
Mailing list archive
-
Message #00141
[Merge] lp:~lomov-as/charms/trusty/cf-go-router/trunk into lp:~cf-charmers/charms/trusty/cf-go-router/trunk
Alex Lomov has proposed merging lp:~lomov-as/charms/trusty/cf-go-router/trunk into lp:~cf-charmers/charms/trusty/cf-go-router/trunk.
Requested reviews:
Alexandr Prismakov (prismakov)
For more details, see:
https://code.launchpad.net/~lomov-as/charms/trusty/cf-go-router/trunk/+merge/219174
Use new versions of cf-loggregator
Changed relation names
--
https://code.launchpad.net/~lomov-as/charms/trusty/cf-go-router/trunk/+merge/219174
Your team Cloud Foundry Charmers is subscribed to branch lp:~cf-charmers/charms/trusty/cf-go-router/trunk.
=== modified file 'hooks/charmhelpers/contrib/cloudfoundry/common.py'
--- hooks/charmhelpers/contrib/cloudfoundry/common.py 2014-04-13 18:00:04 +0000
+++ hooks/charmhelpers/contrib/cloudfoundry/common.py 2014-05-12 11:23:58 +0000
@@ -48,9 +48,9 @@
gid = grp.getgrnam(group).gr_gid
for root, dirs, files in os.walk(path):
for momo in dirs:
- os.lchown(os.path.join(root, momo), uid, gid)
- for momo in files:
- os.lchown(os.path.join(root, momo), uid, gid)
+ os.chown(os.path.join(root, momo), uid, gid)
+ for momo in files:
+ os.chown(os.path.join(root, momo), uid, gid)
@contextmanager
@@ -63,7 +63,9 @@
def prepare_cloudfoundry_environment(config_data, packages):
- add_source(config_data['source'], config_data.get('key'))
- apt_update(fatal=True)
- apt_install(packages=filter_installed_packages(packages), fatal=True)
+ if 'source' in config_data:
+ add_source(config_data['source'], config_data.get('key'))
+ apt_update(fatal=True)
+ if packages:
+ apt_install(packages=filter_installed_packages(packages), fatal=True)
host.adduser('vcap')
=== modified file 'hooks/charmhelpers/contrib/cloudfoundry/contexts.py'
--- hooks/charmhelpers/contrib/cloudfoundry/contexts.py 2014-04-03 18:19:32 +0000
+++ hooks/charmhelpers/contrib/cloudfoundry/contexts.py 2014-05-12 11:23:58 +0000
@@ -29,19 +29,30 @@
return hookenv.config()
+class StorableContext(object):
+
+ def store_context(self, file_name, config_data):
+ with open(file_name, 'w') as file_stream:
+ yaml.dump(config_data, file_stream)
+
+ def read_context(self, file_name):
+ with open(file_name, 'r') as file_stream:
+ data = yaml.load(file_stream)
+ if not data:
+ raise OSError("%s is empty" % file_name)
+ return data
+
+
# Stores `config_data` hash into yaml file with `file_name` as a name
# if `file_name` already exists, then it loads data from `file_name`.
-class StoredContext(OSContextGenerator):
+class StoredContext(OSContextGenerator, StorableContext):
+
def __init__(self, file_name, config_data):
self.data = config_data
if os.path.exists(file_name):
- with open(file_name, 'r') as file_stream:
- self.data = yaml.load(file_stream)
- if not self.data:
- raise OSError("%s is empty" % file_name)
+ self.data = self.read_context(file_name)
else:
- with open(file_name, 'w') as file_stream:
- yaml.dump(config_data, file_stream)
+ self.store_context(file_name, config_data)
self.data = config_data
def __call__(self):
@@ -64,3 +75,9 @@
class RouterContext(RelationContext):
interface = 'router'
required_keys = ['domain']
+
+
+class LoggregatorContext(RelationContext):
+ interface = 'loggregator'
+ required_keys = ['shared_secret', 'loggregator_address']
+
References