Skip to content

Commit

Permalink
delete-swis: Account for Bug836028 in deletion of swis
Browse files Browse the repository at this point in the history
'flash:/EOS.swi' or 'flash:EOS.swi' are possible boot image values.
Account for this in the script to avoid deletion of boot image
accidentally

Change-Id: Ie97c3500b22cbb57bb8931d8beae88efb1bbe834
  • Loading branch information
cianmcgrath committed Oct 9, 2023
1 parent e16200f commit b0ae8c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion delete-swis-action-pack/config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type: PACKAGE
version: 1.1.0
version: 1.1.1
name: delete-swis Action package
description: Action package containing a script that deletes all unused EOS images on /mnt/flash
9 changes: 6 additions & 3 deletions delete-swis-action-pack/delete-swis/script.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@
showbootResp = cmdOut[1]["response"]
# Show boot response is a dict. The eos boot image is under 'softwareImage'
eosBootImageFull = showbootResp["softwareImage"]
# The eos boot image is in the form of 'flash:/EOS.swi'. Only the image name is of interest,
# so split on the / to get 'EOS.swi'
eosBootImage = eosBootImageFull.split("/")[1]
# The eos boot image is in the form of either 'flash:/EOS.swi' or 'flash:EOS.swi'.
# Only the image name is of interest, so split on the common ':' to get 'EOS.swi' part
# and parse further if needed
eosBootImage: str = eosBootImageFull.split(':')[1]
if eosBootImage.startswith('/'):
eosBootImage = eosBootImage[1:]

# This command returns a large response message
cmdOut = ctx.runDeviceCmds(["enable", "dir flash:EOS*"])
Expand Down

0 comments on commit b0ae8c8

Please sign in to comment.