|
|
@ -4,6 +4,7 @@ import re |
|
|
|
import os |
|
|
|
import os |
|
|
|
import os.path |
|
|
|
import os.path |
|
|
|
import sys |
|
|
|
import sys |
|
|
|
|
|
|
|
import errno |
|
|
|
import datetime |
|
|
|
import datetime |
|
|
|
import urllib2 |
|
|
|
import urllib2 |
|
|
|
import subprocess |
|
|
|
import subprocess |
|
|
@ -117,8 +118,14 @@ for source in all_sources: |
|
|
|
log.info('%s: adding hosts...', source.name) |
|
|
|
log.info('%s: adding hosts...', source.name) |
|
|
|
sp_args = ['py-i2phosts-injector', '-s', '-f', tmpfile, '-d', |
|
|
|
sp_args = ['py-i2phosts-injector', '-s', '-f', tmpfile, '-d', |
|
|
|
'Auto-added from ' + source.name] |
|
|
|
'Auto-added from ' + source.name] |
|
|
|
|
|
|
|
try: |
|
|
|
p = subprocess.Popen(sp_args, shell=False, stdin=None, |
|
|
|
p = subprocess.Popen(sp_args, shell=False, stdin=None, |
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT) |
|
|
|
|
|
|
|
except OSError, e: |
|
|
|
|
|
|
|
log.error('failed to exec py-i2phosts-injector: %s', e) |
|
|
|
|
|
|
|
if e.errno == errno.ENOENT: |
|
|
|
|
|
|
|
log.error('check your PATH environment variable') |
|
|
|
|
|
|
|
sys.exit(1) |
|
|
|
out = p.communicate()[0] |
|
|
|
out = p.communicate()[0] |
|
|
|
os.remove(tmpfile) |
|
|
|
os.remove(tmpfile) |
|
|
|
log.info('%s: injector output: \n%s', source.name, out) |
|
|
|
log.info('%s: injector output: \n%s', source.name, out) |
|
|
|