diff --git a/delete-swis-action-pack/config.yaml b/delete-swis-action-pack/config.yaml index 6b6ab54..4e32545 100644 --- a/delete-swis-action-pack/config.yaml +++ b/delete-swis-action-pack/config.yaml @@ -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 diff --git a/delete-swis-action-pack/delete-swis/script.py b/delete-swis-action-pack/delete-swis/script.py index d33a4bc..9d7da84 100644 --- a/delete-swis-action-pack/delete-swis/script.py +++ b/delete-swis-action-pack/delete-swis/script.py @@ -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*"])