Skip to content

Commit

Permalink
[Recover via console] Remove image to avoid "File exists" error (soni…
Browse files Browse the repository at this point in the history
…c-net#11647)

What is the motivation for this PR?
When recovering testbeds whose hwsku are Arista, we need to re-install image in Aboot. But the previous downloaded image will not be deleted in Aboot, and if we download the same image again, it will case File exists error in Aboot. We can either remove or rename the existing image on device, but rename image may cause error free memory or disk space size is not enough. So in this PR, we will remove the same image in Aboot.

How did you do it?
Remove the same image if existing before download new image.
  • Loading branch information
yutongzhang-microsoft authored Feb 7, 2024
1 parent 1d9bafc commit 0d60a46
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .azure-pipelines/recover_testbed/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,23 +154,24 @@ def posix_shell_aboot(dut_console, mgmt_ip, image_url):
# TODO: Define a function to send command here
dut_console.remote_conn.send("cd /mnt/flash")
dut_console.remote_conn.send("\n")

time.sleep(1)

dut_console.remote_conn.send("ifconfig ma1 {} netmask {}".format(mgmt_ip.split('/')[0],
ipaddress.ip_interface(mgmt_ip).with_netmask.split('/')[1]))
dut_console.remote_conn.send("\n")

time.sleep(1)

dut_console.remote_conn.send("route add default gw {}".format(gw_ip))
dut_console.remote_conn.send("\n")

time.sleep(1)

dut_console.remote_conn.send("ip route add default via {} dev ma1".format(gw_ip))
dut_console.remote_conn.send("\n")
time.sleep(1)

# Remove image to avoid "File exists" error
dut_console.remote_conn.send("rm -f {}".format(image_url.split("/")[-1]))
dut_console.remote_conn.send("\n")
time.sleep(1)

dut_console.remote_conn.send("wget {}".format(image_url))
Expand Down

0 comments on commit 0d60a46

Please sign in to comment.