mirror of
https://github.com/budtmo/docker-android.git
synced 2026-07-28 06:32:17 +00:00
Use regex to verify config
This commit is contained in:
+2
-1
@@ -3,6 +3,7 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import uuid
|
||||
|
||||
@@ -56,7 +57,7 @@ def is_initialized(device_name) -> bool:
|
||||
if os.path.exists(config_path):
|
||||
logger.info('Found existing config file at {}.'.format(config_path))
|
||||
with open(config_path, 'r') as f:
|
||||
if any('hw.device.name = {}'.format(device_name) in line for line in f):
|
||||
if any(re.match(r'hw\.device\.name ?= ?{}'.format(device_name), line) for line in f):
|
||||
logger.info('Existing config file references {}. Assuming device was previously initialized.'.format(device_name))
|
||||
return True
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user