timezone: Assuming UTC when no /etc/localtime exists (#27131)

This commit is contained in:
Andrea Scarpino 2017-07-21 23:15:06 +02:00 committed by René Moser
parent 7a8054812c
commit 4fb5221b5f

View file

@ -521,7 +521,8 @@ class BSDTimezone(Timezone):
tz = os.readlink('/etc/localtime')
return tz.replace('/usr/share/zoneinfo/', '')
except:
self.module.fail_json(msg='Could not read /etc/localtime')
self.module.warn('Could not read /etc/localtime. Assuming UTC')
return 'UTC'
else:
self.module.fail_json(msg='{0} is not a supported option on target platform'.
format(key))