Using the Package Cleanup Utility to Remove Packages

Overview of the Package Cleanup Utility

The Package Cleanup utility provides a simple, command-line interface for deleting or listing packages that have been published in a publication channel or in a WebDAV repository.
The SAS Publishing Framework supports channels that you define in the SAS Metadata Repository. Once channels have been defined, users can publish packages to the channels. For example, portal users can subscribe to available channels, view the persisted packages, and publish content (files, links, stored processes, and information maps).
Channels can be defined with archive or WebDAV persistent stores. When a package is published to a channel that is defined with a persistent store, the package is first persisted to that location and then it is published to all subscribers of that channel. All persisted packages have an expiration date. However, expired packages are not deleted automatically; you must explicitly delete them. You can use the Package Cleanup utility for this purpose.
Here is the path to the utility:
On Windows:
SAS-config-dir\Levn\Web\Utilities\PackageCleanup.bat
On UNIX and z/OS:
SAS-config-dir/Levn/Web/Utilities/PackageCleanup.sh.
The Package Cleanup utility enables you to review basic information about a persisted package and delete both the metadata and the actual package. Deletions are based on the expiration date of the package. This utility supports the deletion of packages from either type of persistent store (archive or WebDAV). The utility also supports the deletion of packages that are not defined in any channel.
The Package Cleanup utility also supports a listing feature. The utility can be used to display information about packages that are published in a particular channel, packages that are not defined in any channel, and packages that exist on a WebDAV server.
Note: You must have the appropriate permissions on a channel in order to delete packages from the channel. See the “Authorization Model” chapter in the SAS Intelligence Platform: Security Administration Guide.

Deleting Packages

Delete Packages

To delete packages, follow these steps:
  1. Run the command and specify the deletion date. You can also provide one of the following arguments:
    • a channel name in order to delete packages that are defined in a specific channel
    • a WebDAV URL in order to delete packages that are in the specified WebDAV location
    Note: If you do not provide the channel or WebDAV URL, then the utility deletes only orphaned packages that are not defined for any channel or WebDAV URL.
    After you run the command, the utility displays a list of packages that match your deletion criteria and prompts you to confirm deletion.
  2. Respond to the prompt to confirm deletion of the packages or to exit without deleting any packages.

Minimal Syntax for Deleting Packages

Here is the minimal syntax for deleting packages that are defined in a channel:
PackageCleanup 
       -d expiration-date  
       -ch channel-name 
       -metauser Metadata-Server-username  
       -metapass Metadata-Server-password
       -domain  authentication-domain
The utility deletes all packages in the specified channel that expire before the date and time specified.
Here is the minimal syntax for deleting packages that are not defined in a channel:
PackageCleanup 
       -d expiration-date  
       -metauser Metadata-Server-username
       -metapass Metadata-Server-password
       -domain  authentication-domain
Here is the minimal syntax for deleting packages that are defined in a WebDAV server:
PackageCleanup
       -url WebDAV-URL 
       -username WebDAV-Server-username 
       -password WebDAV-Server-password
       -d expiration-date  
       -metauser Metadata-Server-username
       -metapass Metadata-Server-password
       -domain  authentication-domain

Delete Specific Packages

To delete a specific package, specify -package package-name (or -pkg package-name) along with the date. The PACKAGE option enables you to specify the name of the package to delete.

Change Prompt Behavior

When you run the utility command, the utility displays a list of packages that match your deletion criteria and prompts you to confirm deletion of all the packages that are listed.
You can override this default behavior in order to be prompted for each package individually.
To override the default, specify -prompteach. You are then prompted to delete each package that meets the deletion criteria. After each package is processed, the utility displays a final list of all packages that were selected. You can then choose to delete all of those packages or exit without deleting any packages.
You can also turn off prompting altogether by specifying -noprompt. When you run the utility in batch mode, you must use the -noprompt option (unless shell programming is provided to respond to the prompts). It is best to run with prompts when you are learning how to use the application. With prompts, you can review proper date formatting and correct package deletion candidates with the option to exit without deleting any packages.

List Packages

To obtain a list of packages, run the command and specify the -list option. You can also provide one of the following arguments:
  • a channel name in order to list packages that are defined in a specific channel
  • a WebDAV URL in order to list packages that are in the specified WebDAV location
Note: If you do not provide the channel or WebDAV URL, then the utility displays only orphaned packages that are not defined for any channel or WebDAV URL.
The LIST option lists the following information for each package:
  • package name
  • date and time that the package was created
  • date and time that the package expires
Here is the minimal syntax for listing packages that are defined in a channel:
PackageCleanup 
       -list   
       -ch channel-name 
       -metauser Metadata-Server-username
       -metapass Metadata-Server-password
        -domain  authentication-domain
Here is the minimal syntax for listing packages that are not defined in a channel:
PackageCleanup 
       -list     
       -metauser Metadata-Server-username
       -metapass Metadata-Server-password
       -domain  authentication-domain
Here is the minimal syntax for listing packages that are defined in a WebDAV server:
PackageCleanup
       -list   
       -url WebDAV-URL 
       -username WebDAV-Server-username 
       -password WebDAV-Server-password
       -metauser Metadata-Server-username
       -metapass Metadata-Server-password
       -domain  authentication-domain

Arguments

The utility supports the following arguments:
-channel | -chchannel-name
Specify the channel that contains the packages that you want to list or delete.
-deletionDate | -d"expiration-date"
Specify the expiration date and time for the packages to be deleted. You can also use this argument when you list packages. The utility deletes or lists packages that have an expiration date before the date and time that you specify. The date and time should be enclosed in quotation marks. Format: “yyyy.MM.dd at hh:mm”
-list
The utility displays a list of packages (no deletion occurs).
-metauser Metadata-Server-username
Specify the user name to use when connecting to the SAS Metadata Server.
-metapass Metadata-Server-password
Specify the password to use when connecting to the SAS Metadata Server.
-domain authentication-domain
Specify the authentication domain for the SAS Metadata Server.
-package | -pkg package-name
Specify the name of a package to delete.
-url WebDAV-URL
Specify the WebDAV URL to use to locate packages to delete.
-username WebDAV-username
Specify the user name to use to connect to a WebDAV server.
-password WebDAV-password
Specify the password to use to connect to a WebDAV server.
-logfile | -log file-name
Specify the name of a log file to create. If the log file already exists, then the log lines are appended to the current file.
-noprompt
The utility does not prompt for confirmation of deletions.
-deletenodate
The utility lists or deletes packages that have no expiration date defined.
-prompteach
The utility prompts you to confirm each package individually for deletion.
-debug
The utility produces debugging information for all the SAS Foundation Services.
-help
The utility displays this help information. (You must also provide the -metauser, -metapass, and -domain arguments in order to get the help information.)

Utility Logging and Debugging

By default, application activity is sent to the Java standard out console. If you want to log to a file, use the LOGFILE option. For example, you might specify -logfile c:\mylog.file. If the log file already exists, then the log lines are appended to the current file.
Use the DEBUG option to enable debugging-level information. This option provides debugging information for all of the Foundation Services as well as the utility. This option should be used only when you experience problems with the utility and want to determine the cause.

Examples

This example deletes all packages published to the Sales channel that have an expiration date before October 7, 2009, at 12:59 p.m.
  PackageCleanup -ch Sales -d  "2009.10.07 at 12:59 PM" -metauser userX 
     -metapass passX -domain DefaultAuth
This example uses the PROMPTEACH option, which enables you to confirm deletion of each package individually.
PackageCleanup -ch Sales -d "2009.10.07 at 12:59 PM" -metauser userX 
     -metapass passX -domain DefaultAuth -prompteach
This example deletes a specific package that is defined in the Sales channel. The PKG option is specified to identify the exact package to delete. In this example, the package is named s109513698.spk and has an expiration date of October 7, 2009, at 12:59 p.m.
PackageCleanup -ch Sales -d "2009.10.07 at 12:59 PM" -pkg s109513698.spk 
   -metauser userX -metapass passX -domain DefaultAuth
This example deletes all packages that are not defined in any channel. Only packages that are not defined in a channel and have an expiration date before October 7, 2009, at 10:00 a.m. are deleted.
PackageCleanup -d "2009.10.07 at 10:00 AM" -metauser userX -metapass passX
     -domain DefaultAuth
This example deletes packages that have been published to a WebDAV server. The utility connects to the server using the specified URL and deletes all packages published to that location that have an expiration before October 7, 2009, at 05:00 a.m.
PackageCleanup -d "2009.10.07 at 05:00 AM" -url http://myhost.com/Sales/Packages 
     -username davUserX -password davPasswordX -metauser userX -metapass passX 
     -domain DefaultAuth
This example deletes a specific package from a WebDAV server. The PKG option is used to provide the name of the package to delete. The utility connects to the server using the specified URL and deletes the package named s3964865240.
PackageCleanup -d "2009.10.07 at 12:59 PM"  -metauser userX -metapass passX 
     -domain DefaultAuth -url http://myhost.com/Sales/Packages -username davUserX 
     -password davPasswordX -pkg s3964865240
This example lists packages (does not delete) by using the LIST option. Note that the -d argument is not required when listing packages. This example lists all packages that are published in the Sales channel.
PackageCleanup -list -ch Sales -metauser userX -metapass passX 
   -domain DefaultAuth
This example uses the LIST option to list all packages with an expiration date before October 7, 2009, at 12:00 p.m.
PackageCleanup -ch Sales -d "2009.10.07 at 12:00 PM" -metauser userX 
     -metapass passX  -domain DefaultAuth -prompteach -list