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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
slapos
Commits
e35a6840
Commit
e35a6840
authored
Oct 26, 2022
by
Cédric Le Ninivin
Committed by
Cédric Le Ninivin
Nov 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapconfiguration: parameters is a dict and not a json
parent
8666c359
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 @
e35a6840
...
@@ -30,7 +30,6 @@ import logging
...
@@ -30,7 +30,6 @@ import logging
import
os
import
os
import
slapos.slap
import
slapos.slap
from
slapos.slap.slap
import
json_loads_byteified
from
slapos.recipe.librecipe
import
unwrap
from
slapos.recipe.librecipe
import
unwrap
import
six
import
six
from
six.moves.configparser
import
RawConfigParser
from
six.moves.configparser
import
RawConfigParser
...
@@ -43,6 +42,7 @@ from slapos import format as slapformat
...
@@ -43,6 +42,7 @@ from slapos import format as slapformat
logger
=
logging
.
getLogger
(
"slapos"
)
logger
=
logging
.
getLogger
(
"slapos"
)
import
time
class
Recipe
(
object
):
class
Recipe
(
object
):
"""
"""
...
@@ -135,6 +135,9 @@ class Recipe(object):
...
@@ -135,6 +135,9 @@ class Recipe(object):
1. SlapOS Master - for external computer/partition information
1. SlapOS Master - for external computer/partition information
2. format.Partition.resource_file - for partition specific details
2. format.Partition.resource_file - for partition specific details
"""
"""
start
=
time
.
time
()
shared_instance_list
=
[]
software_instance
=
None
software_instance
=
None
instance_json_path
=
os
.
path
.
join
(
instance_root
,
SOFTWARE_INSTANCE_JSON_FILENAME
)
instance_json_path
=
os
.
path
.
join
(
instance_root
,
SOFTWARE_INSTANCE_JSON_FILENAME
)
...
@@ -175,7 +178,7 @@ class Recipe(object):
...
@@ -175,7 +178,7 @@ class Recipe(object):
options
[
"instance-guid"
]
=
software_instance
.
get
(
"reference"
)
options
[
"instance-guid"
]
=
software_instance
.
get
(
"reference"
)
ip_list
=
software_instance
.
get
(
"ip_list"
,
[])
ip_list
=
software_instance
.
get
(
"ip_list"
,
[])
full_ip_list
=
software_instance
.
get
(
"full_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
# Get Share instance list
if
not
"slave_instance_list"
in
software_instance
:
if
not
"slave_instance_list"
in
software_instance
:
...
@@ -190,7 +193,7 @@ class Recipe(object):
...
@@ -190,7 +193,7 @@ class Recipe(object):
"portal_type"
:
"Software Instance"
,
"portal_type"
:
"Software Instance"
,
"reference"
:
shared_instance_brain
.
get
(
"reference"
),
"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_connection
=
shared_instance
.
get
(
"connection_parameters"
)
shared_instance_list
.
append
({
shared_instance_list
.
append
({
'slave_title'
:
shared_instance
.
get
(
"title"
),
'slave_title'
:
shared_instance
.
get
(
"title"
),
...
@@ -198,9 +201,7 @@ class Recipe(object):
...
@@ -198,9 +201,7 @@ class Recipe(object):
shared_instance
.
get
(
"software_type"
),
shared_instance
.
get
(
"software_type"
),
'slave_reference'
:
shared_instance
.
get
(
"reference"
),
'slave_reference'
:
shared_instance
.
get
(
"reference"
),
'timestamp'
:
shared_instance
.
get
(
"processing_timestamp"
),
'timestamp'
:
shared_instance
.
get
(
"processing_timestamp"
),
'xml'
:
dumps
(
shared_instance_parameter
),
'parameters'
:
shared_instance_parameter
,
'parameters'
:
shared_instance_parameter
,
'connection_xml'
:
dumps
(
shared_instance_connection
),
'connection_parameters'
:
shared_instance_connection
,
'connection_parameters'
:
shared_instance_connection
,
'connection-parameter-hash'
:
calculate_dict_hash
(
shared_instance_connection
),
'connection-parameter-hash'
:
calculate_dict_hash
(
shared_instance_connection
),
})
})
...
@@ -328,6 +329,14 @@ class Recipe(object):
...
@@ -328,6 +329,14 @@ class Recipe(object):
options
[
key
]
=
value
options
[
key
]
=
value
# print out augmented options to see what we are passing
# print out augmented options to see what we are passing
logger
.
debug
(
str
(
options
))
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
)
return
self
.
_expandParameterDict
(
options
,
parameter_dict
)
def
_expandParameterDict
(
self
,
options
,
parameter_dict
):
def
_expandParameterDict
(
self
,
options
,
parameter_dict
):
...
...
slapos/test/recipe/test_slaposconfiguration.py
View file @
e35a6840
...
@@ -93,7 +93,7 @@ class SlapConfigurationTestMixin(object):
...
@@ -93,7 +93,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
"10.0.246.114"
]
]
],
],
"parameters"
:
json
.
dumps
(
parameter_dict
)
,
"parameters"
:
parameter_dict
,
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
}
}
if
self
.
use_api
:
if
self
.
use_api
:
...
@@ -159,7 +159,7 @@ class SlapConfigurationTestMixin(object):
...
@@ -159,7 +159,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
"10.0.246.114"
]
]
],
],
"parameters"
:
json
.
dumps
(
parameter_dict
)
,
"parameters"
:
parameter_dict
,
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
"connection_parameters"
:
{
"1"
:
2
,
"3"
:
"YourURL"
},
}
}
shared_instance_parameter_dict
=
{
"zooo"
:
"heee"
,
"bye"
:
"hello"
}
shared_instance_parameter_dict
=
{
"zooo"
:
"heee"
,
"bye"
:
"hello"
}
...
@@ -183,7 +183,7 @@ class SlapConfigurationTestMixin(object):
...
@@ -183,7 +183,7 @@ class SlapConfigurationTestMixin(object):
"10.0.246.114"
"10.0.246.114"
]
]
],
],
"parameters"
:
json
.
dumps
(
shared_instance_parameter_dict
)
,
"parameters"
:
shared_instance_parameter_dict
,
"connection_parameters"
:
{
"4"
:
6
,
"8"
:
"YourURL2"
},
"connection_parameters"
:
{
"4"
:
6
,
"8"
:
"YourURL2"
},
}
}
if
self
.
use_api
:
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