Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't fail over empty or faulty lines #1570

Merged
merged 1 commit into from Sep 26, 2017
Merged

Conversation

aleixpol
Copy link
Contributor

If we're not going to be able to unpack it, ignore the line.

This is what it looks like on Arch Linux. Note the empty line in the end:

$ cat /etc/os-release 
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
ID_LIKE=archlinux
ANSI_COLOR="0;36"
HOME_URL="https://www.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://bugs.archlinux.org/"

$ 

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on bug reports?
  • If this is a new feature. Have you discussed the design on the forum?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh unit? < some tests fail but they also failed before as well

os_release_dict[key] = value.strip('"')
entry = line.rstrip().split('=')
if len(entry) == 2:
os_release_dict[entry[0]] = entry[1].strip('"')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding a unit test to snapcraft/tests/test_common.py with your failing os-release and one that doesn't have an empty line?

If we're not going to be able to unpack it, ignore the line
Copy link
Collaborator

@sergiusens sergiusens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

@sergiusens sergiusens merged commit bf216fd into canonical:master Sep 26, 2017
@aleixpol
Copy link
Contributor Author

\o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants