fix infinite loop introduced by #20124 when the init system is not in the supported_inits list

This commit is contained in:
Umberto Nicoletti 2015-04-13 13:42:27 +02:00 committed by rallytime
parent 0c7fa0fca2
commit 4d0061b832

View file

@ -1046,14 +1046,16 @@ def os_data():
with open(init_bin, 'rb') as fp_:
buf = True
edge = ''
buf = fp_.read(buf_size).lower()
while buf:
buf = edge + fp_.read(buf_size).lower()
buf = edge + buf
for item in supported_inits:
if item in buf:
grains['init'] = item
buf = ''
break
edge = buf[-edge_len:]
buf = fp_.read(buf_size).lower()
except (IOError, OSError) as exc:
log.error(
'Unable to read from init_bin ({0}): {1}'