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
Léo-Paul Géneau
slapos.core
Commits
133bd4bd
Commit
133bd4bd
authored
Feb 10, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grid: Add shared-parts-list to slap-connection
See merge request
nexedi/slapos.core!489
parent
47d81bef
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
1 deletion
+48
-1
slapos/grid/SlapObject.py
slapos/grid/SlapObject.py
+3
-0
slapos/grid/slapgrid.py
slapos/grid/slapgrid.py
+3
-0
slapos/grid/templates/buildout-tail.cfg.in
slapos/grid/templates/buildout-tail.cfg.in
+2
-0
slapos/tests/test_object.py
slapos/tests/test_object.py
+40
-1
No files found.
slapos/grid/SlapObject.py
View file @
133bd4bd
...
@@ -408,6 +408,7 @@ class Partition(object):
...
@@ -408,6 +408,7 @@ class Partition(object):
def
__init__
(
self
,
def
__init__
(
self
,
software_path
,
software_path
,
instance_path
,
instance_path
,
shared_part_list
,
supervisord_partition_configuration_path
,
supervisord_partition_configuration_path
,
supervisord_socket
,
supervisord_socket
,
computer_partition
,
computer_partition
,
...
@@ -431,6 +432,7 @@ class Partition(object):
...
@@ -431,6 +432,7 @@ class Partition(object):
self
.
logger
=
logger
self
.
logger
=
logger
self
.
software_path
=
software_path
self
.
software_path
=
software_path
self
.
instance_path
=
instance_path
self
.
instance_path
=
instance_path
self
.
shared_part_list
=
shared_part_list
self
.
run_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'run'
)
self
.
run_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'run'
)
self
.
service_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'service'
)
self
.
service_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'service'
)
self
.
prerm_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'prerm'
)
self
.
prerm_path
=
os
.
path
.
join
(
self
.
instance_path
,
'etc'
,
'prerm'
)
...
@@ -639,6 +641,7 @@ class Partition(object):
...
@@ -639,6 +641,7 @@ class Partition(object):
'cert_file'
:
self
.
cert_file
,
'cert_file'
:
self
.
cert_file
,
'storage_home'
:
self
.
instance_storage_home
,
'storage_home'
:
self
.
instance_storage_home
,
'global_ipv4_network_prefix'
:
self
.
ipv4_global_network
,
'global_ipv4_network_prefix'
:
self
.
ipv4_global_network
,
'shared_part_list'
:
' '
.
join
(
self
.
shared_part_list
.
strip
().
splitlines
(
True
))
}
}
with
open
(
config_location
,
'w'
)
as
f
:
with
open
(
config_location
,
'w'
)
as
f
:
f
.
write
(
buildout_text
)
f
.
write
(
buildout_text
)
...
...
slapos/grid/slapgrid.py
View file @
133bd4bd
...
@@ -1076,6 +1076,7 @@ stderr_logfile_backups=1
...
@@ -1076,6 +1076,7 @@ stderr_logfile_backups=1
local_partition
=
Partition
(
local_partition
=
Partition
(
software_path
=
software_path
,
software_path
=
software_path
,
instance_path
=
instance_path
,
instance_path
=
instance_path
,
shared_part_list
=
self
.
shared_part_list
,
supervisord_partition_configuration_path
=
os
.
path
.
join
(
supervisord_partition_configuration_path
=
os
.
path
.
join
(
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
computer_partition_id
+
'.conf'
),
computer_partition_id
+
'.conf'
),
...
@@ -1172,6 +1173,7 @@ stderr_logfile_backups=1
...
@@ -1172,6 +1173,7 @@ stderr_logfile_backups=1
local_partition
=
Partition
(
local_partition
=
Partition
(
software_path
=
software_path
,
software_path
=
software_path
,
instance_path
=
instance_path
,
instance_path
=
instance_path
,
shared_part_list
=
self
.
shared_part_list
,
supervisord_partition_configuration_path
=
os
.
path
.
join
(
supervisord_partition_configuration_path
=
os
.
path
.
join
(
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
'%s.conf'
%
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
'%s.conf'
%
computer_partition_id
),
computer_partition_id
),
...
@@ -1833,6 +1835,7 @@ stderr_logfile_backups=1
...
@@ -1833,6 +1835,7 @@ stderr_logfile_backups=1
software_path
=
software_path
,
software_path
=
software_path
,
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
instance_path
=
os
.
path
.
join
(
self
.
instance_root
,
computer_partition
.
getId
()),
computer_partition
.
getId
()),
shared_part_list
=
self
.
shared_part_list
,
supervisord_partition_configuration_path
=
os
.
path
.
join
(
supervisord_partition_configuration_path
=
os
.
path
.
join
(
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
'%s.conf'
%
_getSupervisordConfigurationDirectory
(
self
.
instance_root
),
'%s.conf'
%
computer_partition_id
),
computer_partition_id
),
...
...
slapos/grid/templates/buildout-tail.cfg.in
View file @
133bd4bd
...
@@ -13,6 +13,8 @@ server-url = %(server_url)s
...
@@ -13,6 +13,8 @@ server-url = %(server_url)s
software-release-url = %(software_release_url)s
software-release-url = %(software_release_url)s
key-file = %(key_file)s
key-file = %(key_file)s
cert-file = %(cert_file)s
cert-file = %(cert_file)s
shared-part-list =
%(shared_part_list)s
[slap_connection]
[slap_connection]
# Kept for backward compatiblity
# Kept for backward compatiblity
...
...
slapos/tests/test_object.py
View file @
133bd4bd
...
@@ -33,6 +33,8 @@ import unittest
...
@@ -33,6 +33,8 @@ import unittest
import
shutil
import
shutil
import
tempfile
import
tempfile
from
six.moves.configparser
import
ConfigParser
from
slapos.slap
import
ComputerPartition
as
SlapComputerPartition
from
slapos.slap
import
ComputerPartition
as
SlapComputerPartition
from
slapos.grid.SlapObject
import
Partition
,
Software
from
slapos.grid.SlapObject
import
Partition
,
Software
...
@@ -135,7 +137,8 @@ class MasterMixin(BasicMixin, unittest.TestCase):
...
@@ -135,7 +137,8 @@ class MasterMixin(BasicMixin, unittest.TestCase):
partition_id
=
None
,
partition_id
=
None
,
slap_computer_partition
=
None
,
slap_computer_partition
=
None
,
retention_delay
=
None
,
retention_delay
=
None
,
partition_timeout
=
None
partition_timeout
=
None
,
shared_part_list
=
''
,
):
):
"""
"""
Create a partition, and return a Partition object created
Create a partition, and return a Partition object created
...
@@ -166,6 +169,7 @@ class MasterMixin(BasicMixin, unittest.TestCase):
...
@@ -166,6 +169,7 @@ class MasterMixin(BasicMixin, unittest.TestCase):
partition
=
Partition
(
partition
=
Partition
(
software_path
=
software_path
,
software_path
=
software_path
,
instance_path
=
instance_path
,
instance_path
=
instance_path
,
shared_part_list
=
shared_part_list
,
supervisord_partition_configuration_path
=
os
.
path
.
join
(
supervisord_partition_configuration_path
=
os
.
path
.
join
(
supervisor_configuration_path
,
partition_id
),
supervisor_configuration_path
,
partition_id
),
supervisord_socket
=
os
.
path
.
join
(
supervisord_socket
=
os
.
path
.
join
(
...
@@ -413,6 +417,18 @@ class TestPartitionSlapObject(MasterMixin, unittest.TestCase):
...
@@ -413,6 +417,18 @@ class TestPartitionSlapObject(MasterMixin, unittest.TestCase):
self
.
assertTrue
(
utils
.
launchBuildout
.
called
)
self
.
assertTrue
(
utils
.
launchBuildout
.
called
)
def
test_instance_is_deploying_if_software_release_exists
(
self
):
"""
Test that slapgrid deploys an instance if its Software Release exists and
instance.cfg in the Software Release exists.
"""
software
=
self
.
createSoftware
()
partition
=
self
.
createPartition
(
software
.
url
)
partition
.
install
()
self
.
assertTrue
(
utils
.
launchBuildout
.
called
)
def
test_backward_compatibility_instance_is_deploying_if_template_cfg_is_used
(
self
):
def
test_backward_compatibility_instance_is_deploying_if_template_cfg_is_used
(
self
):
"""
"""
Backward compatibility test, for old software releases.
Backward compatibility test, for old software releases.
...
@@ -455,6 +471,29 @@ class TestPartitionSlapObject(MasterMixin, unittest.TestCase):
...
@@ -455,6 +471,29 @@ class TestPartitionSlapObject(MasterMixin, unittest.TestCase):
# XXX: What should it raise?
# XXX: What should it raise?
self
.
assertRaises
(
IOError
,
partition
.
install
)
self
.
assertRaises
(
IOError
,
partition
.
install
)
def
test_buildout_tail_contains_shared_parts
(
self
):
"""
Check that shared-part-list in included in buildout tail.
"""
software
=
self
.
createSoftware
()
partition
=
self
.
createPartition
(
software
.
url
,
shared_part_list
=
'bogus/shared/part'
)
partition
.
install
()
buildout_cfg
=
os
.
path
.
join
(
partition
.
instance_path
,
'buildout.cfg'
)
config
=
ConfigParser
()
config
.
read
(
buildout_cfg
)
self
.
assertTrue
(
config
.
has_option
(
'slap-connection'
,
'shared-part-list'
))
self
.
assertEqual
(
config
.
get
(
'slap-connection'
,
'shared-part-list'
).
strip
(),
'bogus/shared/part'
)
class
TestPartitionSupervisorConfig
(
MasterMixin
,
unittest
.
TestCase
):
class
TestPartitionSupervisorConfig
(
MasterMixin
,
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
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