Skip to content
This repository has been archived by the owner on Jan 19, 2018. It is now read-only.

Commit

Permalink
Handle docker pull exception, improve #441, fix #568
Browse files Browse the repository at this point in the history
  • Loading branch information
concaf committed Mar 2, 2016
1 parent 8bda4bd commit bed3215
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion atomicapp/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
LOGGER_DEFAULT,
PROVIDERS)
from atomicapp.nulecule import NuleculeManager
from atomicapp.nulecule.exceptions import NuleculeException
from atomicapp.nulecule.exceptions import NuleculeException, DockerException
from atomicapp.utils import Utils

logger = logging.getLogger(LOGGER_DEFAULT)
Expand Down Expand Up @@ -106,6 +106,9 @@ def cli_run(args):
else:
print_app_location(nm.app_path)
sys.exit(0)
except DockerException as e:
logger.error(e)
sys.exit(1)
except NuleculeException as e:
logger.error(e)
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions atomicapp/nulecule/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
LOGGER_DEFAULT,
MAIN_FILE)
from atomicapp.utils import Utils
from atomicapp.nulecule.exceptions import NuleculeException
from atomicapp.nulecule.exceptions import NuleculeException, DockerException

cockpit_logger = logging.getLogger(LOGGER_COCKPIT)
logger = logging.getLogger(LOGGER_DEFAULT)
Expand Down Expand Up @@ -60,7 +60,7 @@ def pull(self, image, update=False):
if self.dryrun:
logger.info("DRY-RUN: %s", pull_cmd)
elif subprocess.call(pull_cmd) != 0:
raise Exception("Could not pull Docker image %s" % image)
raise DockerException("Could not pull Docker image %s" % image)

cockpit_logger.info('Skipping pulling Docker image: %s' % image)

Expand Down
4 changes: 4 additions & 0 deletions atomicapp/nulecule/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# -*- coding: utf-8 -*-


class DockerException(Exception):
pass


class NuleculeException(Exception):
pass

0 comments on commit bed3215

Please sign in to comment.