BookmarkSubscribeRSS Feed
RichardP
Quartz | Level 8

Hello, 

 

I am using this command to delete promotion packages in Viya 3.4. 

 

sas-admin transfer delete --id 15340677-581a-4635-b548-4df207226714

 

I would like to simultaneously delete multiple packages? Does anyone know if this is this possible with this command or do I need to write a script for this?

 

regards,

 

Richard

 

2 REPLIES 2
gwootton
SAS Super FREQ
The sas-admin transfer delete command only accepts one ID or URI at a time, so if you had multiple packages you would need to run each separately.
--
Greg Wootton | Principal Systems Technical Support Engineer
EyalGonen
Lapis Lazuli | Level 10

Hi @RichardP 

 

I struggled with the same issue and came up with this script that seems to work. Please take care before using it and make sure you have a backup.

Note that you can replace the jq '.items[].id' with jq '.items[0].id' to test deleting only the first package instead of all packages at once.

 

The script assumes that you created a profile+authenticated with "sas-admin" prior to running this.

 

 
#!/bin/bash

echo "List of packages to be deleted:"
/opt/sas/viya/home/bin/sas-admin transfer list

echo "Proceed with delete? (Y/n)"
read vproceed

if [[ "$vproceed" == "Y"]]; then
    echo "Deleting packages..."
    for i in $(/opt/sas/viya/home/bin/sas-admin --output json transfer list | jq '.items[].id' | sed 's/\"//g') 
    do
        yes | /opt/sas/viya/home/bin/sas-admin transfer delete --id $i
    done
else
    echo "Exiting without deleting packages..."
fi

Eyal

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1020 views
  • 2 likes
  • 3 in conversation