Skip to content

Commit 25c4756

Browse files
zztalkernir0s
authored andcommitted
Fixed CloudLinux id discovery
1 parent 3892f32 commit 25c4756

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

distro.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,10 @@ def _distro_release_info(self):
10861086
# file), because we want to use what was specified as best as
10871087
# possible.
10881088
match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
1089-
if match:
1089+
if 'name' in distro_info \
1090+
and 'cloudlinux' in distro_info['name'].lower():
1091+
distro_info['id'] = 'cloudlinux'
1092+
elif match:
10901093
distro_info['id'] = match.group(1)
10911094
return distro_info
10921095
else:
@@ -1127,6 +1130,8 @@ def _distro_release_info(self):
11271130
# The name is always present if the pattern matches
11281131
self.distro_release_file = filepath
11291132
distro_info['id'] = match.group(1)
1133+
if 'cloudlinux' in distro_info['name'].lower():
1134+
distro_info['id'] = 'cloudlinux'
11301135
return distro_info
11311136
return {}
11321137

tests/test_distro.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def test_cloudlinux5_dist_release(self):
877877
# Uses redhat-release only to get information.
878878
# The id of 'rhel' can only be fixed with issue #109.
879879
desired_outcome = {
880-
'id': 'rhel',
880+
'id': 'cloudlinux',
881881
'codename': 'Vladislav Volkov',
882882
'name': 'CloudLinux Server',
883883
'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)',
@@ -892,7 +892,7 @@ def test_cloudlinux5_dist_release(self):
892892
def test_cloudlinux6_dist_release(self):
893893
# Same as above, only has redhat-release.
894894
desired_outcome = {
895-
'id': 'rhel',
895+
'id': 'cloudlinux',
896896
'codename': 'Oleg Makarov',
897897
'name': 'CloudLinux Server',
898898
'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)',
@@ -906,7 +906,7 @@ def test_cloudlinux6_dist_release(self):
906906

907907
def test_cloudlinux7_dist_release(self):
908908
desired_outcome = {
909-
'id': 'rhel',
909+
'id': 'cloudlinux',
910910
'codename': 'Yury Malyshev',
911911
'name': 'CloudLinux',
912912
'pretty_name': 'CloudLinux 7.3 (Yury Malyshev)',
@@ -1568,7 +1568,7 @@ def test_cloudlinux5_release(self):
15681568
# Uses redhat-release only to get information.
15691569
# The id of 'rhel' can only be fixed with issue #109.
15701570
desired_outcome = {
1571-
'id': 'rhel',
1571+
'id': 'cloudlinux',
15721572
'codename': 'Vladislav Volkov',
15731573
'name': 'CloudLinux Server',
15741574
'pretty_name': 'CloudLinux Server 5.11 (Vladislav Volkov)',
@@ -1583,7 +1583,7 @@ def test_cloudlinux5_release(self):
15831583
def test_cloudlinux6_release(self):
15841584
# Same as above, only has redhat-release.
15851585
desired_outcome = {
1586-
'id': 'rhel',
1586+
'id': 'cloudlinux',
15871587
'codename': 'Oleg Makarov',
15881588
'name': 'CloudLinux Server',
15891589
'pretty_name': 'CloudLinux Server 6.8 (Oleg Makarov)',

0 commit comments

Comments
 (0)