Modify to expect end of file upon script completion
This commit is contained in:
parent
22ad235cd1
commit
fbd0c39073
16
pyvpn
16
pyvpn
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import time
|
||||
import sys
|
||||
import pexpect
|
||||
import os.path
|
||||
|
@ -24,13 +25,12 @@ if len(sys.argv) > 2:
|
|||
|
||||
configFilePath = operatingDir + "/" + clientName + ".ovpn"
|
||||
|
||||
fScript.expect(".*[1-4]:")
|
||||
fScript.expect("Looks")
|
||||
fScript.sendline("1")
|
||||
fScript.expect(".*name:")
|
||||
fScript.expect("Tell")
|
||||
fScript.sendline(clientName)
|
||||
fScript.expect(".*")
|
||||
fScript.expect(pexpect.EOF)
|
||||
|
||||
fScript.kill(0)
|
||||
|
||||
if os.path.exists(configFilePath):
|
||||
|
||||
|
@ -40,21 +40,21 @@ if len(sys.argv) > 2:
|
|||
|
||||
sys.stdout.write(finalResult)
|
||||
sys.stdout.flush()
|
||||
sys.exit()
|
||||
quit()
|
||||
|
||||
else:
|
||||
sys.stdout.write("Error! OpenVPN did not create the Configuration file.")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.exit()
|
||||
quit()
|
||||
|
||||
|
||||
|
||||
else:
|
||||
sys.stdout.write("Error! Missing options!")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.exit()
|
||||
quit()
|
||||
|
||||
else:
|
||||
sys.stdout.write("Error! Missing client name!")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.exit()
|
||||
quit()
|
||||
|
|
Loading…
Reference in New Issue