File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ def read_and_parse_os_release_file
4949
5050 pairs = [ ]
5151 content . each do |line |
52- pairs << line . strip . delete ( '"' ) . split ( '=' , 2 )
52+ pairs << line . strip . delete ( '"' ) . split ( '=' , 2 ) unless line . start_with? ( '#' )
5353 end
5454
5555 pairs
Original file line number Diff line number Diff line change 5656 end
5757 end
5858
59+ context 'when /etc/os-release file has comment' do
60+ let ( :os_release_content ) { load_fixture ( 'os_release_redhat_linux_with_comment' ) . readlines }
61+
62+ it 'does not raise an exception' do
63+ expect { Facter ::Resolvers ::OsRelease . resolve ( :name ) } . not_to raise_error
64+ end
65+ end
66+
5967 context 'when on Debian' do
6068 let ( :os_release_content ) { load_fixture ( 'os_release_debian' ) . readlines }
6169
Original file line number Diff line number Diff line change 1+ # This is a comment
2+ NAME="Red Hat Enterprise Linux"
3+ VERSION="8.6 (Ootpa)"
4+ ID="rhel"
5+ ID_LIKE="fedora"
6+ VERSION_ID="8.6"
7+ PLATFORM_ID="platform:el8"
8+ PRETTY_NAME="Red Hat Enterprise Linux 8.6 (Ootpa)"
9+ ANSI_COLOR="0;31"
10+ CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
11+ HOME_URL="https://www.redhat.com/"
12+ DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
13+ BUG_REPORT_URL="https://bugzilla.redhat.com/"
14+
15+ # Whoa, this is another comment!
16+ REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
17+ REDHAT_BUGZILLA_PRODUCT_VERSION=8.6
18+ REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
19+ REDHAT_SUPPORT_PRODUCT_VERSION="8.6"
You can’t perform that action at this time.
0 commit comments