diff options
author | Adam Coldrick <adam.coldrick@codethink.co.uk> | 2015-05-14 10:06:57 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2015-05-20 14:01:00 +0000 |
commit | 6fd766d2b071f301ace520dacda89713dd9a91d9 (patch) | |
tree | 291bbf1d362a9ecaf736309daaededa2fbd80f76 /morphlib | |
parent | f72b4dc8ad951244b4470f5dba7efd4bbd0f63f0 (diff) | |
download | morph-6fd766d2b071f301ace520dacda89713dd9a91d9.tar.gz |
generate-manifest-csv: Catch NoRemote error when cloning lorries repo
If there is no $trove-id/local-config/lorries repository, and similarly if
there is no baserock/local-config/lorries repository on the Trove defined
by 'trove-host', the generate-manifest-csv command will fail with a
NoRemote error from trying to clone a non-existent repository. This commit
fixes this and instead outputs a warning if either of the repositories
cannot be found.
Change-Id: I8edd8484e45d8fc91021a9be34966c13d2beb705
Diffstat (limited to 'morphlib')
-rw-r--r-- | morphlib/plugins/system_manifests_plugin.py | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/morphlib/plugins/system_manifests_plugin.py b/morphlib/plugins/system_manifests_plugin.py index 1aea8341..cc26e5ca 100644 --- a/morphlib/plugins/system_manifests_plugin.py +++ b/morphlib/plugins/system_manifests_plugin.py @@ -243,21 +243,32 @@ def get_upstream_address(chunk_url, lorries, status): return 'UNKNOWN' def get_lorry_repos(tempdir, lrc, status, trove_id, trove_host): - baserock_lorry_repo = 'baserock:local-config/lorries' - lorrydir = os.path.join(tempdir, 'baserock-lorries') - baserock_lorrydir = checkout_repo(lrc, baserock_lorry_repo, lorrydir) - lorries = load_lorries(lorrydir) + lorries = [] + try: + baserock_lorry_repo = 'baserock:local-config/lorries' + lorrydir = os.path.join(tempdir, 'baserock-lorries') + baserock_lorrydir = checkout_repo(lrc, baserock_lorry_repo, lorrydir) + lorries.extend(load_lorries(lorrydir)) + except morphlib.localrepocache.NoRemote as e: + status(msg="WARNING: Could not find lorries from git.baserock.org, " + "expected to find them on %(trove)s at %(reponame)s", + trove=trove_host, reponame = e.reponame) if trove_id: - trove_lorry_repo = ('http://%s/git/%s/local-config/lorries' % - (trove_host, trove_id)) - lorrydir = os.path.join(tempdir, '%s-lorries' % trove_id) - trove_lorrydir = checkout_repo(lrc, trove_lorry_repo, lorrydir) + try: + trove_lorry_repo = ('http://%s/git/%s/local-config/lorries' % + (trove_host, trove_id)) + lorrydir = os.path.join(tempdir, '%s-lorries' % trove_id) + trove_lorrydir = checkout_repo(lrc, trove_lorry_repo, lorrydir) + lorries.extend(load_lorries(lorrydir)) + except morphlib.localrepocache.NoRemote as e: + status(msg="WARNING: Could not find lorries repo on %(trove)s " + "at %(reponame)s", + trove=trove_host, reponame=e.reponame) else: status(msg="WARNING: Not looking in %(trove)s's local-config/lorries " "repo as trove-id was not configured.", trove=trove_host) - lorries.extend(load_lorries(lorrydir)) return lorries |