Commit faa7593e authored by Alain Takoudjou's avatar Alain Takoudjou Committed by Rafael Monnerat

Record software installation state with software instanllation reference

parent 79708778
...@@ -886,21 +886,28 @@ class SlapTool(BaseTool): ...@@ -886,21 +886,28 @@ class SlapTool(BaseTool):
@convertToREST @convertToREST
def _buildingSoftwareRelease(self, url, computer_id): def _buildingSoftwareRelease(self, url, computer_id):
""" """
Log the computer status Log the software release status
""" """
computer_document = self._getComputerDocument(computer_id)
software_installation_reference = self._getCachedSoftwareInstallationReference(url,
computer_document)
user = self.getPortalObject().portal_membership.\ user = self.getPortalObject().portal_membership.\
getAuthenticatedMember().getUserName() getAuthenticatedMember().getUserName()
self._logAccess(user, user, 'building software release %s' % url) self._logAccess(user, software_installation_reference,
'building software release %s' % url)
@convertToREST @convertToREST
def _availableSoftwareRelease(self, url, computer_id): def _availableSoftwareRelease(self, url, computer_id):
""" """
Log the computer status Log the software release status
""" """
computer_document = self._getComputerDocument(computer_id)
software_installation_reference = self._getCachedSoftwareInstallationReference(url,
computer_document)
user = self.getPortalObject().portal_membership.\ user = self.getPortalObject().portal_membership.\
getAuthenticatedMember().getUserName() getAuthenticatedMember().getUserName()
self._logAccess(user, user, '#access software release %s available' % \ self._logAccess(user, software_installation_reference,
url) '#access software release %s available' % url)
@convertToREST @convertToREST
def _destroyedSoftwareRelease(self, url, computer_id): def _destroyedSoftwareRelease(self, url, computer_id):
...@@ -1319,6 +1326,19 @@ class SlapTool(BaseTool): ...@@ -1319,6 +1326,19 @@ class SlapTool(BaseTool):
in software_installation_list]) in software_installation_list])
)) ))
def _getNonCachedSoftwareInstallationReference(self, url, computer_document):
return self._getSoftwareInstallationForComputer(url,
computer_document).getReference()
def _getCachedSoftwareInstallationReference(self, url, computer_document):
"""
Get the software installation reference (with this url) for the computer.
"""
result = CachingMethod(self._getNonCachedSoftwareInstallationReference,
id='_getCachedSoftwareInstallationReference',
cache_factory='slap_cache_factory')(url, computer_document)
return result
def _getSoftwareInstanceForComputerPartition(self, computer_id, def _getSoftwareInstanceForComputerPartition(self, computer_id,
computer_partition_id, slave_reference=None): computer_partition_id, slave_reference=None):
computer_partition_document = self._getComputerPartitionDocument( computer_partition_document = self._getComputerPartitionDocument(
...@@ -1433,9 +1453,12 @@ class SlapTool(BaseTool): ...@@ -1433,9 +1453,12 @@ class SlapTool(BaseTool):
""" """
Log the computer status Log the computer status
""" """
user = self.getPortalObject().portal_membership.getAuthenticatedMember()\ computer_document = self._getComputerDocument(computer_id)
.getUserName() software_installation_reference = self._getCachedSoftwareInstallationReference(url,
self._logAccess( computer_document)
user, computer_id, '#error while installing %s' % url) user = self.getPortalObject().portal_membership.\
getAuthenticatedMember().getUserName()
self._logAccess(user, software_installation_reference,
'#error while installing %s' % url)
InitializeClass(SlapTool) InitializeClass(SlapTool)
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