Prevent stacktrace if something goes wrong retrieving inventory

This commit is contained in:
C. R. Oldham 2015-11-17 15:39:57 -07:00
parent e7cbce15a5
commit 04095e3b74
2 changed files with 7 additions and 1 deletions

View file

@ -55,7 +55,7 @@ def _find_credentials():
return (u, p)
log.debug('grains fx2._find_credentials found no valid credentials, using Dell default')
logger.debug('grains fx2._find_credentials found no valid credentials, using Dell default')
return ('root', 'calvin')

View file

@ -243,6 +243,12 @@ def network_info(host=None,
inv = inventory(host=host, admin_username=admin_username,
admin_password=admin_password)
if inv is None:
cmd = {}
cmd['retcode'] = -1
cmd['stdout'] = 'Problem getting switch inventory'
return cmd
if module not in inv.get('switch'):
cmd = {}
cmd['retcode'] = -1