Fix "Remove VxFlex OS credentials" regression

Change Ia1d2b2151e5676037d40bfaf388b54023fc37093 uses a ConfigParser
instance in a way that is incompatible with python 2.7, resulting in
a "ConfigParser instance has no attribute '__getitem__'" error.  This
patch accesses the ConfigParser using the "old" API that works in both
Python 2.7 and Python 3 and adds some tests.

Co-authored-by: Brian Rosmaita <>

Change-Id: Ie2db587c3bc379acd53cfd449788d171ae58dec5
Closes-Bug: 1883654
changes/89/735989/8 2.10.4
hamalq 2 years ago committed by Brian Rosmaita
parent 55fc998521
commit 12d252db9c
  1. 2
  2. 68
  3. 28

@ -96,4 +96,4 @@ def get_connector_password(filename, config_group):
conf = configparser.ConfigParser()
return conf[config_group]["san_password"]
return conf.get(config_group, "san_password")

@ -0,0 +1,68 @@
# Copyright 2020, Red Hat Inc.
# 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
# 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 tempfile
from os_brick import exception
from os_brick import privileged
from os_brick.privileged import scaleio
from os_brick.tests import base
EXPECTED_SECTION = "scalio_test"
EXPECTED_PASSWORD = "This is not a good password"
san_password = not me
san_password = {}
san_password = not me either
class ScaleioGetPasswordTestCase(base.TestCase):
"""Check the get_connector_password function.
Launchpad bug #1883654: a change that worked fine in the
python 3-only branches broke when run under py2.7 in the stable
def setUp(self):
super(ScaleioGetPasswordTestCase, self).setUp()
# Bypass privsep and run these simple functions in-process
# (allows reading back the modified state of mocks)
self.addCleanup(privileged.default.set_client_mode, True)
self.fake_config_file = tempfile.NamedTemporaryFile("w",
def test_get_connector_password_bad_filename(self):
def test_get_connector_password(self):
found_password = scaleio.get_connector_password(, EXPECTED_SECTION)
self.assertEqual(EXPECTED_PASSWORD, found_password)

@ -0,0 +1,28 @@
- |
Dell EMC VxFlex OS driver: This release corrects an issue where the
fix for `Bug #1823200 <>`_
did not run correctly when using Python 2.7. If you are interested
in this release because of `OSSN-0086
<>`_, be aware that
you must also deploy a configuration file on compute nodes, cinder
nodes, and anywhere you would perform a volume attachment in your
deployment. Please see the release notes for the previous release
for details.
- |
This release corrects a problem with the fix for `Bug #1823200
<>`_ in the previous
release. If you are running OpenStack on Python 3, you should not
be impacted by this bug. If you are not using Dell EMC VxFlex OS
(ScaleIO) Storage as a backend for Cinder, you do not need to upgrade
to this release.
- |
`Bug #1883654 <>`_:
The fix for `Bug #1823200
<>`_ in the previous
release used a Python 3-specific language feature and thus did not
run correctly when used with Python 2.7. The problem has been corrected
in this release.