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

Handle docker pull exception, improve #441, fix #568 #569

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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