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
Nicolas Wavrant
slapos.core
Commits
421c8876
Commit
421c8876
authored
May 14, 2013
by
Marco Mariani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'slapos node instance' reports unknown partitions
parent
f469ae7d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+10
-0
slapos/tests/slapgrid.py
slapos/tests/slapgrid.py
+23
-0
No files found.
slapos/grid/slapgrid.py
View file @
421c8876
...
@@ -228,6 +228,13 @@ def create_slapgrid_object(options, logger):
...
@@ -228,6 +228,13 @@ def create_slapgrid_object(options, logger):
computer_partition_filter_list
=
op
.
get
(
'only-cp'
,
op
.
get
(
'only_cp'
)))
computer_partition_filter_list
=
op
.
get
(
'only-cp'
,
op
.
get
(
'only_cp'
)))
def
check_required_only_partitions
(
existing
,
required
):
missing
=
set
(
required
)
-
set
(
existing
)
if
missing
:
plural
=
[
's'
,
''
][
len
(
missing
)
==
1
]
raise
ValueError
(
'Unknown partition%s: %s'
%
(
plural
,
', '
.
join
(
sorted
(
missing
))))
class
Slapgrid
(
object
):
class
Slapgrid
(
object
):
""" Main class for SlapGrid. Fetches and processes informations from master
""" Main class for SlapGrid. Fetches and processes informations from master
server and pushes usage information to master server.
server and pushes usage information to master server.
...
@@ -737,6 +744,9 @@ class Slapgrid(object):
...
@@ -737,6 +744,9 @@ class Slapgrid(object):
# Boolean to know if every promises correctly passed
# Boolean to know if every promises correctly passed
clean_run_promise
=
True
clean_run_promise
=
True
check_required_only_partitions
([
cp
.
getId
()
for
cp
in
self
.
getComputerPartitionList
()],
self
.
computer_partition_filter_list
)
# Filter all dummy / empty partitions
# Filter all dummy / empty partitions
computer_partition_list
=
self
.
FilterComputerPartitionList
(
computer_partition_list
=
self
.
FilterComputerPartitionList
(
self
.
getComputerPartitionList
())
self
.
getComputerPartitionList
())
...
...
slapos/tests/slapgrid.py
View file @
421c8876
...
@@ -153,6 +153,29 @@ class BasicMixin:
...
@@ -153,6 +153,29 @@ class BasicMixin:
shutil
.
rmtree
(
self
.
_tempdir
,
True
)
shutil
.
rmtree
(
self
.
_tempdir
,
True
)
class
TestRequiredOnlyPartitions
(
unittest2
.
TestCase
):
def
test_no_errors
(
self
):
required
=
[
'one'
,
'three'
]
existing
=
[
'one'
,
'two'
,
'three'
]
slapgrid
.
check_required_only_partitions
(
existing
,
required
)
def
test_one_missing
(
self
):
required
=
[
'foobar'
,
'two'
,
'one'
]
existing
=
[
'one'
,
'two'
,
'three'
]
self
.
assertRaisesRegexp
(
ValueError
,
'Unknown partition: foobar'
,
slapgrid
.
check_required_only_partitions
,
existing
,
required
)
def
test_several_missing
(
self
):
required
=
[
'foobar'
,
'barbaz'
]
existing
=
[
'one'
,
'two'
,
'three'
]
self
.
assertRaisesRegexp
(
ValueError
,
'Unknown partitions: barbaz, foobar'
,
slapgrid
.
check_required_only_partitions
,
existing
,
required
)
class
TestBasicSlapgridCP
(
BasicMixin
,
unittest2
.
TestCase
):
class
TestBasicSlapgridCP
(
BasicMixin
,
unittest2
.
TestCase
):
def
test_no_software_root
(
self
):
def
test_no_software_root
(
self
):
self
.
assertRaises
(
OSError
,
self
.
grid
.
processComputerPartitionList
)
self
.
assertRaises
(
OSError
,
self
.
grid
.
processComputerPartitionList
)
...
...
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