def RemoveDirectory(params, options): if params.is_root(): return try: directory = GetObject(FindPath(options, params.Server, params.Name)) except pythoncom.com_error as details: rc = _GetWin32ErrorCode(details) if rc != winerror.ERROR_PATH_NOT_FOUND: raise log(2, "VirtualDirectory '%s' did not exist" % params.Name) directory = None if directory is not None: # Be robust should IIS get upset about unloading. try: directory.AppUnLoad() except: exc_val = sys.exc_info()[1] log(2, "AppUnLoad() for %s failed: %s" % (params.Name, exc_val)) # Continue trying to delete it. try: parent = GetObject(directory.Parent) parent.Delete(directory.Class, directory.Name) log(1, "Deleted Virtual Directory: %s" % (params.Name,)) except: exc_val = sys.exc_info()[1] log(1, "Failed to remove directory %s: %s" % (params.Name, exc_val))
def Uninstall(params, options): _CallHook(params, "PreRemove", options) DeleteExtensionFileRecords(params, options) for vd in params.VirtualDirs: _CallHook(vd, "PreRemove", options) try: directory = GetObject(FindPath(options, vd.Server, vd.Name)) except pythoncom.com_error, details: rc = _GetWin32ErrorCode(details) if rc != winerror.ERROR_PATH_NOT_FOUND: raise log(2, "VirtualDirectory '%s' did not exist" % vd.Name) directory = None if directory is not None: # Be robust should IIS get upset about unloading. try: directory.AppUnLoad() except: exc_val = sys.exc_info()[1] log(2, "AppUnLoad() for %s failed: %s" % (vd.Name, exc_val)) # Continue trying to delete it. try: parent = GetObject(directory.Parent) parent.Delete(directory.Class, directory.Name) except: exc_val = sys.exc_info()[1] log(1, "Failed to remove directory %s: %s" % (vd.Name, exc_val)) _CallHook(vd, "PostRemove", options) log (1, "Deleted Virtual Directory: %s" % (vd.Name,))