Fix handling of this_node and d_domain in cleanup
This commit is contained in:
		| @@ -76,8 +76,11 @@ version = '0.9.28' | |||||||
| # Daemon functions | # Daemon functions | ||||||
| ############################################################################### | ############################################################################### | ||||||
|  |  | ||||||
| # Ensure the update_timer is None until it's set for real | # Ensure update_timer, this_node, and d_domain are None until they're set for real | ||||||
|  | # Ensures cleanup() doesn't fail due to these items not being created yet | ||||||
| update_timer = None | update_timer = None | ||||||
|  | this_node = None | ||||||
|  | d_domain = None | ||||||
|  |  | ||||||
|  |  | ||||||
| # Create timer to update this node in Zookeeper | # Create timer to update this node in Zookeeper | ||||||
| @@ -711,19 +714,19 @@ def cleanup(): | |||||||
|  |  | ||||||
|     # Waiting for any flushes to complete |     # Waiting for any flushes to complete | ||||||
|     logger.out('Waiting for any active flushes', state='s') |     logger.out('Waiting for any active flushes', state='s') | ||||||
|     while this_node.flush_thread is not None: |     if this_node is not None: | ||||||
|         time.sleep(0.5) |         while this_node.flush_thread is not None: | ||||||
|  |             time.sleep(0.5) | ||||||
|  |  | ||||||
|     # Stop console logging on all VMs |     # Stop console logging on all VMs | ||||||
|     logger.out('Stopping domain console watchers', state='s') |     logger.out('Stopping domain console watchers', state='s') | ||||||
|     for domain in d_domain: |     if d_domain is not None: | ||||||
|         if d_domain[domain].getnode() == myhostname: |         for domain in d_domain: | ||||||
|             try: |             if d_domain[domain].getnode() == myhostname: | ||||||
|                 d_domain[domain].console_log_instance.stop() |                 try: | ||||||
|             except NameError: |                     d_domain[domain].console_log_instance.stop() | ||||||
|                 pass |                 except Exception: | ||||||
|             except AttributeError: |                     pass | ||||||
|                 pass |  | ||||||
|  |  | ||||||
|     # Force into secondary coordinator state if needed |     # Force into secondary coordinator state if needed | ||||||
|     try: |     try: | ||||||
| @@ -740,13 +743,11 @@ def cleanup(): | |||||||
|     # Stop keepalive thread |     # Stop keepalive thread | ||||||
|     try: |     try: | ||||||
|         stopKeepaliveTimer() |         stopKeepaliveTimer() | ||||||
|     except NameError: |  | ||||||
|         pass |  | ||||||
|     except AttributeError: |  | ||||||
|         pass |  | ||||||
|  |  | ||||||
|     logger.out('Performing final keepalive update', state='s') |         logger.out('Performing final keepalive update', state='s') | ||||||
|     node_keepalive() |         node_keepalive() | ||||||
|  |     except Exception: | ||||||
|  |         pass | ||||||
|  |  | ||||||
|     # Set stop state in Zookeeper |     # Set stop state in Zookeeper | ||||||
|     zkhandler.write([ |     zkhandler.write([ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user