Commit 122eeb17 authored by unknown's avatar unknown
Browse files

pass registry and staging as separate args

parent 31bc2b82
...@@ -9,6 +9,8 @@ import requests ...@@ -9,6 +9,8 @@ import requests
from requests.exceptions import HTTPError from requests.exceptions import HTTPError
from retrying import retry from retrying import retry
from MaxIcsRegistry import MaxIcsRegistry
from .settings import Settings from .settings import Settings
MAX_RETRIES = 5 # max retries number MAX_RETRIES = 5 # max retries number
...@@ -40,13 +42,13 @@ class BuildingGeneric: ...@@ -40,13 +42,13 @@ class BuildingGeneric:
This way, a VersionConflictError pops whenever a conflicts of versions happens This way, a VersionConflictError pops whenever a conflicts of versions happens
""" """
def __init__(self, uid: str = None, **kwargs) -> None: def __init__(self, uid: str = None, staging: bool = False, registry: MaxIcsRegistry = None, **kwargs) -> None:
self.logger = logging.getLogger(self.__class__.__name__) self.logger = logging.getLogger(self.__class__.__name__)
self._uid = uid self._uid = uid
self._building = None self._building = None
self.settings = Settings(**kwargs) self.settings = Settings(staging=staging, registry=registry, **kwargs)
if self._uid: if self._uid:
self.fetch(timeout=kwargs.get("timeout", None)) self.fetch(timeout=kwargs.get("timeout", None))
......
...@@ -8,8 +8,6 @@ class Settings: ...@@ -8,8 +8,6 @@ class Settings:
def __init__(self, staging: bool = False, registry=None, **kwargs) -> None: def __init__(self, staging: bool = False, registry=None, **kwargs) -> None:
self.logger = logging.getLogger(self.__class__.__name__) self.logger = logging.getLogger(self.__class__.__name__)
staging = kwargs.get("staging", False)
registry = kwargs.get("registry")
if not registry: if not registry:
self.logger.warning("Registry is not set when initializing Building. Calling registry...") self.logger.warning("Registry is not set when initializing Building. Calling registry...")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment