Change SafeConfigParser into ConfigParser

SafeConfigParser supports interpolation on top of ConfigParser
in Python 2, and SafeConfigParser is deprecated in Python 3.2.
Use ConfigParser directly instead.

Closes-Bug: #1618666
Change-Id: I115646053de986b2df4775fb94edc7e7548093ae
This commit is contained in:
Li Wei 2016-09-11 16:29:25 +08:00 committed by ChangBo Guo(gcb)
parent 33f943b2f7
commit 956f5c4e29
2 changed files with 14 additions and 2 deletions

View File

@ -13,6 +13,7 @@
# under the License.
import re
import sys
from oslo_config import cfg
from oslo_log import log as logging
@ -23,7 +24,12 @@ import glance.api.policy
from glance.common import exception
from glance.i18n import _, _LE, _LW
CONFIG = configparser.SafeConfigParser()
# SafeConfigParser was deprecated in Python 3.2
if sys.version_info >= (3, 2):
CONFIG = configparser.ConfigParser()
else:
CONFIG = configparser.SafeConfigParser()
LOG = logging.getLogger(__name__)
property_opts = [

View File

@ -11,6 +11,7 @@
# 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 sys
from oslo_config import cfg
from oslo_log import log as logging
@ -81,7 +82,12 @@ Related options:
""")),
]
CONFIG = configparser.SafeConfigParser()
# SafeConfigParser was deprecated in Python 3.2
if sys.version_info >= (3, 2):
CONFIG = configparser.ConfigParser()
else:
CONFIG = configparser.SafeConfigParser()
LOG = logging.getLogger(__name__)