diff --git a/lib/clore_partner.py b/lib/clore_partner.py index 314cc5b..1e971ed 100644 --- a/lib/clore_partner.py +++ b/lib/clore_partner.py @@ -51,7 +51,7 @@ async def initialize(): return False code, stdout, stderr = await utils.async_run_command( - "dmidecode -t 2", + "dmidecode -t 2 2>&1", 20 ) if code == 0 and not stderr: @@ -60,7 +60,7 @@ async def initialize(): else: return False code, stdout, stderr = await utils.async_run_command( - "dmidecode", + "dmidecode 2>&1", 20 ) if code == 0 and not stderr: diff --git a/lib/openvpn.py b/lib/openvpn.py index 38ae6b1..f417483 100644 --- a/lib/openvpn.py +++ b/lib/openvpn.py @@ -114,8 +114,12 @@ async def clore_partner_configure(clore_partner_config): vpn_secret_key=clore_partner_config["secret"] ) - async with aiofiles.open(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME), mode='r') as file: - saved_config = await file.read() + saved_config='' + + config_exists = await aiofiles.os.path.exists(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME)) + if config_exists: + async with aiofiles.open(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME), mode='r') as file: + saved_config = await file.read() if saved_config != needed_openvpn_config: async with aiofiles.open(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME), mode='w') as file: