Merge "Centralize config options - [swift]"

This commit is contained in:
Jenkins 2016-07-05 20:41:04 +00:00 committed by Gerrit Code Review
commit fc70b103aa
4 changed files with 34 additions and 14 deletions

View File

@ -14,7 +14,6 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_config import cfg
from six.moves import http_client from six.moves import http_client
from six.moves.urllib import parse from six.moves.urllib import parse
from swiftclient import client as swift_client from swiftclient import client as swift_client
@ -24,17 +23,7 @@ from swiftclient import utils as swift_utils
from ironic.common import exception from ironic.common import exception
from ironic.common.i18n import _ from ironic.common.i18n import _
from ironic.common import keystone from ironic.common import keystone
from ironic.conf import CONF
swift_opts = [
cfg.IntOpt('swift_max_retries',
default=2,
help=_('Maximum number of times to retry a Swift request, '
'before failing.'))
]
CONF = cfg.CONF
CONF.register_opts(swift_opts, group='swift')
CONF.import_opt('admin_user', 'keystonemiddleware.auth_token', CONF.import_opt('admin_user', 'keystonemiddleware.auth_token',
group='keystone_authtoken') group='keystone_authtoken')

View File

@ -31,6 +31,7 @@ from ironic.conf import oneview
from ironic.conf import seamicro from ironic.conf import seamicro
from ironic.conf import snmp from ironic.conf import snmp
from ironic.conf import ssh from ironic.conf import ssh
from ironic.conf import swift
CONF = cfg.CONF CONF = cfg.CONF
@ -50,3 +51,4 @@ oneview.register_opts(CONF)
seamicro.register_opts(CONF) seamicro.register_opts(CONF)
snmp.register_opts(CONF) snmp.register_opts(CONF)
ssh.register_opts(CONF) ssh.register_opts(CONF)
swift.register_opts(CONF)

View File

@ -23,7 +23,6 @@ import ironic.common.images
import ironic.common.neutron import ironic.common.neutron
import ironic.common.paths import ironic.common.paths
import ironic.common.service import ironic.common.service
import ironic.common.swift
import ironic.common.utils import ironic.common.utils
import ironic.drivers.modules.agent import ironic.drivers.modules.agent
import ironic.drivers.modules.agent_base_vendor import ironic.drivers.modules.agent_base_vendor
@ -85,7 +84,7 @@ _opts = [
('seamicro', ironic.conf.seamicro.opts), ('seamicro', ironic.conf.seamicro.opts),
('snmp', ironic.conf.snmp.opts), ('snmp', ironic.conf.snmp.opts),
('ssh', ironic.conf.ssh.opts), ('ssh', ironic.conf.ssh.opts),
('swift', ironic.common.swift.swift_opts), ('swift', ironic.conf.swift.opts),
('virtualbox', ironic.drivers.modules.virtualbox.opts), ('virtualbox', ironic.drivers.modules.virtualbox.opts),
] ]

30
ironic/conf/swift.py Normal file
View File

@ -0,0 +1,30 @@
# Copyright 2016 Intel Corporation
# Copyright 2014 OpenStack Foundation
# All Rights Reserved
#
# 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.
from oslo_config import cfg
from ironic.common.i18n import _
opts = [
cfg.IntOpt('swift_max_retries',
default=2,
help=_('Maximum number of times to retry a Swift request, '
'before failing.'))
]
def register_opts(conf):
conf.register_opts(opts, group='swift')