Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Titouan Soulard
slapos
Commits
eff28fd4
Commit
eff28fd4
authored
Oct 26, 2022
by
Cédric Le Ninivin
Committed by
Titouan Soulard
Mar 11, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapconfiguration: parameters is a dict and not a json
parent
a54ac2c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
slapos/recipe/slapconfiguration.py
slapos/recipe/slapconfiguration.py
+14
-5
slapos/test/recipe/test_slaposconfiguration.py
slapos/test/recipe/test_slaposconfiguration.py
+3
-3
No files found.
slapos/recipe/slapconfiguration.py
View file @
eff28fd4
...
...
@@ -30,7 +30,6 @@ import logging
import
os
import
slapos.slap
from
slapos.slap.slap
import
json_loads_byteified
from
slapos.recipe.librecipe
import
unwrap
import
six
from
six.moves.configparser
import
RawConfigParser
...
...
@@ -43,6 +42,7 @@ from slapos import format as slapformat
logger
=
logging
.
getLogger
(
"slapos"
)
import
time
class
Recipe
(
object
):
"""
...
...
@@ -135,6 +135,9 @@ class Recipe(object):
1. SlapOS Master - for external computer/partition information
2. format.Partition.resource_file - for partition specific details
"""
start
=
time
.
time
()
shared_instance_list
=
[]
software_instance
=
None
instance_json_path
=
os
.
path
.
join
(
instance_root
,
SOFTWARE_INSTANCE_JSON_FILENAME
)
...
...
@@ -175,7 +178,7 @@ class Recipe(object):
options
[
"instance-guid"
]
=
software_instance
.
get
(
"reference"
)
ip_list
=
software_instance
.
get
(
"ip_list"
,
[])
full_ip_list
=
software_instance
.
get
(
"full_ip_list"
,
[])
parameter_dict
=
json_loads_byteified
(
software_instance
.
get
(
"parameters"
)
)
parameter_dict
=
software_instance
.
get
(
"parameters"
)
# Get Share instance list
if
not
"slave_instance_list"
in
software_instance
:
...
...
@@ -190,7 +193,7 @@ class Recipe(object):
"portal_type"
:
"Software Instance"
,
"reference"
:
shared_instance_brain
.
get
(
"reference"
),
})
shared_instance_parameter
=
json_loads_byteified
(
shared_instance
.
get
(
"parameters"
)
)
shared_instance_parameter
=
shared_instance
.
get
(
"parameters"
)
shared_instance_connection
=
shared_instance
.
get
(
"connection_parameters"
)
shared_instance_list
.
append
({
'slave_title'
:
shared_instance
.
get
(
"title"
),
...
...
@@ -198,9 +201,7 @@ class Recipe(object):
shared_instance
.
get
(
"software_type"
),
'slave_reference'
:
shared_instance
.
get
(
"reference"
),
'timestamp'
:
shared_instance
.
get
(
"processing_timestamp"
),
'xml'
:
dumps
(
shared_instance_parameter
),
'parameters'
:
shared_instance_parameter
,
'connection_xml'
:
dumps
(
shared_instance_connection
),
'connection_parameters'
:
shared_instance_connection
,
'connection-parameter-hash'
:
calculate_dict_hash
(
shared_instance_connection
),
})
...
...
@@ -328,6 +329,14 @@ class Recipe(object):
options
[
key
]
=
value
# print out augmented options to see what we are passing
logger
.
debug
(
str
(
options
))
end
=
time
.
time
()
elapsed
=
end
-
start
logger
.
warning
(
"----------------------------------------------------------------------------------------------------------------"
)
logger
.
warning
(
"Number of hosted instances: %s"
%
len
(
shared_instance_list
))
logger
.
warning
(
"Elapsed time: %s"
%
elapsed
)
logger
.
warning
(
"----------------------------------------------------------------------------------------------------------------"
)
return
self
.
_expandParameterDict
(
options
,
parameter_dict
)
def
_expandParameterDict
(
self
,
options
,
parameter_dict
):
...
...
slapos/test/recipe/test_slaposconfiguration.py
View file @
eff28fd4
...
...
@@ -93,7 +93,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
]
],
"parameters"
:
json
.
dumps
(
parameter_dict
)
,
"parameters"
:
parameter_dict
,
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
}
if
self
.
use_api
:
...
...
@@ -159,7 +159,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
]
],
"parameters"
:
json
.
dumps
(
parameter_dict
)
,
"parameters"
:
parameter_dict
,
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
}
shared_instance_parameter_dict
=
{
"zooo"
:
"heee"
,
"bye"
:
"hello"
}
...
...
@@ -183,7 +183,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
]
],
"parameters"
:
json
.
dumps
(
shared_instance_parameter_dict
)
,
"parameters"
:
shared_instance_parameter_dict
,
"connection_parameters"
:
{
"4"
:
6
,
"8"
:
"YourURL2"
},
}
if
self
.
use_api
:
...
...
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