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


Python GLIUtility.is_ip方法代码示例

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


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

示例1: set_network_netmask

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
	def set_network_netmask(self, xml_path, netmask, xml_attr=None):
		if not GLIUtility.is_ip(netmask):
			raise GLIException("IPAddressError", 'fatal','set_network_netmask', 'The specified netmask is not a valid IP Address!')
		else:
			# Need to guess the netmask... just in case (probably need the gateway..)
			pass
			
		self._network_netmask = netmask
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:10,代码来源:GLIClientConfiguration.py

示例2: update_mount

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
 def update_mount(self, button, data=None):
     if not GLIUtility.is_ip(self.mount_info_host.get_text()) and not GLIUtility.is_hostname(
         self.mount_info_host.get_text()
     ):
         msgdialog = Widgets.Widgets().error_Box(
             "Invalid Host or IP", "You must specify a valid hostname or IP address"
         )
         result = msgdialog.run()
         if result == gtk.RESPONSE_ACCEPT:
             msgdialog.destroy()
         return
     if self.mount_info_export.get_child().get_text() == "":
         msgdialog = Widgets.Widgets().error_Box("Invalid Entry", "You must enter a value for the export field")
         result = msgdialog.run()
         if result == gtk.RESPONSE_ACCEPT:
             msgdialog.destroy()
         return
     if self.mount_info_mountpoint.get_text() == "":
         msgdialog = Widgets.Widgets().error_Box("Invalid Entry", "You must enter a mountpoint")
         result = msgdialog.run()
         if result == gtk.RESPONSE_ACCEPT:
             msgdialog.destroy()
         return
     if self.active_entry == -1:
         self.netmounts.append(
             {
                 "host": self.mount_info_host.get_text(),
                 "export": self.mount_info_export.get_child().get_text(),
                 "type": self.mount_types[self.mount_info_type.get_active()],
                 "mountpoint": self.mount_info_mountpoint.get_text(),
                 "mountopts": self.mount_info_mountopts.get_text(),
             }
         )
         self.active_entry = -1
         self.mount_button_update.set_sensitive(False)
         self.mount_button_delete.set_sensitive(False)
         self.mount_button_populate.set_sensitive(False)
     else:
         self.netmounts[self.active_entry]["host"] = self.mount_info_host.get_text()
         self.netmounts[self.active_entry]["export"] = self.mount_info_export.get_child().get_text()
         self.netmounts[self.active_entry]["type"] = self.mount_info_type.get_text()
         self.netmounts[self.active_entry]["mountpoint"] = self.mount_info_mountpoint.get_text()
         self.netmounts[self.active_entry]["mountopts"] = self.mount_info_mountopts.get_text()
     self.refresh_list_at_top()
     self.disable_all_fields()
开发者ID:romaadereyko,项目名称:pentoo,代码行数:47,代码来源:NetworkMounts.py

示例3: populate_exports

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
 def populate_exports(self, button, data=None):
     host = self.mount_info_host.get_text()
     oldtext = self.mount_info_export.get_child().get_text()
     if GLIUtility.is_ip(host) or GLIUtility.is_hostname(host):
         remotemounts = commands.getoutput(
             "/usr/sbin/showmount -e " + host + " 2>&1 | egrep '^/' | cut -d ' ' -f 1 && echo"
         )
         mountlist = gtk.ListStore(gobject.TYPE_STRING)
         self.mount_info_export.set_model(mountlist)
         while remotemounts.find("\n") != -1:
             index = remotemounts.find("\n") + 1
             remotemount = remotemounts[:index]
             remotemounts = remotemounts[index:]
             remotemount = string.strip(remotemount)
             mountlist.append([remotemount])
         self.mount_info_export.get_child().set_text(oldtext)
     else:
         msgdialog = Widgets.Widgets().error_Box(
             "Invalid Host or IP", "You must specify a valid hostname or IP address to scan for exports"
         )
         result = msgdialog.run()
         if result == gtk.RESPONSE_ACCEPT:
             msgdialog.destroy()
开发者ID:romaadereyko,项目名称:pentoo,代码行数:25,代码来源:NetworkMounts.py

示例4: set_network_ip

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
	def set_network_ip(self, xml_path, ip, xml_attr=None):
		if not GLIUtility.is_ip(ip):
			raise GLIException("IPAddressError", 'fatal', 'set_network_ip', 'The specified IP ' + ip + ' is not a valid IP Address!')
		self._network_ip = ip
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:6,代码来源:GLIClientConfiguration.py

示例5: set_network_gateway

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
	def set_network_gateway(self, xml_path, gateway, xml_attr=None):
		if not GLIUtility.is_ip(gateway):
			raise GLIException("IPAddressError", 'fatal', 'set_network_gateway', "The gateway IP provided is not a valid gateway!!")
		self._network_gateway = gateway
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:6,代码来源:GLIClientConfiguration.py

示例6: set_network_broadcast

# 需要导入模块: import GLIUtility [as 别名]
# 或者: from GLIUtility import is_ip [as 别名]
	def set_network_broadcast(self, xml_path, broadcast, xml_attr=None):
		if not GLIUtility.is_ip(broadcast):
			raise GLIException("IPAddressError", 'fatal','set_network_broadcast', 'The specified broadcast is not a valid IP Address!')
		self._network_broadcast = broadcast
开发者ID:bremen77jodypurba,项目名称:pentoo,代码行数:6,代码来源:GLIClientConfiguration.py


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