當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。