Project

General

Profile

Bac à idée #16049

Ajouter un test CreoleLint cherchant les service invalides dans les balises service_*

Added by Joël Cuissinat over 4 years ago. Updated over 4 years ago.

Status:
Nouveau
Priority:
Normal
Assigned To:
-
Category:
-
Target version:
-
Start date:
05/02/2016
Due date:
% Done:

0%

Estimated time:
2.00 h
Spent time:

Description

Algorithme proposé : si l'attribut "service" contient le nom d'un service déclaré et que celui-ci possède une servicelist avec un nom différent c'est probablement une erreur :)

History

#1 Updated by Joël Cuissinat over 4 years ago

# -*- coding: utf-8 -*-
from creole import client
creole_client = client.CreoleClient()

# set des services déclarés dans les balises firewall
fwservices = set()
for rule in creole_client.get_service_restrictions():
    fwservices.add(rule['service'])

for rule in creole_client.get_service_accesss():
    fwservices.add(rule['service'])

# dico service -> servicelist
services = {}
for service in creole_client.get_services():
    if service.has_key('servicelist'):
        services[service['name']] = service['servicelist']

for fwservice in fwservices:
    if fwservice in services:
        if services[fwservice] != fwservice:
            print "Servicelist erronée : {0}".format(fwservice)

#2 Updated by Joël Cuissinat over 4 years ago

  • Remaining (hours) changed from 2.0 to 1.0
<gnunux> tu as tout dans : config.containers.service_accesss
<gnunux> for i,j in  config.containers.service_accesss.iter_groups():
<gnunux>   print i,j
<gnunux> après ca ne me choque pas plus que ca d'utiliser le client hein ;)

#3 Updated by Joël Cuissinat over 4 years ago

  • Parent task deleted (#15859)

#4 Updated by Joël Cuissinat over 4 years ago

  • Tracker changed from Tâche to Bac à idée
  • Target version deleted (sprint 2016 16-18 - Equipe MENESR)

Also available in: Atom PDF