Skip to content

Commit d05f7f8

Browse files
authored
Merge pull request #116 from jstourac/rhel9Platform
Add a new `isRHEL9` method to determine RHEL9 system.
2 parents 6fe0101 + c9e45dc commit d05f7f8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

core/src/main/groovy/noe/common/utils/Platform.groovy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ class Platform {
132132
return (isRHEL() && (osVersion ==~ /.*el8.*/)) || forceRhel8()
133133
}
134134

135+
boolean isRHEL9() {
136+
return (isRHEL() && (osVersion ==~ /.*el9.*/)) || forceRhel9()
137+
}
138+
135139
boolean isSolaris11() {
136140
return isSolaris() && (osVersion ==~ /5\.11/)
137141
}
@@ -186,4 +190,13 @@ class Platform {
186190
private boolean forceRhel8() {
187191
return Boolean.parseBoolean(Library.getUniversalProperty('force.rhel.8', 'false'))
188192
}
193+
194+
/**
195+
* As on Docker, the 'os.name' of the system is determined by the host OS and not the container one, to make tests
196+
* work it is necessary to mock that we are, indeed, using RHEL9 machine.
197+
* @return value of the 'force.rhel.9' property
198+
*/
199+
private boolean forceRhel9() {
200+
return Boolean.parseBoolean(Library.getUniversalProperty('force.rhel.9', 'false'))
201+
}
189202
}

0 commit comments

Comments
 (0)