diff --git a/hooks/glance_utils.py b/hooks/glance_utils.py index 121c5dd2..23cbaf4e 100644 --- a/hooks/glance_utils.py +++ b/hooks/glance_utils.py @@ -195,6 +195,10 @@ CONFIG_FILES = OrderedDict([ service_user='glance')], 'services': ['glance-api'] }), + (GLANCE_POLICY_FILE, { + 'hook_contexts': [], + 'services': ['glance-api', 'glance-registry'] + }), (ceph_config_file(), { 'hook_contexts': [context.CephContext()], 'services': ['glance-api', 'glance-registry'] @@ -264,6 +268,11 @@ def register_configs(): if cmp_release >= 'mitaka': configs.register(GLANCE_SWIFT_CONF, CONFIG_FILES[GLANCE_SWIFT_CONF]['hook_contexts']) + + if cmp_release >= 'ussuri': + configs.register(GLANCE_POLICY_FILE, + CONFIG_FILES[GLANCE_POLICY_FILE]['hook_contexts']) + return configs @@ -384,8 +393,6 @@ def restart_map(): else: glance_svcs = ['glance-api', 'glance-registry'] - _map.append((GLANCE_POLICY_FILE, glance_svcs)) - if os.path.isdir(APACHE_SSL_DIR): _map.append(('{}/*'.format(APACHE_SSL_DIR), glance_svcs + ['apache2'])) diff --git a/templates/ussuri/policy.json b/templates/ussuri/policy.json new file mode 100644 index 00000000..9ccdb5c9 --- /dev/null +++ b/templates/ussuri/policy.json @@ -0,0 +1,5 @@ +{ + "delete_image_location": "rule:default", + "get_image_location": "rule:default", + "set_image_location": "rule:default" +} diff --git a/unit_tests/test_glance_utils.py b/unit_tests/test_glance_utils.py index cdf110c8..78346fa5 100644 --- a/unit_tests/test_glance_utils.py +++ b/unit_tests/test_glance_utils.py @@ -152,13 +152,13 @@ class TestGlanceUtils(CharmTestCase): (utils.GLANCE_REGISTRY_CONF, ['glance-registry']), (utils.GLANCE_API_CONF, ['glance-api']), (utils.GLANCE_SWIFT_CONF, ['glance-api']), + (utils.GLANCE_POLICY_FILE, ['glance-api', 'glance-registry']), (utils.ceph_config_file(), ['glance-api', 'glance-registry']), (utils.HAPROXY_CONF, ['haproxy']), (utils.HTTPS_APACHE_CONF, ['apache2']), (utils.HTTPS_APACHE_24_CONF, ['apache2']), (utils.APACHE_PORTS_CONF, ['apache2']), (utils.MEMCACHED_CONF, ['memcached']), - (utils.GLANCE_POLICY_FILE, ['glance-api', 'glance-registry']), ]) self.assertEqual(ex_map, utils.restart_map()) self.enable_memcache.return_value = False @@ -174,13 +174,13 @@ class TestGlanceUtils(CharmTestCase): ex_map = OrderedDict([ (utils.GLANCE_API_CONF, ['glance-api']), (utils.GLANCE_SWIFT_CONF, ['glance-api']), + (utils.GLANCE_POLICY_FILE, ['glance-api']), (utils.ceph_config_file(), ['glance-api']), (utils.HAPROXY_CONF, ['haproxy']), (utils.HTTPS_APACHE_CONF, ['apache2']), (utils.HTTPS_APACHE_24_CONF, ['apache2']), (utils.APACHE_PORTS_CONF, ['apache2']), (utils.MEMCACHED_CONF, ['memcached']), - (utils.GLANCE_POLICY_FILE, ['glance-api']), ]) self.assertEqual(ex_map, utils.restart_map()) self.enable_memcache.return_value = False @@ -198,13 +198,13 @@ class TestGlanceUtils(CharmTestCase): ex_map = OrderedDict([ (utils.GLANCE_API_CONF, ['glance-api']), (utils.GLANCE_SWIFT_CONF, ['glance-api']), + (utils.GLANCE_POLICY_FILE, ['glance-api']), (utils.ceph_config_file(), ['glance-api']), (utils.HAPROXY_CONF, ['haproxy']), (utils.HTTPS_APACHE_CONF, ['apache2']), (utils.HTTPS_APACHE_24_CONF, ['apache2']), (utils.APACHE_PORTS_CONF, ['apache2']), (utils.MEMCACHED_CONF, ['memcached']), - (utils.GLANCE_POLICY_FILE, ['glance-api']), ('{}/*'.format(utils.APACHE_SSL_DIR), ['glance-api', 'apache2']), ])