def _check_perms_changes(name, newperms, runas=None, existing=None):
 if (not newperms):
  return False
 if (existing is None):
  try:
   existing = __salt__['rabbitmq.list_user_permissions'](name, runas=runas)
  except CommandExecutionError as err:
   log.error('Error: {0}'.format(err))
   return False
 perm_need_change = False
 for vhost_perms in newperms:
  for (vhost, perms) in six.iteritems(vhost_perms):
   if (vhost in existing):
    existing_vhost = existing[vhost]
    if (perms != existing_vhost):
     if ((existing_vhost == '') and (perms == ['', '', ''])):
      continue
     perm_need_change = True
   else:
    perm_need_change = True
 return perm_need_change

def _check_perms_changes ( name , newperms , runas = None , existing = None ) : if ( not newperms ) : return False if ( existing is None ) : try : existing = __salt__ [ 'rabbitmq.list_user_permissions' ] ( name , runas = runas ) except CommandExecutionError as err : log . error ( 'Error: {0}' . format ( err ) ) return False perm_need_change = False for vhost_perms in newperms : for ( vhost , perms ) in six . iteritems ( vhost_perms ) : if ( vhost in existing ) : existing_vhost = existing [ vhost ] if ( perms != existing_vhost ) : if ( ( existing_vhost == '' ) and ( perms == [ '' , '' , '' ] ) ) : continue perm_need_change = True else : perm_need_change = True return perm_need_change
check whether rabbitmq users permissions need to be changed .