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
Lu Xu
slapos.core
Commits
e98e0734
Commit
e98e0734
authored
Mar 25, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get all ip addresses used in hosting subscription
parent
61c43669
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
master/product/Vifib/Tool/SlapTool.py
master/product/Vifib/Tool/SlapTool.py
+58
-0
No files found.
master/product/Vifib/Tool/SlapTool.py
View file @
e98e0734
...
@@ -272,6 +272,42 @@ class SlapTool(BaseTool):
...
@@ -272,6 +272,42 @@ class SlapTool(BaseTool):
self
.
_getSlapPartitionByPackingList
(
_assertACI
(
computer_partition
.
getObject
())))
self
.
_getSlapPartitionByPackingList
(
_assertACI
(
computer_partition
.
getObject
())))
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
slap_computer
)
@
UnrestrictedMethod
def
_getHostingSubscriptionIpList
(
self
,
computer_id
,
computer_partition_id
):
def
getHostingSubscriptionInstanceList
(
software_instance
):
pred_list
=
[]
if
software_instance
is
None
or
software_instance
.
getSlapState
()
==
'destroy_requested'
:
return
pred_list
else
:
if
software_instance
.
getPortalType
()
==
'Software Instance'
:
pred_list
.
append
(
software_instance
)
predecessor_list
=
software_instance
.
getPredecessorValueList
(
portal_type
=
"Software Instance"
)
for
instance
in
predecessor_list
:
pred_list
.
extend
(
getHostingSubscriptionInstanceList
(
instance
))
return
pred_list
software_instance
=
self
.
_getSoftwareInstanceForComputerPartition
(
computer_id
,
computer_partition_id
)
# Search hosting subscription
hosting
=
software_instance
.
getSpecialiseValue
()
while
hosting
and
hosting
.
getPortalType
()
!=
"Hosting Subscription"
:
hosting
=
hosting
.
getSpecialiseValue
()
ip_address_list
=
[]
for
instance
in
getHostingSubscriptionInstanceList
(
hosting
):
computer_partition
=
instance
.
getAggregateValue
(
portal_type
=
"Computer Partition"
)
if
not
computer_partition
:
continue
for
internet_protocol_address
in
computer_partition
.
contentValues
(
portal_type
=
'Internet Protocol Address'
):
ip_address_list
.
append
(
(
internet_protocol_address
.
getNetworkInterface
(
''
).
decode
(
"UTF-8"
),
internet_protocol_address
.
getIpAddress
().
decode
(
"UTF-8"
))
)
return
xml_marshaller
.
xml_marshaller
.
dumps
(
ip_address_list
)
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getFullComputerInformation'
)
'getFullComputerInformation'
)
def
getFullComputerInformation
(
self
,
computer_id
):
def
getFullComputerInformation
(
self
,
computer_id
):
...
@@ -298,6 +334,28 @@ class SlapTool(BaseTool):
...
@@ -298,6 +334,28 @@ class SlapTool(BaseTool):
else
:
else
:
return
result
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getHostingSubscriptionIpList'
)
def
getHostingSubscriptionIpList
(
self
,
computer_id
,
computer_partition_id
):
"""
Search and return all Computer Partition IP address related to one
Hosting Subscription
"""
result
=
self
.
_getHostingSubscriptionIpList
(
computer_id
,
computer_partition_id
)
if
self
.
REQUEST
.
response
.
getStatus
()
==
200
:
# Keep in cache server for 7 days
self
.
REQUEST
.
response
.
setHeader
(
'Cache-Control'
,
'public, max-age=1, stale-if-error=604800'
)
self
.
REQUEST
.
response
.
setHeader
(
'Vary'
,
'REMOTE_USER'
)
self
.
REQUEST
.
response
.
setHeader
(
'Last-Modified'
,
rfc1123_date
(
DateTime
()))
self
.
REQUEST
.
response
.
setBody
(
result
)
return
self
.
REQUEST
.
response
else
:
return
result
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getComputerPartitionCertificate'
)
'getComputerPartitionCertificate'
)
def
getComputerPartitionCertificate
(
self
,
computer_id
,
computer_partition_id
):
def
getComputerPartitionCertificate
(
self
,
computer_id
,
computer_partition_id
):
...
...
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