diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 73a2f886..c1f64fbc 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -161,10 +161,7 @@ function configure_ec2api { mkdir_chown_stack "$EC2API_CONF_DIR" # Generate ec2api configuration file and configure common parameters. - oslo-config-generator --namespace ec2api \ - --namespace oslo.db \ - --namespace oslo.messaging \ - > $EC2API_CONF_FILE + touch $EC2API_CONF_FILE cp $EC2API_DIR/etc/ec2api/api-paste.ini $EC2API_CONF_DIR cleanup_ec2api diff --git a/ec2api/api/opts.py b/ec2api/api/opts.py new file mode 100644 index 00000000..18e69021 --- /dev/null +++ b/ec2api/api/opts.py @@ -0,0 +1,41 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import itertools + +import ec2api.api +import ec2api.api.auth +import ec2api.api.availability_zone +import ec2api.api.clients +import ec2api.api.common +import ec2api.api.dhcp_options +import ec2api.api.ec2utils +import ec2api.api.image +import ec2api.api.instance + + +def list_opts(): + return [ + ('DEFAULT', + itertools.chain( + ec2api.api.ec2_opts, + ec2api.api.auth.auth_opts, + ec2api.api.availability_zone.availability_zone_opts, + ec2api.api.clients.ec2_opts, + ec2api.api.common.ec2_opts, + ec2api.api.dhcp_options.ec2_opts, + ec2api.api.ec2utils.ec2_opts, + ec2api.api.image.s3_opts, + ec2api.api.image.rpcapi_opts, + ec2api.api.instance.ec2_opts, + )), + ] diff --git a/ec2api/metadata/opts.py b/ec2api/metadata/opts.py new file mode 100644 index 00000000..9aca41d0 --- /dev/null +++ b/ec2api/metadata/opts.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import itertools + +import ec2api.metadata + + +def list_opts(): + return [ + ('metadata', + itertools.chain( + ec2api.metadata.metadata_opts, + )), + ] diff --git a/ec2api/opts.py b/ec2api/opts.py new file mode 100644 index 00000000..ed22c898 --- /dev/null +++ b/ec2api/opts.py @@ -0,0 +1,36 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import itertools + +import ec2api.context +import ec2api.db.api +import ec2api.exception +import ec2api.paths +import ec2api.service +import ec2api.utils +import ec2api.wsgi + + +def list_opts(): + return [ + ('DEFAULT', + itertools.chain( + ec2api.context.ec2_opts, + ec2api.db.api.tpool_opts, + ec2api.exception.exc_log_opts, + ec2api.paths.path_opts, + ec2api.service.service_opts, + ec2api.utils.utils_opts, + ec2api.wsgi.wsgi_opts, + )), + ] diff --git a/ec2api/s3/opts.py b/ec2api/s3/opts.py new file mode 100644 index 00000000..77e150c9 --- /dev/null +++ b/ec2api/s3/opts.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy +# of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import itertools + +import ec2api.s3.s3server + + +def list_opts(): + return [ + ('DEFAULT', + itertools.chain( + ec2api.s3.s3server.s3_opts, + )), + ] diff --git a/etc/ec2api/README-ec2api.conf.txt b/etc/ec2api/README-ec2api.conf.txt new file mode 100644 index 00000000..9fb50d07 --- /dev/null +++ b/etc/ec2api/README-ec2api.conf.txt @@ -0,0 +1,4 @@ +To generate the sample ec2api.conf file, run the following +command from the top level of the ec2api directory: + +tox -egenconfig diff --git a/etc/ec2api/ec2api-config-generator.conf b/etc/ec2api/ec2api-config-generator.conf new file mode 100644 index 00000000..a302613b --- /dev/null +++ b/etc/ec2api/ec2api-config-generator.conf @@ -0,0 +1,12 @@ +[DEFAULT] +output_file = etc/ec2api/ec2api.conf.sample +wrap_width = 79 +namespace = ec2api +namespace = ec2api.api +namespace = ec2api.metadata +namespace = ec2api.s3 +namespace = oslo.log +namespace = oslo.messaging +namespace = oslo.service.service +namespace = oslo.db +namespace = oslo.concurrency diff --git a/setup.cfg b/setup.cfg index 8c0a1468..c0bd58ed 100644 --- a/setup.cfg +++ b/setup.cfg @@ -25,6 +25,12 @@ setup-hooks = pbr.hooks.setup_hook [entry_points] +oslo.config.opts = + ec2api = ec2api.opts:list_opts + ec2api.api = ec2api.api.opts:list_opts + ec2api.metadata = ec2api.metadata.opts:list_opts + ec2api.s3 = ec2api.s3.opts:list_opts + console_scripts = ec2-api=ec2api.cmd.api:main ec2-api-manage=ec2api.cmd.manage:main diff --git a/tox.ini b/tox.ini index a0991b5c..463f9e6f 100644 --- a/tox.ini +++ b/tox.ini @@ -26,6 +26,9 @@ sitepackages = False commands = flake8 {posargs} +[testenv:genconfig] +commands = oslo-config-generator --config-file=etc/ec2api/ec2api-config-generator.conf + [testenv:cover] # Also do not run test_coverage_ext tests while gathering coverage as those # tests conflict with coverage.