<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import logging <EOL> import salt . utils <EOL> log = logging . getLogger ( __name__ ) <EOL> __virtualname__ = '<STR_LIT>' <EOL> last_state = { } <EOL> def __virtual__ ( ) : <EOL> which_result = salt . utils . which ( '<STR_LIT>' ) <EOL> if which_result is None : <EOL> return False <EOL> else : <EOL> return __virtualname__ <EOL> def validate ( config ) : <EOL> '''<STR_LIT>''' <EOL> if not isinstance ( config , dict ) : <EOL> return False , ( '<STR_LIT>' ) <EOL> if '<STR_LIT:user>' not in config : <EOL> return False , ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return True , '<STR_LIT>' <EOL> def beacon ( config ) : <EOL> '''<STR_LIT>''' <EOL> log . trace ( '<STR_LIT>' ) <EOL> ret = [ ] <EOL> _validate = validate ( config ) <EOL> if not _validate [ <NUM_LIT:0> ] : <EOL> return ret <EOL> retcode = __salt__ [ '<STR_LIT>' ] ( '<STR_LIT>' , runas = config [ '<STR_LIT:user>' ] , python_shell = True ) <EOL> if '<STR_LIT>' in config and config [ '<STR_LIT>' ] : <EOL> last_value = last_state . get ( '<STR_LIT>' , False ) <EOL> screen_available = retcode == <NUM_LIT:0> <EOL> if last_value != screen_available or '<STR_LIT>' not in last_state : <EOL> ret . append ( { '<STR_LIT>' : '<STR_LIT>' , '<STR_LIT>' : screen_available } ) <EOL> last_state [ '<STR_LIT>' ] = screen_available <EOL> return ret </s>
