Commit 32a12714 authored by Ivan Tyagov's avatar Ivan Tyagov

Remove unused variables.

Cleanup conditional code.
parent 62ed554f
...@@ -187,7 +187,6 @@ class SlapOSMasterCommunicator(object): ...@@ -187,7 +187,6 @@ class SlapOSMasterCommunicator(object):
state = INSTANCE_STATE_UNKNOWN state = INSTANCE_STATE_UNKNOWN
monitor_information_dict = {} monitor_information_dict = {}
info_created_at = "-1"
is_slave = instance['portal_type'] == "Slave Instance" is_slave = instance['portal_type'] == "Slave Instance"
if is_slave: if is_slave:
if len(instance['getConnectionXmlAsDict']) > 0: if len(instance['getConnectionXmlAsDict']) > 0:
...@@ -196,24 +195,15 @@ class SlapOSMasterCommunicator(object): ...@@ -196,24 +195,15 @@ class SlapOSMasterCommunicator(object):
# not slave # not slave
instance_state = news instance_state = news
if instance_state.get('created_at', '-1') != "-1": if instance_state.get('created_at', '-1') != "-1":
# the following does NOT take TZ into account instance_text = instance_state['text']
created_at = datetime.datetime.strptime(instance_state['created_at'],
'%a, %d %b %Y %H:%M:%S %Z')
gmt_now = datetime.datetime(*time.gmtime()[:6])
info_created_at = '%s (%d)' % ( if instance_text.startswith('#access Instance correctly stopped'):
instance_state['created_at'], (gmt_now - created_at).seconds)
if instance_state['text'].startswith('#access'):
state = INSTANCE_STATE_STARTED state = INSTANCE_STATE_STARTED
elif instance_text.startswith('#access'):
if instance_state['text'].startswith('#access Instance correctly stopped'):
state = INSTANCE_STATE_STOPPED state = INSTANCE_STATE_STOPPED
elif instance_text.startswith('#destroy'):
if instance_state['text'].startswith('#destroy'):
state = INSTANCE_STATE_DESTROYED state = INSTANCE_STATE_DESTROYED
elif instance_text.startswith('#error'):
if instance_state['text'].startswith('#error'):
state = INSTANCE_STATE_STARTED_WITH_ERROR state = INSTANCE_STATE_STARTED_WITH_ERROR
if state == INSTANCE_STATE_STARTED_WITH_ERROR: if state == INSTANCE_STATE_STARTED_WITH_ERROR:
......
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