mirror of
https://github.com/certbot/certbot.git
synced 2026-03-27 21:03:04 -04:00
more concise file content search using list comprehension
This commit is contained in:
parent
0e8b5c053f
commit
bd331d3789
1 changed files with 1 additions and 6 deletions
|
|
@ -58,12 +58,7 @@ def checkForApacheConfInclude(mainConfig):
|
|||
searchStr = "Include " + APACHE_CHALLENGE_CONF
|
||||
#conf = open(mainConfig, 'r+')
|
||||
conf = open(mainConfig, 'r')
|
||||
flag = False
|
||||
for line in conf:
|
||||
if line.startswith(searchStr):
|
||||
flag = True
|
||||
break
|
||||
if not flag:
|
||||
if not any(line.startswith(searchStr) for line in conf):
|
||||
#conf.write(searchStr)
|
||||
process = subprocess.Popen(["echo", "\n" + searchStr], stdout=subprocess.PIPE)
|
||||
subprocess.check_output(["sudo", "tee", "-a", mainConfig], stdin=process.stdout)
|
||||
|
|
|
|||
Loading…
Reference in a new issue