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
Thomas Leymonerie
slapos.core
Commits
24bd11cf
Commit
24bd11cf
authored
Mar 30, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_slap_tool: Remove minor duplication
parent
2b579871
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
...onentTemplateItem/portal_components/tool.erp5.SlapTool.py
+12
-20
No files found.
master/bt5/slapos_slap_tool/ToolComponentTemplateItem/portal_components/tool.erp5.SlapTool.py
View file @
24bd11cf
...
@@ -101,6 +101,15 @@ def convertToREST(function):
...
@@ -101,6 +101,15 @@ def convertToREST(function):
wrapper
.
__doc__
=
function
.
__doc__
wrapper
.
__doc__
=
function
.
__doc__
return
wrapper
return
wrapper
def
castToStr
(
dict_kw
):
instance
=
etree
.
Element
(
'instance'
)
for
_id
,
_value
in
dict_kw
.
iteritems
():
# cast everything to string
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
_id
}).
text
=
str
(
_value
)
return
etree
.
tostring
(
instance
,
pretty_print
=
True
,
xml_declaration
=
True
,
encoding
=
'utf-8'
)
def
_assertACI
(
document
):
def
_assertACI
(
document
):
sm
=
getSecurityManager
()
sm
=
getSecurityManager
()
...
@@ -876,30 +885,12 @@ class SlapTool(BaseTool):
...
@@ -876,30 +885,12 @@ class SlapTool(BaseTool):
else
:
else
:
filter_kw
=
dict
()
filter_kw
=
dict
()
instance
=
etree
.
Element
(
'instance'
)
for
parameter_id
,
parameter_value
in
partition_parameter_kw
.
iteritems
():
# cast everything to string
parameter_value
=
str
(
parameter_value
)
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
parameter_id
}).
text
=
parameter_value
instance_xml
=
etree
.
tostring
(
instance
,
pretty_print
=
True
,
xml_declaration
=
True
,
encoding
=
'utf-8'
)
instance
=
etree
.
Element
(
'instance'
)
for
parameter_id
,
parameter_value
in
filter_kw
.
iteritems
():
# cast everything to string
parameter_value
=
str
(
parameter_value
)
etree
.
SubElement
(
instance
,
"parameter"
,
attrib
=
{
'id'
:
parameter_id
}).
text
=
parameter_value
sla_xml
=
etree
.
tostring
(
instance
,
pretty_print
=
True
,
xml_declaration
=
True
,
encoding
=
'utf-8'
)
kw
=
dict
(
software_release
=
software_release
,
kw
=
dict
(
software_release
=
software_release
,
software_type
=
software_type
,
software_type
=
software_type
,
software_title
=
partition_reference
,
software_title
=
partition_reference
,
instance_xml
=
instance_xml
,
instance_xml
=
castToStr
(
partition_parameter_kw
)
,
shared
=
shared
,
shared
=
shared
,
sla_xml
=
sla_xml
,
sla_xml
=
castToStr
(
filter_kw
)
,
state
=
state
)
state
=
state
)
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
@@ -932,6 +923,7 @@ class SlapTool(BaseTool):
...
@@ -932,6 +923,7 @@ class SlapTool(BaseTool):
if
compute_node_id
and
compute_partition_id
:
if
compute_node_id
and
compute_partition_id
:
requester
.
requestInstance
(
**
kw
)
requester
.
requestInstance
(
**
kw
)
else
:
else
:
# requester is a person so we use another method
requester
.
requestSoftwareInstance
(
**
kw
)
requester
.
requestSoftwareInstance
(
**
kw
)
requested_software_instance
=
self
.
REQUEST
.
get
(
'request_instance'
)
requested_software_instance
=
self
.
REQUEST
.
get
(
'request_instance'
)
if
requested_software_instance
is
not
None
:
if
requested_software_instance
is
not
None
:
...
...
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