Fix Usage Report in case of not empty partition with no SR

parent c17ae1b1
...@@ -939,6 +939,10 @@ class Slapgrid(object): ...@@ -939,6 +939,10 @@ class Slapgrid(object):
def agregateAndSendUsage(self): def agregateAndSendUsage(self):
"""Will agregate usage from each Computer Partition. """Will agregate usage from each Computer Partition.
""" """
# Prepares environment
self.checkEnvironmentAndCreateStructure()
self._launchSupervisord()
slap_computer_usage = self.slap.registerComputer(self.computer_id) slap_computer_usage = self.slap.registerComputer(self.computer_id)
computer_partition_usage_list = [] computer_partition_usage_list = []
logger = logging.getLogger('UsageReporting') logger = logging.getLogger('UsageReporting')
...@@ -1113,9 +1117,13 @@ class Slapgrid(object): ...@@ -1113,9 +1117,13 @@ class Slapgrid(object):
if computer_partition.getState() == COMPUTER_PARTITION_DESTROYED_STATE: if computer_partition.getState() == COMPUTER_PARTITION_DESTROYED_STATE:
try: try:
computer_partition_id = computer_partition.getId() computer_partition_id = computer_partition.getId()
software_url = computer_partition.getSoftwareRelease().getURI() try:
software_path = os.path.join(self.software_root, software_url = computer_partition.getSoftwareRelease().getURI()
software_path = os.path.join(self.software_root,
getSoftwareUrlHash(software_url)) getSoftwareUrlHash(software_url))
except (NotFoundError, TypeError):
software_url = None
software_path = None
local_partition = Partition( local_partition = Partition(
software_path=software_path, software_path=software_path,
instance_path=os.path.join(self.instance_root, instance_path=os.path.join(self.instance_root,
......
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