add code for config generation

Change-Id: Ib86b949bb43ca6b5c386b7032a255f06b0f2eab9
This commit is contained in:
Andrey Pavlov 2015-08-28 18:53:52 +03:00
parent c2a7043a9d
commit 2f967d5ed4
9 changed files with 151 additions and 4 deletions

View File

@ -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

41
ec2api/api/opts.py Normal file
View File

@ -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,
)),
]

24
ec2api/metadata/opts.py Normal file
View File

@ -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,
)),
]

36
ec2api/opts.py Normal file
View File

@ -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,
)),
]

24
ec2api/s3/opts.py Normal file
View File

@ -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,
)),
]

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.