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


Python Logging.errorExit方法代码示例

本文整理汇总了Python中Logging.Logging.errorExit方法的典型用法代码示例。如果您正苦于以下问题:Python Logging.errorExit方法的具体用法?Python Logging.errorExit怎么用?Python Logging.errorExit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Logging.Logging的用法示例。


在下文中一共展示了Logging.errorExit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import errorExit [as 别名]
	def create(self):
		conn = libvirt.open(DC.get("virsh", "connect"))
		
		try:
			storagePool = conn.storagePoolLookupByName(self.pool)
			storagePool.refresh(0)
		except:
			Logging.errorExit("There is no '%s' libvirt storage pool." % self.pool)
		
		path = os.path.basename(self.path)
		size = Units(self.size).convertTo("B")
		
		diskXML = """
		<volume>
			<name>%s</name>
			<capacity>%i</capacity>
			<allocation>0</allocation>
			<target>
				<format type='raw'/>
			</target>
		</volume>
		"""
		diskXML = diskXML % (path, size)
		
		try:
			storage = storagePool.createXML(diskXML, 0)
		except Exception as e:
			Logging.errorExit("%s (name: %s)" % (str(e), path))
		
		return storage
开发者ID:jaxxer,项目名称:aivm,代码行数:32,代码来源:Guest.py

示例2: parseImageFile

# 需要导入模块: from Logging import Logging [as 别名]
# 或者: from Logging.Logging import errorExit [as 别名]
    def parseImageFile(self, guest):
        def checkTreeinfo(url):
            url = ("%s/%s" % (url, ".treeinfo")) if url[-1] != "/" else ("%s%s" % (url, ".treeinfo"))

            try:
                httpRequest = urllib2.urlopen(url)
                return True

            except:
                return False

        path = self.parseTextElement(guest, "image-file")

        if path and path.startswith("http://"):
            if checkTreeinfo(path):
                return Location.HttpDir(path)

            elif path.endswith(".iso"):
                return Location.HttpIso(path)

        elif path and path.endswith(".iso"):
            return Location.LocalIso(path)
        else:
            Logging.errorExit("Image file of all guests must be set.")
开发者ID:jaxxer,项目名称:aivm,代码行数:26,代码来源:ConfigParserXML.py


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