diff --git a/lib/utils.py b/lib/utils.py
index 97d6b819843501d1023ce667daafb18488999f6b..823c208154d28a56d1ba3de5f58c703c2202c20e 100644
--- a/lib/utils.py
+++ b/lib/utils.py
@@ -834,7 +834,6 @@ def SetEtcHostsEntry(file_name, ip, hostname, aliases):
     try:
       f = open(file_name, 'r')
       try:
-        written = False
         for line in f:
           fields = line.split()
           if fields and not fields[0].startswith('#') and ip == fields[0]: