redirect dmidecode stderr -> stdout, openvpn config check

This commit is contained in:
clore 2024-12-07 04:09:13 +00:00
parent fe954babc7
commit 5050648451
2 changed files with 8 additions and 4 deletions

View File

@ -51,7 +51,7 @@ async def initialize():
return False return False
code, stdout, stderr = await utils.async_run_command( code, stdout, stderr = await utils.async_run_command(
"dmidecode -t 2", "dmidecode -t 2 2>&1",
20 20
) )
if code == 0 and not stderr: if code == 0 and not stderr:
@ -60,7 +60,7 @@ async def initialize():
else: else:
return False return False
code, stdout, stderr = await utils.async_run_command( code, stdout, stderr = await utils.async_run_command(
"dmidecode", "dmidecode 2>&1",
20 20
) )
if code == 0 and not stderr: if code == 0 and not stderr:

View File

@ -114,8 +114,12 @@ async def clore_partner_configure(clore_partner_config):
vpn_secret_key=clore_partner_config["secret"] 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=''
saved_config = await file.read()
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: if saved_config != needed_openvpn_config:
async with aiofiles.open(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME), mode='w') as file: async with aiofiles.open(os.path.join(CLIENT_CONFIGS_LOCATION, PARTNER_CONFIG_NAME), mode='w') as file: