#NEWLINE# def _get_power_status( ssh_obj , driver_info ) : #NEWLINE# #INDENT# "Returns a node's current power state.\n\n    :param ssh_obj: paramiko.SSHClient, an active ssh connection.\n    :param driver_info: information for accessing the node.\n    :returns: one of ironic.common.states POWER_OFF, POWER_ON.\n    :raises: NodeNotFound if could not find a VM corresponding to any\n        of the provided MACs.\n\n    " #NEWLINE# power_state = None #NEWLINE# node_name = _get_hosts_name_for_node ( ssh_obj , driver_info ) #NEWLINE# cmd_to_exec = ( '%s %s' % ( driver_info [ 'cmd_set' ] [ 'base_cmd' ] , driver_info [ 'cmd_set' ] [ 'list_running' ] ) ) #NEWLINE# cmd_to_exec = cmd_to_exec . replace ( '{_NodeName_}' , node_name ) #NEWLINE# running_list = _ssh_execute ( ssh_obj , cmd_to_exec ) #NEWLINE# quoted_node_name = ( '"%s"' % node_name ) #NEWLINE# for node in running_list : #NEWLINE# #INDENT# if ( not node ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( ( quoted_node_name in node ) or ( node_name == node ) ) : #NEWLINE# #INDENT# power_state = states . POWER_ON #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not power_state ) : #NEWLINE# #INDENT# power_state = states . POWER_OFF #NEWLINE# #UNINDENT# return power_state