Project

General

Profile

Anomalie #1992

web_url est par défaut une IP, le fichier hosts est incorrect

Added by Emmanuel GARETTE (2) almost 12 years ago. Updated over 11 years ago.

Status:
Fermé
Priority:
Normal
Assigned To:
-
Category:
-
Start date:
08/25/2011
Due date:
% Done:

100%

Spent time:
Distribution:
EOLE 2.3

Description

Si web_url est une IP, il ne devrait pas être dans le fichier /etc/hosts

J'ajoute donc une fonction is_ip dans eosfunc et je test dans le template hosts :

--- /usr/share/pyshared/creole/eosfunc.py.old   2011-08-25 09:13:14.080744671 +0200
+++ /usr/share/pyshared/creole/eosfunc.py   2011-08-25 09:14:04.125341910 +0200
@@ -72,6 +72,12 @@
     # on n'a pas rencontré d'erreur
     return True

+def is_ip(data):
+    try:
+        return valid_ip(data)
+    except:
+        return False
+
 def valid_intervalle(data):
     """ fonction de validation d'une plage d'ip """ 
     if data == "":
--- hosts.old   2011-08-25 09:03:12.720712936 +0200
+++ hosts   2011-08-25 09:14:14.233800658 +0200
@@ -62,6 +62,6 @@
 %%container_ip_dns  %%container_name_dns.%%nom_domaine_local
 %end if

-%if %%is_defined('web_url') and %%web_url != ''
+%if %%is_defined('web_url') and %%web_url != '' and not %%is_ip(%%web_url)
 %%adresse_ip_eth0 %%web_url
 %end if

Associated revisions

Revision 8ce5463c (diff)
Added by Joël Cuissinat almost 12 years ago

eosfunc : ajout du test is_ip() (ref #1992)

Revision fc6e41ee (diff)
Added by Joël Cuissinat almost 12 years ago

pas d'entrée dans /etc/hosts si web_url est une IP (fixes #1992)

History

#1 Updated by Joël Cuissinat almost 12 years ago

  • Project changed from conf-scribe to eole-common

#2 Updated by Joël Cuissinat almost 12 years ago

  • Status changed from Nouveau to Résolu
  • % Done changed from 0 to 100

#3 Updated by Joël Cuissinat almost 12 years ago

  • Target version set to Mises à jour 2.3 - 02 RC

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

  • Status changed from Résolu to Fermé
  • Distribution set to EOLE 2.3
root@horusng:~# echo $web_url
192.168.230.133
root@horusng:~# cat /etc/hosts | grep -v "^$" 
127.0.0.1                       localhost.localdomain localhost
192.168.230.133         horus23.zozo.lan horus23

Also available in: Atom PDF