#NEWLINE# def absent( name ) : #NEWLINE# #INDENT# "\n    Ensures that the user group does not exist, eventually delete user group.\n\n    .. versionadded:: 2016.3.0\n\n    :param name: name of the user group\n    :param _connection_user: Optional - zabbix user (can also be set in opts or pillar, see module's docstring)\n    :param _connection_password: Optional - zabbix password (can also be set in opts or pillar, see module's docstring)\n    :param _connection_url: Optional - url of zabbix frontend (can also be set in opts, pillar, see module's docstring)\n\n    .. code-block:: yaml\n\n        delete_thai_monks_usrgrp:\n            zabbix_usergroup.absent:\n                - name: 'Thai monks'\n\n    " #NEWLINE# ret = { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'changes' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# 'result' : False , #NEWLINE# 'comment' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# comment_usergroup_deleted = 'User group {0} deleted.' . format ( name ) #NEWLINE# comment_usergroup_notdeleted = 'Unable to delete user group: {0}. ' . format ( name ) #NEWLINE# comment_usergroup_notexists = 'User group {0} does not exist.' . format ( name ) #NEWLINE# changes_usergroup_deleted = { #NEWLINE# #INDENT# name : { #NEWLINE# #INDENT# 'old' : 'User group {0} exists.' . format ( name ) , #NEWLINE# 'new' : 'User group {0} deleted.' . format ( name ) , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# usergroup_exists = __salt__ [ 'zabbix.usergroup_exists' ] ( name ) #NEWLINE# if __opts__ [ 'test' ] : #NEWLINE# #INDENT# if ( not usergroup_exists ) : #NEWLINE# #INDENT# ret [ 'result' ] = True #NEWLINE# ret [ 'comment' ] = comment_usergroup_notexists #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret [ 'result' ] = None #NEWLINE# ret [ 'comment' ] = comment_usergroup_deleted #NEWLINE# #UNINDENT# return ret #NEWLINE# #UNINDENT# usergroup_get = __salt__ [ 'zabbix.usergroup_get' ] ( name ) #NEWLINE# if ( not usergroup_get ) : #NEWLINE# #INDENT# ret [ 'result' ] = True #NEWLINE# ret [ 'comment' ] = comment_usergroup_notexists #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# usrgrpid = usergroup_get [ 0 ] [ 'usrgrpid' ] #NEWLINE# usergroup_delete = __salt__ [ 'zabbix.usergroup_delete' ] ( usrgrpid ) #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# usergroup_delete = False #NEWLINE# #UNINDENT# if ( usergroup_delete and ( 'error' not in usergroup_delete ) ) : #NEWLINE# #INDENT# ret [ 'result' ] = True #NEWLINE# ret [ 'comment' ] = comment_usergroup_deleted #NEWLINE# ret [ 'changes' ] = changes_usergroup_deleted #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ret [ 'result' ] = False #NEWLINE# ret [ 'comment' ] = ( comment_usergroup_notdeleted + str ( usergroup_delete [ 'error' ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# return ret