diff --git a/actions/openvpn b/actions/openvpn index 6b4629843..464b151b5 100755 --- a/actions/openvpn +++ b/actions/openvpn @@ -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(_): diff --git a/plinth/utils.py b/plinth/utils.py index b139bd574..052a08f86 100644 --- a/plinth/utils.py +++ b/plinth/utils.py @@ -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