Skip and warn on wonky /etc/os-release lines

If the lines don't split cleanly (occasionally STDERR gets mixed in, for
instance, due to our current SSH output setup), we should simply
log.Warn in the output instead of bailing completely.

Signed-off-by: Nathan LeClaire <nathan.leclaire@gmail.com>
This commit is contained in:
Nathan LeClaire 2015-07-28 16:17:53 -07:00
parent ef9acc98b6
commit 802393f253
1 changed files with 2 additions and 1 deletions

View File

@ -69,7 +69,8 @@ func (osr *OsRelease) ParseOsRelease(osReleaseContents []byte) error {
for scanner.Scan() {
key, val, err := parseLine(scanner.Text())
if err != nil {
return err
log.Warn("Warning: got an invalid line error parsing /etc/os-release: %s", err)
continue
}
if err := osr.setIfPossible(key, val); err != nil {
log.Debug(err)