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
Ophélie Gagnard
slapos.core
Commits
f8e83af8
Commit
f8e83af8
authored
Nov 26, 2020
by
Thomas Gambier
🚴🏼
Browse files
Options
Browse Files
Download
Plain Diff
slapgrid: compare os name in lower case
See merge request
nexedi/slapos.core!268
parents
0b7eff7b
bc79d780
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
slapos/grid/distribution.py
slapos/grid/distribution.py
+1
-2
slapos/tests/test_distribution.py
slapos/tests/test_distribution.py
+9
-6
No files found.
slapos/grid/distribution.py
View file @
f8e83af8
...
@@ -58,8 +58,7 @@ def _debianize(os_):
...
@@ -58,8 +58,7 @@ def _debianize(os_):
distname_lower
=
distname
.
lower
()
distname_lower
=
distname
.
lower
()
if
distname_lower
==
'debian'
and
'.'
in
version
:
if
distname_lower
==
'debian'
and
'.'
in
version
:
version
=
version
.
split
(
'.'
)[
0
]
version
=
version
.
split
(
'.'
)[
0
]
distname
=
distname_lower
return
distname_lower
,
version
,
id_
return
distname
,
version
,
id_
def
os_matches
(
os1
,
os2
):
def
os_matches
(
os1
,
os2
):
...
...
slapos/tests/test_distribution.py
View file @
f8e83af8
...
@@ -35,17 +35,18 @@ class TestDebianize(unittest.TestCase):
...
@@ -35,17 +35,18 @@ class TestDebianize(unittest.TestCase):
def
test_debian_major
(
self
):
def
test_debian_major
(
self
):
"""
"""
On debian, we only care about major release.
On debian, we only care about major release.
All the other tuples are unchanged.
All the other tuples are unchanged
(except distribution name which is lower case)
.
"""
"""
for
provided
,
expected
in
[
for
provided
,
expected
in
[
((
'CentOS'
,
'6.3'
,
'Final'
),
None
),
((
'CentOS'
,
'6.3'
,
'Final'
),
(
'centos'
,
'6.3'
,
'Final'
)
),
((
'Ubuntu'
,
'12.04'
,
'precise'
),
None
),
((
'Ubuntu'
,
'12.04'
,
'precise'
),
(
'ubuntu'
,
'12.04'
,
'precise'
)
),
((
'Ubuntu'
,
'13.04'
,
'raring'
),
None
),
((
'Ubuntu'
,
'13.04'
,
'raring'
),
(
'ubuntu'
,
'13.04'
,
'raring'
)
),
((
'Fedora'
,
'17'
,
'Beefy Miracle'
),
None
),
((
'Fedora'
,
'17'
,
'Beefy Miracle'
),
(
'fedora'
,
'17'
,
'Beefy Miracle'
)
),
((
'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'
,
''
)),
]:
]:
self
.
assertEqual
(
distribution
.
_debianize
(
provided
),
expected
or
provided
)
self
.
assertEqual
(
distribution
.
_debianize
(
provided
),
expected
)
class
TestOSMatches
(
unittest
.
TestCase
):
class
TestOSMatches
(
unittest
.
TestCase
):
...
@@ -70,3 +71,5 @@ class TestOSMatches(unittest.TestCase):
...
@@ -70,3 +71,5 @@ class TestOSMatches(unittest.TestCase):
(
'debian'
,
'6.0.5'
,
''
)))
(
'debian'
,
'6.0.5'
,
''
)))
self
.
assertTrue
(
distribution
.
os_matches
((
'debian'
,
'6.0.6'
,
''
),
self
.
assertTrue
(
distribution
.
os_matches
((
'debian'
,
'6.0.6'
,
''
),
(
'debian'
,
'6.1'
,
''
)))
(
'debian'
,
'6.1'
,
''
)))
self
.
assertTrue
(
distribution
.
os_matches
((
'Debian'
,
'8.11'
,
''
),
(
'debian'
,
'8.4'
,
''
)))
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