Skip to content

Commit 7962eb7

Browse files
committed
add code for obtaining ip_addr for higher docker verion
1 parent 9b33609 commit 7962eb7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

infra/oss-fuzz.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,14 @@ def run_full_mode(project_name, project_config, harness_binaries, src_path, root
500500
shutil.copytree(os.path.join(project_dir, "work"),
501501
os.path.join(fuzzer_dir, "work"))
502502
# get ip address of the seedd container, the container id is container_id
503-
ip_addr = subprocess.check_output(
503+
try:
504+
ip_addr = subprocess.check_output(
504505
["docker", "inspect", "-f", "{{.NetworkSettings.IPAddress}}", container_id]).decode().strip()
506+
except Exception as e:
507+
# for higer docker versions
508+
ip_addr = subprocess.check_output(
509+
["docker", "inspect", "-f", "{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}", container_id]).decode().strip()
510+
505511
agent = SeedGenAgent(fuzzer_dir, ip_addr,
506512
project_name, harness_binary, model_name)
507513
agent.run()

0 commit comments

Comments
 (0)