File tree 3 files changed +28
-1
lines changed
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
49
49
50
50
pairs = [ ]
51
51
content . each do |line |
52
- pairs << line . strip . delete ( '"' ) . split ( '=' , 2 )
52
+ pairs << line . strip . delete ( '"' ) . split ( '=' , 2 ) unless line . start_with? ( '#' )
53
53
end
54
54
55
55
pairs
Original file line number Diff line number Diff line change 56
56
end
57
57
end
58
58
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
+
59
67
context 'when on Debian' do
60
68
let ( :os_release_content ) { load_fixture ( 'os_release_debian' ) . readlines }
61
69
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