aboutsummaryrefslogtreecommitdiff
path: root/layman
diff options
context:
space:
mode:
authorDevan Franchini <twitch153@gentoo.org>2015-07-14 11:15:54 -0400
committerDevan Franchini <twitch153@gentoo.org>2015-07-14 11:15:54 -0400
commitcf8329cb7218173bba6cc57ed8f43e54e8ec9775 (patch)
treefbcb5c89919b19b58a6392cf5012b135399a7416 /layman
parentsetup.py: Adds db_modules packages to list of install packages (diff)
downloadlayman-cf8329cb7218173bba6cc57ed8f43e54e8ec9775.tar.gz
layman-cf8329cb7218173bba6cc57ed8f43e54e8ec9775.tar.bz2
layman-cf8329cb7218173bba6cc57ed8f43e54e8ec9775.zip
overlay.py: Adds better error handling for missing "source" entries
Diffstat (limited to 'layman')
-rwxr-xr-xlayman/overlays/overlay.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py
index 6e289b6..c6a0cee 100755
--- a/layman/overlays/overlay.py
+++ b/layman/overlays/overlay.py
@@ -160,10 +160,13 @@ class Overlay(object):
msg = 'Overlay from_dict(), "name" entry missing from dictionary!'
raise Exception(msg)
- _sources = overlay['source']
+ if 'source' in overlay:
+ _sources = overlay['source']
+ else:
+ _sources = None
if _sources == None:
- msg = 'Overlay from_dict(), "%(name)s" is missing a "source"'\
+ msg = 'Overlay from_dict(), "%(name)s" is missing a "source" '\
'entry!' % {'name': self.name}
raise Exception(msg)
@@ -267,10 +270,13 @@ class Overlay(object):
msg = 'Overlay from_json(), "name" entry missing from json!'
raise Exception(msg)
- _sources = json['source']
+ if 'source' in json:
+ _sources = json['source']
+ else:
+ _sources = None
if _sources == None:
- msg = 'Overlay from_json(), "%(name)s" is missing a "source"'\
+ msg = 'Overlay from_json(), "%(name)s" is missing a "source" '\
'entry!' % {'name': self.name}
raise Exception(msg)