generate: container: Fix the image sanity check added by the last version
Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
8e4deb7d36
commit
b9a8b87e7f
1 changed files with 19 additions and 6 deletions
|
@ -720,17 +720,30 @@ class Container:
|
||||||
name = maybe(json, "name")
|
name = maybe(json, "name")
|
||||||
if name is None:
|
if name is None:
|
||||||
logger.log_error("No container name set, aborting!")
|
logger.log_error("No container name set, aborting!")
|
||||||
return
|
raise ConfigError("Container has no name")
|
||||||
image = maybe(json, "image")
|
image = maybe(json, "image")
|
||||||
if image is None:
|
if image is None:
|
||||||
logger.log_error("No image set, aborting!")
|
logger.log_error("No image set, aborting!")
|
||||||
return
|
raise ConfigError("Container has no image")
|
||||||
if image.name == "" or image.registry == "" or image.tag == "":
|
|
||||||
logger.log_error("Image config is missing required keys!")
|
self.image = Image.from_json(image, logger)
|
||||||
return
|
image_valid = True
|
||||||
|
if self.image.image == "":
|
||||||
|
logger.log_error("Image has no image set!")
|
||||||
|
image_valid = False
|
||||||
|
if self.image.registry == "":
|
||||||
|
logger.log_error("Image has no registry set!")
|
||||||
|
image_valid = False
|
||||||
|
if self.image.tag == "":
|
||||||
|
logger.log_error("Image has no tag set!")
|
||||||
|
image_valid = False
|
||||||
|
if not image_valid:
|
||||||
|
raise ConfigError("Image is missing required keys!")
|
||||||
|
|
||||||
|
self.name = name
|
||||||
ct_opts = ContainerOptions.from_json(json, logger)
|
ct_opts = ContainerOptions.from_json(json, logger)
|
||||||
if not ct_opts.is_valid:
|
if not ct_opts.is_valid:
|
||||||
return
|
raise ConfigError("Config seems to be invalid?")
|
||||||
env = maybe(json, "env")
|
env = maybe(json, "env")
|
||||||
secrets = maybe(json, "secrets")
|
secrets = maybe(json, "secrets")
|
||||||
volumes = maybe(json, "volumes")
|
volumes = maybe(json, "volumes")
|
||||||
|
|
Loading…
Add table
Reference in a new issue