Commit bce8bcb9 authored by Alain Takoudjou's avatar Alain Takoudjou

slapgrid: update instance access status when checking promise anomaly

parent 6071d384
......@@ -906,6 +906,23 @@ stderr_logfile_backups=1
self._checkAddFirewallRules(computer_partition.getId(),
cmd_list, add=add_rules)
def _checkPromiseAnomaly(self, local_partition, computer_partition):
partition_access_status = computer_partition.getAccessStatus()
status_error = False
if partition_access_status and partition_access_status.startswith("#error"):
status_error = True
try:
self._checkPromiseList(local_partition,
check_anomaly=True,
force=False)
except PromiseError, e:
if not status_error:
self.logger.error(e)
computer_partition.error(e, logger=self.logger)
else:
if status_error:
computer_partition.started()
def processComputerPartition(self, computer_partition):
"""
Process a Computer Partition, depending on its state
......@@ -1018,9 +1035,7 @@ stderr_logfile_backups=1
# check promises anomaly
if computer_partition_state == COMPUTER_PARTITION_STARTED_STATE:
self.logger.debug('Partition already up-to-date.')
self._checkPromiseList(local_partition,
check_anomaly=True,
force=False)
self._checkPromiseAnomaly(local_partition, computer_partition)
else:
self.logger.debug('Partition already up-to-date. skipping.')
return
......
......@@ -227,6 +227,9 @@ class IComputerPartition(IBuildoutController, IRequester):
The result can be: started, stopped, destroyed
"""
def getAccessStatus():
"""Get latest computer partition Access message state"""
def getSoftwareRelease():
"""
Returns the software release associate to the computer partition.
......
......@@ -564,6 +564,10 @@ class ComputerPartition(SlapRequester):
raise ResourceNotReady()
return self._requested_state
def getAccessStatus(self):
"""Get latest computer partition Access message state"""
return getattr(self, '_access_status', None)
def getType(self):
"""
return the Software Type of the instance.
......
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