Skip to content

Commit

Permalink
Merge pull request #294 from ireneu/master
Browse files Browse the repository at this point in the history
Check correctly if device exists
  • Loading branch information
budtmo authored Jul 20, 2021
2 parents caf2cb2 + 337aaf5 commit 14a98ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import logging
import os
import re
import subprocess
import uuid

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 14a98ae

Please sign in to comment.