Skip to content

Commit

Permalink
Rename 'openSUSE_LEAP_MICRO' to 'LEAP_MICRO'
Browse files Browse the repository at this point in the history
- Having enums starting with a capital letter is better for consistency
  • Loading branch information
HoussemNasri committed Feb 18, 2024
1 parent cc98af8 commit 8f4ec9d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion java/code/src/com/redhat/rhn/domain/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -2524,7 +2524,7 @@ else if (isSLES() && OsFamily.SUSE_LINUX_ENTERPRISE_SERVER.isSupportedRelease(ge
else if (isSLED() && OsFamily.SUSE_LINUX_ENTERPRISE_DESKTOP.isSupportedRelease(getRelease())) {
return Optional.of(new CVEAuditManagerOVAL.OVALProduct(OsFamily.SUSE_LINUX_ENTERPRISE_DESKTOP, getRelease()));
}
else if (isLeapMicro() && OsFamily.openSUSE_LEAP_MICRO.isSupportedRelease(getRelease())) {
else if (isLeapMicro() && OsFamily.LEAP_MICRO.isSupportedRelease(getRelease())) {
return Optional.of(new CVEAuditManagerOVAL.OVALProduct(OsFamily.SUSE_LINUX_ENTERPRISE_MICRO, getRelease()));
}
else if (isSLEMicro() && OsFamily.SUSE_LINUX_ENTERPRISE_MICRO.isSupportedRelease(getRelease())) {
Expand Down
2 changes: 1 addition & 1 deletion java/code/src/com/suse/oval/OVALCleaner.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private static void fillCves(DefinitionType definition, OsFamily osFamily) {
switch (osFamily) {
case REDHAT_ENTERPRISE_LINUX:
case LEAP:
case openSUSE_LEAP_MICRO:
case LEAP_MICRO:
case SUSE_LINUX_ENTERPRISE_SERVER:
case SUSE_LINUX_ENTERPRISE_DESKTOP:
case SUSE_LINUX_ENTERPRISE_MICRO:
Expand Down
2 changes: 1 addition & 1 deletion java/code/src/com/suse/oval/OsFamily.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
public enum OsFamily {
LEAP("openSUSE Leap", "leap", "opensuse",
oneOf("15.2", "15.3", "15.4", "15.5")),
openSUSE_LEAP_MICRO("openSUSELeap Micro", "leap-micro", "opensuse",
LEAP_MICRO("openSUSELeap Micro", "leap-micro", "opensuse",
oneOf("5.2", "5.3")),
SUSE_LINUX_ENTERPRISE_SERVER("SUSE Linux Enterprise Server", "sles", "suse",
oneOf("11", "12", "15")),
Expand Down
4 changes: 4 additions & 0 deletions java/code/src/com/suse/oval/config/test/OVALConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,8 @@ public void testAllSources() throws IOException {
assertEquals(HttpURLConnection.HTTP_OK, responseCode, () -> "Can't connect to URL: " + sourceURL);
}
}

public void testOsFamilies() {
// TODO: Test that all os families in the config file are in OsFamily enum
}
}
2 changes: 1 addition & 1 deletion java/code/src/com/suse/oval/config/test/oval.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
}
},
"openSUSE_LEAP_MICRO": {
"LEAP_MICRO": {
"content": {
"5.2": {
"vulnerability": "https://ftp.suse.com/pub/projects/security/oval/opensuse.leap.micro.5.2-affected.xml.gz",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ private Cpe deriveCpe(TestType productTest) {
if (osProduct == OsFamily.LEAP) {
return deriveOpenSUSELeapCpe();
}
else if (osProduct == OsFamily.openSUSE_LEAP_MICRO) {
else if (osProduct == OsFamily.LEAP_MICRO) {
return deriveOpenSUSELeapMicroCpe();
}
else if (osProduct == OsFamily.SUSE_LINUX_ENTERPRISE_MICRO) {
Expand Down Expand Up @@ -250,7 +250,7 @@ private Cpe deriveFromProductOVALTest(TestType productTest) {
public boolean isValidDefinition(DefinitionType definitionTypeIn) {
OsFamily osFamily = definitionTypeIn.getOsFamily();
boolean definitionFromASupportedFamily = osFamily == OsFamily.LEAP ||
osFamily == OsFamily.openSUSE_LEAP_MICRO ||
osFamily == OsFamily.LEAP_MICRO ||
osFamily == OsFamily.SUSE_LINUX_ENTERPRISE_SERVER ||
osFamily == OsFamily.SUSE_LINUX_ENTERPRISE_DESKTOP ||
osFamily == OsFamily.SUSE_LINUX_ENTERPRISE_MICRO;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static VulnerablePackagesExtractor create(DefinitionType definition, OsFa
OVALLookupHelper ovalLookupHelper) {
switch (osFamily) {
case LEAP:
case openSUSE_LEAP_MICRO:
case LEAP_MICRO:
case SUSE_LINUX_ENTERPRISE_SERVER:
case SUSE_LINUX_ENTERPRISE_DESKTOP:
case SUSE_LINUX_ENTERPRISE_MICRO:
Expand Down
2 changes: 1 addition & 1 deletion susemanager-sync-data/oval.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
}
},
"openSUSE_LEAP_MICRO": {
"LEAP_MICRO": {
"content": {
"5.2": {
"vulnerability": "https://ftp.suse.com/pub/projects/security/oval/opensuse.leap.micro.5.2-affected.xml.gz",
Expand Down

0 comments on commit 8f4ec9d

Please sign in to comment.