Commit 7368822f authored by Alain Takoudjou's avatar Alain Takoudjou

Merge branch 'tap-nobridge' into 'master'

Tap nobridge



See merge request !2
parents 0f48ce37 b8d90b26
......@@ -272,6 +272,33 @@ class SlapTool(BaseTool):
self._getSlapPartitionByPackingList(_assertACI(computer_partition.getObject())))
return xml_marshaller.xml_marshaller.dumps(slap_computer)
@UnrestrictedMethod
def _getHostingSubscriptionIpList(self, computer_id, computer_partition_id):
software_instance = self._getSoftwareInstanceForComputerPartition(
computer_id, computer_partition_id)
if software_instance is None or \
software_instance.getSlapState() == 'destroy_requested':
return xml_marshaller.xml_marshaller.dumps([])
# Search hosting subscription
hosting = software_instance.getSpecialiseValue()
while hosting and hosting.getPortalType() != "Hosting Subscription":
hosting = hosting.getSpecialiseValue()
ip_address_list = []
for instance in hosting.getSpecialiseRelatedValueList(
portal_type="Software Instance"):
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,
'getFullComputerInformation')
def getFullComputerInformation(self, computer_id):
......@@ -298,6 +325,28 @@ class SlapTool(BaseTool):
else:
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,
'getComputerPartitionCertificate')
def getComputerPartitionCertificate(self, computer_id, computer_partition_id):
......
This diff is collapsed.
......@@ -331,6 +331,12 @@ class IComputerPartition(IBuildoutController, IRequester):
text -- message log of the status
"""
def getFullHostingIpAddressList():
"""
Returns a dictionnary containing the latest status of the
computer partition.
"""
class IComputer(Interface):
"""
Computer interface specification
......
......@@ -606,6 +606,15 @@ class ComputerPartition(SlapRequester):
}
)
return xml_marshaller.loads(xml)
def getFullHostingIpAddressList(self):
xml = self._connection_helper.GET('getHostingSubscriptionIpList',
params={
'computer_id': self._computer_id,
'computer_partition_id': self._partition_id,
}
)
return xml_marshaller.loads(xml)
def _addIpv6Brackets(url):
# if master_url contains an ipv6 without bracket, add it
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment