Reorder group/server parsing and skip empty entries in config parser
This commit is contained in:
17
app/app.py
17
app/app.py
@@ -60,26 +60,29 @@ def parse_infrastructure_conf():
|
||||
stripped = line.strip()
|
||||
if not stripped or stripped.startswith('#'):
|
||||
continue
|
||||
# Group header: no leading whitespace
|
||||
if line[0] not in (' ', '\t'):
|
||||
current_group = stripped
|
||||
current_host = None
|
||||
continue
|
||||
# Detect prefix: -- child VM, - host
|
||||
|
||||
# Server entry: starts with - or -- (with optional leading whitespace)
|
||||
if stripped.startswith('--'):
|
||||
is_child = True
|
||||
rest = stripped[2:].strip()
|
||||
elif stripped.startswith('-'):
|
||||
is_child = False
|
||||
rest = stripped[1:].strip()
|
||||
elif line[0] not in (' ', '\t') and not stripped.startswith('-'):
|
||||
# Group header: no leading whitespace, no dash prefix
|
||||
current_group = stripped
|
||||
current_host = None
|
||||
continue
|
||||
else:
|
||||
# Legacy: no dash prefix, treat as host
|
||||
# Legacy: indented without dash, treat as host
|
||||
is_child = False
|
||||
rest = stripped
|
||||
|
||||
parts = rest.split(None, 1)
|
||||
entry = parts[0] if parts else ''
|
||||
url = parts[1] if len(parts) > 1 else ''
|
||||
if not entry:
|
||||
continue
|
||||
if '@' in entry:
|
||||
user, host = entry.split('@', 1)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user