Skip to content

Commit f45b619

Browse files
Fix repeating IP Address bug (skypilot-org#663)
1 parent f90fb73 commit f45b619

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sky/backends/backend_utils.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,12 @@ def add_cluster(
235235
f'host named {cluster_name}.')
236236
host_name = ip
237237
logger.warning(f'Using {ip} to identify host instead.')
238-
break
238+
239+
if line.strip() == f'Host {ip}':
240+
prev_line = config[i - 1] if i - 1 > 0 else ''
241+
if prev_line.strip().startswith(sky_autogen_comment):
242+
overwrite = True
243+
overwrite_begin_idx = i - 1
239244
else:
240245
config = ['\n']
241246
with open(config_path, 'w') as f:

0 commit comments

Comments
 (0)