Add ModelConfig
This class maps the model-config from the vca_config. That config will
be passed every time a model is added.
Change-Id: I0a1e47ba7d708f3514c64a6f20d410a21fe8ea1d
Signed-off-by: David Garcia <david.garcia@canonical.com>
(cherry picked from commit a71d4a04c1e8ad3ffe1a129024e6dbc14d6d3bd5)
diff --git a/n2vc/libjuju.py b/n2vc/libjuju.py
index 161370b..e5a8c61 100644
--- a/n2vc/libjuju.py
+++ b/n2vc/libjuju.py
@@ -32,6 +32,7 @@
from juju.client import client
from juju import tag
+from n2vc.config import ModelConfig
from n2vc.juju_watcher import JujuModelWatcher
from n2vc.provisioner import AsyncSSHProvisioner
from n2vc.n2vc_conn import N2VCConnector
@@ -63,8 +64,7 @@
log: logging.Logger = None,
db: dict = None,
n2vc: N2VCConnector = None,
- apt_mirror: str = None,
- enable_os_upgrade: bool = True,
+ model_config: ModelConfig = {},
):
"""
Constructor
@@ -99,11 +99,7 @@
self.n2vc = n2vc
# Generate config for models
- self.model_config = {}
- if apt_mirror:
- self.model_config["apt-mirror"] = apt_mirror
- self.model_config["enable-os-refresh-update"] = enable_os_upgrade
- self.model_config["enable-os-upgrade"] = enable_os_upgrade
+ self.model_config = model_config
self.loop.set_exception_handler(self.handle_exception)
self.creating_model = asyncio.Lock(loop=self.loop)