Skip to content

Commit

Permalink
Merge pull request #5288 from wazuh/bug/5237-dtt1-the-allocator-assig…
Browse files Browse the repository at this point in the history
…ns-the-same-ip-address-to-many-instances-launching-tasks-in-parallel

Added random assignment for IP address for Vagrant local deployment
  • Loading branch information
teddytpc1 committed Apr 24, 2024
2 parents e61da0c + 656a117 commit e71e39a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions deployability/modules/allocation/vagrant/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import platform, json
import subprocess
import boto3
import random

from jinja2 import Environment, FileSystemLoader
from pathlib import Path
Expand Down Expand Up @@ -244,8 +245,8 @@ def check_ip(ip):
if response != 0:
return ip

for i in range(2, 254):
ip = f"192.168.57.{i}"
for i in range(254):
ip = f"192.168.57.{random.randint(2, 253)}"
if check_ip(ip):
return ip

Expand Down

0 comments on commit e71e39a

Please sign in to comment.