<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> import logging <EOL> from salt . ext . six import string_types <EOL> import salt . utils <EOL> log = logging . getLogger ( __name__ ) <EOL> def __virtual__ ( ) : <EOL> '''<STR_LIT>''' <EOL> if not salt . utils . is_windows ( ) : <EOL> return False <EOL> return '<STR_LIT>' <EOL> def _check_servers ( servers ) : <EOL> if not isinstance ( servers , list ) : <EOL> return False <EOL> for server in servers : <EOL> if not isinstance ( server , string_types ) : <EOL> return False <EOL> return True <EOL> def _get_servers ( ) : <EOL> try : <EOL> return set ( __salt__ [ '<STR_LIT>' ] ( ) ) <EOL> except TypeError : <EOL> return set ( [ False ] ) <EOL> def managed ( name , servers = None ) : <EOL> '''<STR_LIT>''' <EOL> ret = { '<STR_LIT:name>' : name , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT:result>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' } <EOL> if not _check_servers ( servers ) : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> before_servers = _get_servers ( ) <EOL> desired_servers = set ( servers ) <EOL> if before_servers == desired_servers : <EOL> return ret <EOL> if __opts__ [ '<STR_LIT:test>' ] : <EOL> ret [ '<STR_LIT:result>' ] = None <EOL> ret [ '<STR_LIT>' ] = ( '<STR_LIT>' <EOL> . format ( '<STR_LIT:U+002CU+0020>' . join ( sorted ( desired_servers ) ) ) ) <EOL> return ret <EOL> __salt__ [ '<STR_LIT>' ] ( * desired_servers ) <EOL> after_servers = _get_servers ( ) <EOL> if after_servers == desired_servers : <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> ret [ '<STR_LIT>' ] = { '<STR_LIT>' : sorted ( before_servers ) , <EOL> '<STR_LIT>' : sorted ( after_servers ) } <EOL> else : <EOL> ret [ '<STR_LIT:result>' ] = False <EOL> ret [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if before_servers != after_servers : <EOL> ret [ '<STR_LIT>' ] = { '<STR_LIT>' : sorted ( before_servers ) , <EOL> '<STR_LIT>' : sorted ( after_servers ) } <EOL> return ret </s>
