Show an error on 'run' when there are legacy one-off containers
Also warn the user about the one-off containers in the standard error message about legacy containers. Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
This commit is contained in:
parent
fc8f564558
commit
e98caf5cf9
6 changed files with 221 additions and 38 deletions
|
|
@ -34,7 +34,7 @@ def main():
|
|||
except KeyboardInterrupt:
|
||||
log.error("\nAborting.")
|
||||
sys.exit(1)
|
||||
except (UserError, NoSuchService, ConfigurationError, legacy.LegacyContainersError) as e:
|
||||
except (UserError, NoSuchService, ConfigurationError, legacy.LegacyError) as e:
|
||||
log.error(e.msg)
|
||||
sys.exit(1)
|
||||
except NoSuchCommand as e:
|
||||
|
|
@ -336,12 +336,22 @@ class TopLevelCommand(Command):
|
|||
if not options['--service-ports']:
|
||||
container_options['ports'] = []
|
||||
|
||||
container = service.create_container(
|
||||
quiet=True,
|
||||
one_off=True,
|
||||
insecure_registry=insecure_registry,
|
||||
**container_options
|
||||
)
|
||||
try:
|
||||
container = service.create_container(
|
||||
quiet=True,
|
||||
one_off=True,
|
||||
insecure_registry=insecure_registry,
|
||||
**container_options
|
||||
)
|
||||
except APIError as e:
|
||||
legacy.check_for_legacy_containers(
|
||||
project.client,
|
||||
project.name,
|
||||
[service.name],
|
||||
allow_one_off=False,
|
||||
)
|
||||
|
||||
raise e
|
||||
|
||||
if options['-d']:
|
||||
service.start_container(container)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue