Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
slapos.core
Commits
006a4925
Commit
006a4925
authored
Mar 22, 2022
by
Thomas Gambier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: fix comparison of OS to keep compatibility
parent
49c80882
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
slapos/grid/distribution.py
slapos/grid/distribution.py
+11
-7
slapos/tests/test_distribution.py
slapos/tests/test_distribution.py
+1
-0
No files found.
slapos/grid/distribution.py
View file @
006a4925
...
@@ -42,18 +42,22 @@ import distro
...
@@ -42,18 +42,22 @@ import distro
def
_debianize
(
os_
):
def
_debianize
(
os_
):
"""
"""
* keep only the major release number in case of debian, otherwise
minor releases would be seen as not compatible to each other.
* consider raspbian as debian
* consider raspbian as debian
* don't use codename
* in case of Debian:
+ keep only the major release number, otherwise minor releases would be
seen as not compatible to each other.
+ don't use codename as it was always empty with platform.linux_distribution
and we want to keep compatibility with what was already pushed in shacache
"""
"""
distname
,
version
,
codename
_
=
os_
distname
,
version
,
codename
=
os_
distname
=
distname
.
lower
()
distname
=
distname
.
lower
()
if
distname
==
'raspbian'
:
if
distname
==
'raspbian'
:
distname
=
'debian'
distname
=
'debian'
if
distname
==
'debian'
and
'.'
in
version
:
if
distname
==
'debian'
:
if
'.'
in
version
:
version
=
version
.
split
(
'.'
)[
0
]
version
=
version
.
split
(
'.'
)[
0
]
return
distname
,
version
,
''
codename
=
''
return
distname
,
version
,
codename
def
os_matches
(
os1
,
os2
):
def
os_matches
(
os1
,
os2
):
...
...
slapos/tests/test_distribution.py
View file @
006a4925
...
@@ -45,6 +45,7 @@ class TestDebianize(unittest.TestCase):
...
@@ -45,6 +45,7 @@ class TestDebianize(unittest.TestCase):
((
'debian'
,
'6.0.6'
,
''
),
(
'debian'
,
'6'
,
''
)),
((
'debian'
,
'6.0.6'
,
''
),
(
'debian'
,
'6'
,
''
)),
((
'debian'
,
'7.0'
,
''
),
(
'debian'
,
'7'
,
''
)),
((
'debian'
,
'7.0'
,
''
),
(
'debian'
,
'7'
,
''
)),
((
'Debian'
,
'8.11'
,
''
),
(
'debian'
,
'8'
,
''
)),
((
'Debian'
,
'8.11'
,
''
),
(
'debian'
,
'8'
,
''
)),
((
'debian'
,
'10.9'
,
'buster'
),
(
'debian'
,
'10'
,
''
)),
]:
]:
self
.
assertEqual
(
distribution
.
_debianize
(
provided
),
expected
)
self
.
assertEqual
(
distribution
.
_debianize
(
provided
),
expected
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment