<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> __func_alias__ = { <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> __virtualname__ = '<STR_LIT>' <EOL> def __virtual__ ( ) : <EOL> '''<STR_LIT>''' <EOL> if '<STR_LIT>' in __grains__ [ '<STR_LIT>' ] : <EOL> if __grains__ [ '<STR_LIT>' ] == "<STR_LIT>" : <EOL> return ( False , '<STR_LIT>' ) <EOL> return __virtualname__ <EOL> return ( False , '<STR_LIT>' ) <EOL> def _get_enabled_disabled ( enabled_prop = "<STR_LIT:true>" ) : <EOL> '''<STR_LIT>''' <EOL> ret = set ( ) <EOL> cmd = '<STR_LIT>' <EOL> lines = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) . splitlines ( ) <EOL> for line in lines : <EOL> comps = line . split ( ) <EOL> if not comps : <EOL> continue <EOL> if comps [ <NUM_LIT:2> ] == enabled_prop : <EOL> ret . add ( comps [ <NUM_LIT:0> ] . split ( "<STR_LIT>" ) [ <NUM_LIT:0> ] ) <EOL> return sorted ( ret ) <EOL> def get_running ( ) : <EOL> '''<STR_LIT>''' <EOL> ret = set ( ) <EOL> cmd = '<STR_LIT>' <EOL> lines = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) . splitlines ( ) <EOL> for line in lines : <EOL> comps = line . split ( ) <EOL> if not comps : <EOL> continue <EOL> if '<STR_LIT>' in line : <EOL> ret . add ( comps [ <NUM_LIT:0> ] ) <EOL> return sorted ( ret ) <EOL> def get_stopped ( ) : <EOL> '''<STR_LIT>''' <EOL> ret = set ( ) <EOL> cmd = '<STR_LIT>' <EOL> lines = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) . splitlines ( ) <EOL> for line in lines : <EOL> comps = line . split ( ) <EOL> if not comps : <EOL> continue <EOL> if '<STR_LIT>' not in line and '<STR_LIT>' not in line : <EOL> ret . add ( comps [ <NUM_LIT:0> ] ) <EOL> return sorted ( ret ) <EOL> def available ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> name = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> return name in get_all ( ) <EOL> def missing ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> name = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> return name not in get_all ( ) <EOL> def get_all ( ) : <EOL> '''<STR_LIT>''' <EOL> ret = set ( ) <EOL> cmd = '<STR_LIT>' <EOL> lines = __salt__ [ '<STR_LIT>' ] ( cmd ) . splitlines ( ) <EOL> for line in lines : <EOL> comps = line . split ( ) <EOL> if not comps : <EOL> continue <EOL> ret . add ( comps [ <NUM_LIT:0> ] ) <EOL> return sorted ( ret ) <EOL> def start ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> retcode = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> if not retcode : <EOL> return True <EOL> if retcode == <NUM_LIT:3> : <EOL> clear_cmd = '<STR_LIT>' . format ( name ) <EOL> __salt__ [ '<STR_LIT>' ] ( clear_cmd , python_shell = False ) <EOL> return not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> return False <EOL> def stop ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> return not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> def restart ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> if not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) : <EOL> return start ( name ) <EOL> return False <EOL> def reload_ ( name ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> if not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) : <EOL> return start ( name ) <EOL> return False <EOL> def status ( name , sig = None ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> line = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> if line == '<STR_LIT>' : <EOL> return True <EOL> else : <EOL> return False <EOL> def enable ( name , ** kwargs ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> return not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> def disable ( name , ** kwargs ) : <EOL> '''<STR_LIT>''' <EOL> cmd = '<STR_LIT>' . format ( name ) <EOL> return not __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) <EOL> def enabled ( name , ** kwargs ) : <EOL> '''<STR_LIT>''' <EOL> fmri_cmd = '<STR_LIT>' . format ( name ) <EOL> fmri = __salt__ [ '<STR_LIT>' ] ( fmri_cmd , python_shell = False ) <EOL> cmd = '<STR_LIT>' . format ( fmri ) <EOL> comps = __salt__ [ '<STR_LIT>' ] ( cmd , python_shell = False ) . split ( ) <EOL> if comps [ <NUM_LIT:2> ] == '<STR_LIT:true>' : <EOL> return True <EOL> else : <EOL> return False <EOL> def disabled ( name ) : <EOL> '''<STR_LIT>''' <EOL> return not enabled ( name ) <EOL> def get_enabled ( ) : <EOL> '''<STR_LIT>''' <EOL> return _get_enabled_disabled ( "<STR_LIT:true>" ) <EOL> def get_disabled ( ) : <EOL> '''<STR_LIT>''' <EOL> return _get_enabled_disabled ( "<STR_LIT:false>" ) </s>
