Add support for minimal version check
This commit is contained in:
parent
e070fecb9f
commit
bebd55bbae
@ -6,11 +6,14 @@ import tempfile
|
|||||||
import importlib
|
import importlib
|
||||||
import pulumi
|
import pulumi
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import semver
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Disable Pulumis version check globally
|
# Disable Pulumis version check globally
|
||||||
@ -135,6 +138,17 @@ def pulumi_ws(func):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
_version = "undefined"
|
_version = "undefined"
|
||||||
|
|
||||||
|
# bail out if we need a minimal cloudbender version for a template
|
||||||
|
try:
|
||||||
|
_min_version = self._pulumi_code.MIN_CLOUDBENDER_VERSION
|
||||||
|
if semver.compare(__version__.strip("v"),_min_version.strip("v")) < 0:
|
||||||
|
raise ValueError(
|
||||||
|
f"Minimal required CloudBender version is {_min_version}, but we are {__version__}!"
|
||||||
|
)
|
||||||
|
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Tag all resources with our metadata, allowing "prune" eventually
|
# Tag all resources with our metadata, allowing "prune" eventually
|
||||||
_tags["zdt:cloudbender.source"] = "{}:{}".format(
|
_tags["zdt:cloudbender.source"] = "{}:{}".format(
|
||||||
os.path.basename(self._pulumi_code.__file__), _version
|
os.path.basename(self._pulumi_code.__file__), _version
|
||||||
|
Loading…
Reference in New Issue
Block a user