summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErno Kuvaja <jokke@usr.fi>2018-02-07 14:57:06 +0000
committerErno Kuvaja <jokke@usr.fi>2018-02-08 10:06:15 +0000
commit824badc1890206695eb335582a804d9ecabb4d67 (patch)
tree21bc650555b197f2b86e16717f6efab1e1d8168b
parent8682876a8b5d18cd678be061ad8bb64aaeb3dcff (diff)
Decouple Image Import Plugin Opts
This change decouples Image Import Plugin Options from glance/opts.py so that the deployer who wishes to add 3rd party plugin does not need to inject the details to the file that is cluttered with all Glance internal details. Change-Id: Idc31dbb673efae224c97d2cafa4afa053e049c76 Closes-Bug: #1747926
Notes
Notes (review): Code-Review+2: Abhishek Kekane <akekane@redhat.com> Code-Review+2: Brian Rosmaita <rosmaita.fossdev@gmail.com> Workflow+1: Brian Rosmaita <rosmaita.fossdev@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 08 Feb 2018 15:28:56 +0000 Reviewed-on: https://review.openstack.org/541740 Project: openstack/glance Branch: refs/heads/master
-rw-r--r--glance/async/flows/plugins/plugin_opts.py34
-rw-r--r--glance/opts.py8
2 files changed, 38 insertions, 4 deletions
diff --git a/glance/async/flows/plugins/plugin_opts.py b/glance/async/flows/plugins/plugin_opts.py
new file mode 100644
index 0000000..440e1eb
--- /dev/null
+++ b/glance/async/flows/plugins/plugin_opts.py
@@ -0,0 +1,34 @@
1# Copyright 2018 Red Hat, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16
17import glance.async.flows.plugins.inject_image_metadata
18
19
20# Note(jokke): This list contains tuples of config options for import plugins.
21# When new plugin is introduced its config options need to be added to this
22# list so that they can be processed, when config generator is used to generate
23# the glance-image-import.conf.sample it will also pick up the details. The
24# module needs to be imported as the Glance release packaged example(s) above
25# and the first part of the tuple refers to the group the options gets
26# registered under at the config file.
27PLUGIN_OPTS = [
28 ('inject_metadata_properties',
29 glance.async.flows.plugins.inject_image_metadata.inject_metadata_opts),
30]
31
32
33def get_plugin_opts():
34 return PLUGIN_OPTS
diff --git a/glance/opts.py b/glance/opts.py
index 196e81b..7785fa1 100644
--- a/glance/opts.py
+++ b/glance/opts.py
@@ -30,7 +30,7 @@ import glance.api.middleware.context
30import glance.api.versions 30import glance.api.versions
31import glance.async.flows.api_image_import 31import glance.async.flows.api_image_import
32import glance.async.flows.convert 32import glance.async.flows.convert
33import glance.async.flows.plugins.inject_image_metadata 33from glance.async.flows.plugins import plugin_opts
34import glance.async.taskflow_executor 34import glance.async.taskflow_executor
35import glance.common.config 35import glance.common.config
36import glance.common.location_strategy 36import glance.common.location_strategy
@@ -109,8 +109,6 @@ _manage_opts = [
109] 109]
110_image_import_opts = [ 110_image_import_opts = [
111 ('image_import_opts', glance.async.flows.api_image_import.api_import_opts), 111 ('image_import_opts', glance.async.flows.api_image_import.api_import_opts),
112 ('inject_metadata_properties',
113 glance.async.flows.plugins.inject_image_metadata.inject_metadata_opts)
114] 112]
115 113
116 114
@@ -162,4 +160,6 @@ def list_manage_opts():
162 160
163def list_image_import_opts(): 161def list_image_import_opts():
164 """Return a list of oslo_config options available for Image Import""" 162 """Return a list of oslo_config options available for Image Import"""
165 return [(g, copy.deepcopy(o)) for g, o in _image_import_opts] 163
164 opts = _image_import_opts.extend(plugin_opts.get_plugin_opts())
165 return [(g, copy.deepcopy(o)) for g, o in opts]