当前位置: 首页>>代码示例>>Python>>正文


Python InventoryUtils.deleteFile方法代码示例

本文整理汇总了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)
开发者ID:ddonnelly19,项目名称:dd-git,代码行数:46,代码来源:RemoveScanData.py


注:本文中的InventoryUtils.deleteFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。