Merge "Remove global singleton openstack_config"

This commit is contained in:
Zuul 2024-11-24 19:12:30 +00:00 committed by Gerrit Code Review
commit 8d6cb6abc2
3 changed files with 5 additions and 8 deletions

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.config import loader
from nodepool.driver.statemachine import StateMachineDriver
from nodepool.driver.fake.config import FakeProviderConfig
from nodepool.driver.fake.adapter import FakeAdapter
@ -21,7 +19,7 @@ from nodepool.driver.fake.adapter import FakeAdapter
class FakeDriver(StateMachineDriver):
def reset(self):
self.openstack_config = loader.OpenStackConfig()
pass
def __init__(self):
self.reset()

View File

@ -12,8 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from openstack.config import loader
from nodepool.driver.statemachine import StateMachineDriver
from nodepool.driver.openstack.config import OpenStackProviderConfig
from nodepool.driver.openstack.adapter import OpenStackAdapter
@ -21,7 +19,7 @@ from nodepool.driver.openstack.adapter import OpenStackAdapter
class OpenStackDriver(StateMachineDriver):
def reset(self):
self.openstack_config = loader.OpenStackConfig()
pass
def __init__(self):
self.reset()

View File

@ -21,6 +21,8 @@ from nodepool.driver import ProviderConfig
from nodepool.driver import ConfigValue
from nodepool.driver import ConfigPool
from openstack.config import loader
class ProviderDiskImage(ConfigValue):
def __init__(self):
@ -164,7 +166,6 @@ class ProviderPool(ConfigPool):
class OpenStackProviderConfig(ProviderConfig):
def __init__(self, driver, provider):
self.driver_object = driver
self.__pools = {}
self.cloud_config = None
self.image_type = None
@ -197,7 +198,7 @@ class OpenStackProviderConfig(ProviderConfig):
def load(self, config):
cloud_kwargs = self._cloudKwargs()
openstack_config = self.driver_object.openstack_config
openstack_config = loader.OpenStackConfig()
self.cloud_config = openstack_config.get_one(**cloud_kwargs)
self.image_type = self.cloud_config.config['image_format']