#################################################################### # Delete the application. #################################################################### proc deleteApplication { appName } { global AdminConfig global AdminControl global AdminApp set procName [ lindex [ info level 0 ] 0 ] putsLog "## proc - $procName" foreach i [ info args $procName ] { upvar 0 $i ilocal set propertiesArray($i) $ilocal } putsLog "procedure arguments are................." foreach { a b } [ array get propertiesArray ] { putsLog [ format "%-35s %s" "$a" "$b" ] } # check if the application exists. putsLog "installed applications............." foreach i [ $AdminApp list ] { putsLog [ format "%-5s %-s" " " $i ] lappend appList $i } if { [ lsearch $appList $appName ] == -1 } { putsLog "Application $appName is not installed." return } else { putsLog "Application $appName is installed." foreach i [ $AdminControl queryNames type=Application,* ] { lappend appListRun [ $AdminControl getAttribute $i name ] } # display any running applications. # applications must be stopped before they can be deleted. if { [ info exist appListRun ] == 1 } { putsLog "running applications are............." foreach i $appListRun { putsLog [ format "%-5s %-s" " " $i ] } # check if the application is running. if { [ lsearch $appListRun $appName ] == -1 } { putsLog "$appName is not running." if { [ catch { $AdminApp uninstall $appName } r ] == 0 } { putsLog "$appName uninstalled successfully" putsLog $r } else { putsLog "ERROR: failed to uninstall $appName" return -code error $r } } else { putsLog "ERROR:." putsLog "ERROR: Application $appName is running." putsLog "ERROR: Applications must be stopped before deletion." putsLog "ERROR:." return -code error } } } }