Ensure gss config file permissions

This commit is contained in:
Ryan Beisner 2018-04-09 14:50:34 +00:00
parent d129a93c94
commit 013d008005
1 changed files with 12 additions and 2 deletions

View File

@ -112,6 +112,10 @@ class MirrorsConfigServiceContext(OSContextGenerator):
user_agent=config['user_agent'],
hypervisor_mapping=config['hypervisor_mapping'])
def ensure_perms():
"""Ensure gss file permissions."""
os.chmod(ID_CONF_FILE_NAME, 0o640)
os.chmod(MIRRORS_CONF_FILE_NAME, 0o640)
def get_release():
return get_os_codename_package('glance-common', fatal=False) or 'icehouse'
@ -127,7 +131,6 @@ def get_configs():
UnitNameContext()])
return configs
def install_cron_script():
"""Installs cron job in /etc/cron.$frequency/ for repeating sync
@ -194,11 +197,16 @@ def identity_service_joined(relation_id=None):
hookenv.relation_set(relation_id=relation_id, **relation_data)
@hooks.hook('identity-service-relation-changed')
def identity_service_changed():
configs = get_configs()
configs.write(ID_CONF_FILE_NAME)
ensure_perms()
@hooks.hook('install.real')
def install():
@ -230,6 +238,7 @@ def config_changed():
hookenv.log('begin config-changed hook.')
configs = get_configs()
configs.write(MIRRORS_CONF_FILE_NAME)
ensure_perms()
update_nrpe_config()
@ -259,6 +268,7 @@ def upgrade_charm():
update_nrpe_config()
configs = get_configs()
configs.write_all()
ensure_perms()
@hooks.hook('amqp-relation-joined')