mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
openvpn: is-setup checks for non-empty dh.pem file
Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
d5a73aaac4
commit
3a579e2d72
@ -25,7 +25,7 @@ import subprocess
|
||||
|
||||
import augeas
|
||||
|
||||
from plinth import action_utils
|
||||
from plinth import action_utils, utils
|
||||
|
||||
KEYS_DIRECTORY = '/etc/openvpn/freedombox-keys'
|
||||
|
||||
@ -120,7 +120,7 @@ def parse_arguments():
|
||||
|
||||
def subcommand_is_setup(_):
|
||||
"""Return whether setup is complete."""
|
||||
print('true' if os.path.isfile(DH_KEY) else 'false')
|
||||
print('true' if utils.is_non_empty_file(DH_KEY) else 'false')
|
||||
|
||||
|
||||
def subcommand_setup(_):
|
||||
|
||||
@ -154,3 +154,7 @@ def gunzip(gzip_file, output_file):
|
||||
|
||||
with open(output_file, 'wb', opener=opener) as file_handle:
|
||||
file_handle.write(contents)
|
||||
|
||||
|
||||
def is_non_empty_file(file_path):
|
||||
return os.path.isfile(file_path) and os.path.getsize(file_path) > 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user