本文整理汇总了Python中InventoryUtils.deleteFile方法的典型用法代码示例。如果您正苦于以下问题:Python InventoryUtils.deleteFile方法的具体用法?Python InventoryUtils.deleteFile怎么用?Python InventoryUtils.deleteFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InventoryUtils
的用法示例。
在下文中一共展示了InventoryUtils.deleteFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: removeScanData
# 需要导入模块: import InventoryUtils [as 别名]
# 或者: from InventoryUtils import deleteFile [as 别名]
def removeScanData(Framework):
RemoveScanData = Boolean.parseBoolean(Framework.getParameter('RemoveScanData'))
remoteScanFileLocation = Framework.getProperty(InventoryUtils.STATE_PROPERTY_REMOTE_SCAN_FILE_LOCATION)
remoteScanFileLogLocation = os.path.splitext(remoteScanFileLocation)[0] + '.log'
scannerExecutableRemotePath = Framework.getProperty(InventoryUtils.SCANNER_EXECUTABLE_REMOTE_PATH)
scannerConfigRemotePath = Framework.getProperty(InventoryUtils.SCANNER_CONFIG_REMOTE_PATH)
protocolName = Framework.getProperty(InventoryUtils.STATE_PROPERTY_CONNECTED_SHELL_PROTOCOL_NAME)
isUDA = protocolName == ClientsConsts.DDM_AGENT_PROTOCOL_NAME
if RemoveScanData and not isUDA and (remoteScanFileLocation is not None):
if not InventoryUtils.deleteFile(Framework, remoteScanFileLocation):
errorMessage = 'Failed to delete scan file ' + remoteScanFileLocation
logger.debug(errorMessage)
Framework.reportError(errorMessage)
Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
return
if RemoveScanData and not isUDA and (remoteScanFileLogLocation is not None):
if not InventoryUtils.deleteFile(Framework, remoteScanFileLogLocation):
errorMessage = 'Failed to delete scan log ' + remoteScanFileLogLocation
logger.debug(errorMessage)
Framework.reportError(errorMessage)
Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
return
if RemoveScanData and not isUDA and (scannerExecutableRemotePath is not None):
logger.debug("Remove scan executable file:", scannerExecutableRemotePath)
if not InventoryUtils.deleteFile(Framework, scannerExecutableRemotePath):
errorMessage = 'Failed to delete scan executable file ' + scannerExecutableRemotePath
logger.debug(errorMessage)
Framework.reportError(errorMessage)
Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
return
if RemoveScanData and not isUDA and (scannerConfigRemotePath is not None):
logger.debug("Remove scan config file:", scannerConfigRemotePath)
if not InventoryUtils.deleteFile(Framework, scannerConfigRemotePath):
errorMessage = 'Failed to delete scan config file ' + scannerConfigRemotePath
logger.debug(errorMessage)
Framework.reportError(errorMessage)
Framework.setStepExecutionStatus(WorkflowStepStatus.FAILURE)
return
Framework.setStepExecutionStatus(WorkflowStepStatus.SUCCESS)