• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python translate._函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中rhpl.translate._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: clickCB

    def clickCB(self, row, data):
	model = self.lvmlist.get_model()
	pvlist = self.getSelectedPhysicalVolumes(model)

	# get the selected row
	iter = model.get_iter((string.atoi(data),))

	# we invert val because we get called before checklist
	# changes the toggle state
	val      = not model.get_value(iter, 0)
	partname = model.get_value(iter, 1)
	id = self.partitions.getRequestByDeviceName(partname).uniqueID
	if val:
	    pvlist.append(id)
	else:
	    pvlist.remove(id)

	(availSpaceMB, neededSpaceMB, fspace) = self.computeSpaceValues(alt_pvlist=pvlist)
	if availSpaceMB < neededSpaceMB:
	    self.intf.messageWindow(_("Not enough space"),
				    _("You cannot remove this physical "
				      "volume because otherwise the "
				      "volume group will be too small to "
				      "hold the currently defined logical "
				      "volumes."), custom_icon="error")
	    return False

	self.updateVGSpaceLabels(alt_pvlist = pvlist)
	return True
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:29,代码来源:lvm_dialog_gui.py


示例2: listenKs

	def listenKs(self, line):
		"""Look in log line for a kickstart request."""
		
		# Track accesses both with and without local certs.
		interesting = line.count('install/sbin/public/kickstart.cgi') \
			or line.count('install/sbin/kickstart.cgi') \
			or line.count('install/sbin/public/jumpstart.cgi')
		if not interesting:
			return 

		fields = line.split()
		try:
			status = int(fields[8])
		except:
			raise InsertError, _("Apache log file not well formed!")

		nodeid = int(self.sql.getNodeId(fields[0]))
		self.sql.execute('select name from nodes where id=%d' % nodeid)
		try:
			name, = self.sql.fetchone()
		except:
			if status == 200:
				raise InsertError, \
				 _("Unknown node %s got a kickstart file!") \
				 % fields[0]
			return

		if name not in self.kickstarted:
			return

		self.kickstarted[name] = status

		self.statusGUI()
开发者ID:jeramirez,项目名称:base,代码行数:33,代码来源:insert-ethers.py


示例3: main

def main(argv):
    """
    Start things up.
    """
    config_obj = config_data.Config()
    config = config_obj.get()
    databases = config['databases']
    url = databases['primary']
    # connect
    db.Database(url)

    textdomain(I18N_DOMAIN)
    taskatron = Taskatron()
    if len(sys.argv) > 2 and sys.argv[1].lower() == "--test":
        print taskatron.node_comm(sys.argv[2],"test_add",1,2)
    elif len(sys.argv) > 1 and sys.argv[1].lower() == "--daemon":
        taskatron.clean_up_tasks()
        utils.daemonize("/var/run/vf_taskatron.pid")
        taskatron.run_forever()
    elif len(sys.argv) > 1 and sys.argv[1].lower() == "--infinity":
        taskatron.clean_up_tasks()
        taskatron.run_forever()
    elif len(sys.argv) == 1:
        print _("Running single task in debug mode, since --daemon wasn't specified...")
        taskatron.clean_up_tasks()
        taskatron.dotick(socket.gethostname(), True)
    else:
        useage = _("""Usage:
vf_taskatron --test server.fqdn
vf_taskatron --daemon
vf_tasktron  (no args) (just runs through one pass)
""")
        print useage
开发者ID:mpdehaan,项目名称:virt-factory,代码行数:33,代码来源:taskatron.py


示例4: mountImage

    def mountImage(self, cdNum):
	if (self.currentMedia):
	    raise SystemError, "trying to mount already-mounted iso image!"

	retrymount = True
	while retrymount:
	    try:
	        isoImage = self.isoPath + '/' + self.discImages[cdNum]

	        isys.makeDevInode("loop3", "/tmp/loop3")
	        isys.losetup("/tmp/loop3", isoImage, readOnly = 1)
	
	        isys.mount("loop3", "/tmp/isomedia", fstype = 'iso9660', readOnly = 1);
	        self.mntPoint = "/tmp/isomedia/"
	        self.currentMedia = [ cdNum ]

	        retrymount = False
	    except:
	        ans = self.messageWindow( _("Missing ISO 9660 Image"),
	                                  _("The installer has tried to mount "
	                                    "image #%s, but cannot find it on "
	                                    "the server.\n\n"
	                                    "Please copy this image to the "
	                                    "remote server's share path and "
	                                    "click Retry. Click Reboot to "
	                                    "abort the installation.")
	                                    % (cdNum,), type="custom",
	                                    custom_icon="warning",
	                                    custom_buttons=[_("_Reboot"),
	                                                    _("Re_try")])
	        if ans == 0:
	            sys.exit(0)
	        elif ans == 1:
	            self.discImages = findIsoImages(self.isoPath, self.messageWindow)
开发者ID:sergey-senozhatsky,项目名称:anaconda-11-vlan-support,代码行数:34,代码来源:image.py


示例5: reIPL

def reIPL(anaconda, loader_pid):
    instruction = _(
        "After shutdown, please perform a manual IPL from the device " "now containing /boot to continue installation"
    )

    reipl_path = "/sys/firmware/reipl"

    iplfs = anaconda.id.fsset.getEntryByMountPoint("/boot")
    if iplfs is None:
        iplfs = anaconda.id.fsset.getEntryByMountPoint("/")

    if iplfs is None:
        message = _("Could not get information for mount point /boot or /")
        log.warning(message)
        return (message, instruction)

    try:
        ipldev = iplfs.device.device
    except:
        ipldev = None

    if ipldev is None:
        message = _("Error determining mount point type")
        log.warning(message)
        return (message, instruction)

    message = (_("The mount point /boot or / is on a disk that we are not familiar with"), instruction)
    if ipldev.startswith("dasd"):
        message = reIPLonCCW(ipldev, reipl_path)
    elif ipldev.startswith("sd"):
        message = reIPLonFCP(ipldev, reipl_path)

    # the final return is either None if reipl configuration worked (=> reboot),
    # or a two-item list with errorMessage and rebootInstr (=> shutdown)
    return message
开发者ID:sergey-senozhatsky,项目名称:anaconda-11-vlan-support,代码行数:35,代码来源:iutil.py


示例6: readHeaderBlob

def readHeaderBlob(blob, filename=None):
    # Read two unsigned int32
    #print "blob: %s" % blob

#FIXME: for some reason, this fails alot
# not, but with current rpm, we dont really
# need it that much...
#    i0, i1 = struct.unpack("!2I", blob[:8])
#    if len(blob) != i0 * 16 + i1 + 8:
#        # Corrupt header
#        print "ugh, the header corruption test fails:"
#        log.trace_me()
#        return None
    # if this header is corrupt, rpmlib exits and we stop ;-<
    try:
        hdr = rpm.headerLoad(blob)
    except:
        if filename:
            print _("rpm was unable to load the header: %s" % filename)
        else:
            print _("rpm was unable to load a header")
        return None
    # Header successfully read
    #print hdr['name']
    return hdr
开发者ID:smgoller,项目名称:mrepo,代码行数:25,代码来源:rpmUtils.py


示例7: findExistingRoots

def findExistingRoots(anaconda, upgradeany = 0):
    if not flags.setupFilesystems:
        relstr = partedUtils.getReleaseString (anaconda.rootPath)
        if ((flags.cmdline.has_key("upgradeany")) or
            (upgradeany == 1) or
            (partedUtils.productMatches(relstr, productName))):
            return [(anaconda.rootPath, 'ext2', "")]
        return []

    # make ibft configured iscsi disks available
    anaconda.id.iscsi.startup(anaconda.intf)

    anaconda.id.diskset.openDevices()
    anaconda.id.partitions.getEncryptedDevices(anaconda.id.diskset)
    
    win = anaconda.intf.progressWindow(_("Searching"),
                              _("Searching for %s installations...") %
                              (productName,), 5)

    rootparts = anaconda.id.diskset.findExistingRootPartitions(upgradeany = upgradeany)
    for i in range(1, 6):
        time.sleep(0.25)
        win.set(i)

    win.pop()

    # close the devices to make sure we don't leave things sitting open 
    anaconda.id.diskset.closeDevices()

    # this is a hack... need to clear the skipped disk list after this
    partedUtils.DiskSet.skippedDisks = []
    partedUtils.DiskSet.exclusiveDisks = []

    return rootparts
开发者ID:abiquo,项目名称:anaconda-ee,代码行数:34,代码来源:upgrade.py


示例8: getScreen

    def getScreen(self, anaconda):
        self.anaconda = anaconda

	return ConfirmWindow.getScreen(self,
            _("Click next to begin upgrade of %s.") % (productName,),
            _("A complete log of the upgrade can be found in "
	      "the file '%s' after rebooting your system.") % (u'/root/upgrade.log',))
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:7,代码来源:confirm_gui.py


示例9: save

    def save(self):
	if self.fileName == None:
	    return

        # this really shouldn't happen, since it means that the
        # /etc/sysconfig/rhn directory doesn't exist, which is way broken

        # and note the attempted fix breaks useage of this by the applet
        # since it reuses this code to create its config file, and therefore
        # tries to makedirs() the users home dir again (with a specific perms)
        # and fails (see #130391)
        if not os.access(self.fileName, os.R_OK):
            if not os.access(os.path.dirname(self.fileName), os.R_OK):
                print _("%s was not found" % os.path.dirname(self.fileName))
                return
        
        f = open(self.fileName, "w")
        os.chmod(self.fileName, 0600)

	f.write("# Automatically generated Red Hat Update Agent "\
                "config file, do not edit.\n")
	f.write("# Format: 1.0\n")
	f.write("")
	for key in self.dict.keys():
	    val = self.dict[key]
	    f.write("%s[comment]=%s\n" % (key, val[0]))
	    if type(val[1]) == type([]):
		f.write("%s=%s;\n" % (key, string.join(map(str, val[1]), ';')))
	    else:
		f.write("%s=%s\n" % (key, val[1]))
	    f.write("\n")
	f.close()
开发者ID:smgoller,项目名称:mrepo,代码行数:32,代码来源:config.py


示例10: _ok

    def _ok(self, *args):
        combo = self.xml.get_widget("interfaceCombo")
        active = combo.get_active_iter()
        val = combo.get_model().get_value(active, 1)
        netdev = self.network.available()[val]

        # FIXME: need to do input validation
        if self.xml.get_widget("dhcpCheckbutton").get_active():
            self.window.hide()
            w = gui.WaitWindow(_("Dynamic IP"),
                               _("Sending request for IP information "
                                 "for %s...") %(netdev.get("device")))
            ns = isys.dhcpNetDevice(netdev.get("device"))
            w.pop()
            if ns is not None:
                self.rc = gtk.RESPONSE_OK
            if ns:
                f = open("/etc/resolv.conf", "w")
                f.write("nameserver %s\n" % ns)
                f.close()
                isys.resetResolv()
        else:
            ipv4addr = self.xml.get_widget("ipv4Address").get_text()
            ipv4nm = self.xml.get_widget("ipv4Netmask").get_text()
            gateway = self.xml.get_widget("gatewayEntry").get_text()
            ns = self.xml.get_widget("nameserverEntry").get_text()

            try:
                network.sanityCheckIPString(ipv4addr)
            except network.IPMissing, msg:
                self._handleIPMissing(_("IP Address"))
                return
            except network.IPError, msg:
                self._handleIPError(_("IP Address"), msg)
                return
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:35,代码来源:netconfig_dialog.py


示例11: __call__

    def __call__ (self, screen, anaconda):
        nfs_repository = anaconda.id.abiquo_rs.abiquo_nfs_repository 
        abiquo_server_ip = anaconda.id.abiquo_rs.abiquo_rabbitmq_host
        toplevel = GridFormHelp (screen, "Abiquo Remote Services Configuration",
                "abiquo_rs", 1, 4)
        toplevel.add (TextboxReflowed(37, "Abiquo NFS Repository URI. "
				"The NFS host and path where the Abiquo VM "
                                "Repository is located. "), 0, 0, (0, 0, 0, 1))

        entry1 = Entry (20, password = 0, text = nfs_repository)
        nfsgrid = Grid (2, 2)
        nfsgrid.setField (Label (_("NFS Repository:")), 0, 0, (0, 0, 1, 0), anchorLeft = 1)
        nfsgrid.setField (entry1, 1, 0)
        toplevel.add (nfsgrid, 0, 1, (0, 0, 0, 1))
        
        entry2 = Entry (20, password = 0, text = abiquo_server_ip)
        rsipgrid = Grid (2, 2)
        rsipgrid.setField (Label (_("Abiquo Server IP:")), 0, 0, (0, 0, 1, 0), anchorLeft = 1)
        rsipgrid.setField (entry1, 1, 0)
        toplevel.add (rsipgrid, 0, 1, (0, 0, 0, 1))

        bb = ButtonBar (screen, (TEXT_OK_BUTTON, TEXT_BACK_BUTTON))
        toplevel.add (bb, 0, 2, growx = 1)

        toplevel.setCurrent (entry1)
        result = toplevel.run ()
        rc = bb.buttonPressed (result)
        if rc == TEXT_BACK_CHECK:
            screen.popWindow()
	    return INSTALL_BACK

        anaconda.id.abiquo_rs.abiquo_nfs_repository = entry1.value()
        anaconda.id.abiquo_rs.abiquo_rabbitmq_host = entry2.value()
        screen.popWindow()
        return INSTALL_OK
开发者ID:abiquo-rpms,项目名称:anaconda-ee,代码行数:35,代码来源:abiquo_rs_text.py


示例12: _handleIPError

 def _handleIPError(self, field, errmsg):
     d = gtk.MessageDialog(_("Error With Data"), 0, gtk.MESSAGE_ERROR,
                           gtk.BUTTONS_OK,
                             _("An error occurred converting the value "
                               "entered for \"%s\":\n%s") %(field, errmsg))
     d.run()
     d.destroy()
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:7,代码来源:netconfig_dialog.py


示例13: _handleIPMissing

 def _handleIPMissing(self, field):
     d = gtk.MessageDialog(_("Error With Data"), 0, gtk.MESSAGE_ERROR,
                           gtk.BUTTONS_OK,
                           _("A value is required for the field %s.")
                           % (field,))
     d.run()
     d.destroy()
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:7,代码来源:netconfig_dialog.py


示例14: printRetrieveHash

def printRetrieveHash(amount, total, speed = 0, secs = 0):
    cfg = config.initUp2dateConfig()
    hashesTotal = 26
    
    if total:
        percent = int(100 * (float(amount) / total))
        hashesNeeded = int(hashesTotal * (float(amount) / total))
    else:
        percent = 100
        hashesNeeded = hashesTotal

    if cfg["isatty"]:
        for i in range(hashesNeeded):
            sys.stdout.write('#')

        for i in range(hashesNeeded, hashesTotal):
            sys.stdout.write(' ')

    if cfg["isatty"]:
        if amount == total:
            print "%-25s" % _(" Done.")
        else:
            print "%4d k/sec, %02d:%02d:%02d rem." % \
                  (speed / 1024, secs / (60*60), (secs % 3600) / 60,
                   secs % 60),
            for i in range(hashesTotal + 25):
                sys.stdout.write("\b")
    elif amount == total:
        print _("Retrieved.")
开发者ID:smgoller,项目名称:mrepo,代码行数:29,代码来源:wrapperUtils.py


示例15: main

def main(argv):

    regtoken         = "UNSET"
    username         = None
    password         = None
    server_url       = None
    profile_name     = ""
    virtual          = False
    bridge_config_ok = False

    # ensure we have somewhere to save parameters to, the node daemon will want
    # to know them later.

    if not os.path.exists("/etc/sysconfig/virt-factory"):
        os.makedirs("/etc/sysconfig/virt-factory")

    try:
        opts, args = getopt.getopt(argv[1:], "ht:u:p:s:P:vB", [
            "help", 
            "token=", 
            "username=",
            "password=", 
            "serverurl=",
            "profilename=",
            "virtual",
            "allow-bridge-config"
        ])
    except getopt.error, e:
        print _("Error parsing command list arguments: %s") % e
        showHelp()
        sys.exit(1)
开发者ID:mpdehaan,项目名称:virt-factory,代码行数:31,代码来源:register.py


示例16: warning

 def warning(self):
     rc = self.intf.messageWindow(_("Warning"), 
                 _("It is stongly recommended that you create a swap "
                   "file.  Failure to do so could cause the installer "
                   "to abort abnormally.  Are you sure that you wish "
                   "to continue?"), type = "yesno")
     return rc
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:7,代码来源:upgrade_swap_gui.py


示例17: getScreen

    def getScreen (self, anaconda):
        hbox = gtk.HBox (False, 5)
        
        pix = gui.readImageFromFile ("done.png")
        if pix:
            a = gtk.Alignment ()
            a.add (pix)
            a.set (0.5, 0.5, 1.0, 1.0)
	    a.set_size_request(200, -1)
            hbox.pack_start (a, False, False, 36)

        bootstr = ""
        if rhpl.getArch() in ['s390', 's390x']:
            floppystr = ""
            if not anaconda.canReIPL:
                self.rebootButton.set_label(_("Shutdown"))
            if not anaconda.reIPLMessage is None:
                floppystr = anaconda.reIPLMessage

        else:
            floppystr = _("Remove any media used during the installation "
                          "process and press the \"Reboot\" button to "
                          "reboot your system."
                          "\n\n")

        txt = _("Congratulations, the installation is complete.\n\n"
                "%s%s") %(floppystr, bootstr)
	label = gui.WrappingLabel(txt)

        hbox.pack_start (label, True, True)

        gtk.gdk.beep()
        return hbox
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:33,代码来源:congrats_gui.py


示例18: swapTooBig

    def swapTooBig(self):
        
        rc = self.intf.messageWindow(_("Warning"), 
                    _("There is not enough space on the device you "
			  "selected for the swap partition."),
                       type = "okcancel")
        return rc
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:7,代码来源:upgrade_swap_gui.py


示例19: findRootParts

def findRootParts(anaconda):
    if anaconda.dir == DISPATCH_BACK:
        return
    if anaconda.id.rootParts is None:
        anaconda.id.rootParts = findExistingRoots(anaconda)

    anaconda.id.upgradeRoot = []
    for (dev, fs, meta, label) in anaconda.id.rootParts:
        anaconda.id.upgradeRoot.append( (dev, fs) )

    if len(anaconda.id.rootParts) == 0 and anaconda.isKickstart:
        log.critical("A kickstart upgrade was attempted on a system with "
                "no valid upgrade candidates.")
        message = _("Anaconda did not find any partitions that are "
                    "valid upgrade candidates.  Note that upgrades "
                    "between major releases is not supported.")
        anaconda.intf.messageWindow(_("No valid upgrade partition"),
                            message)
        sys.exit(0)

    if anaconda.id.rootParts is not None and len(anaconda.id.rootParts) > 0:
        anaconda.dispatch.skipStep("findinstall", skip = 0)
        if productName.find("Red Hat Enterprise Linux") == -1:
            anaconda.dispatch.skipStep("installtype", skip = 1)
    else:
        anaconda.dispatch.skipStep("findinstall", skip = 1)
        anaconda.dispatch.skipStep("installtype", skip = 0)
开发者ID:abiquo,项目名称:anaconda-ee,代码行数:27,代码来源:upgrade.py


示例20: mountMedia

    def mountMedia(self, cdNum):
        if self.mediaIsMounted:
            raise SystemError, "trying to mount already-mounted iso image!"

        self.mountDirectory()

        retry = True
        while retry:
            try:
                isoImage = self.isoDir + '/' + self.path + '/' + self.discImages[cdNum]

                isys.makeDevInode("loop3", "/tmp/loop3")
                isys.losetup("/tmp/loop3", isoImage, readOnly = 1)

                isys.mount("loop3", self.tree, fstype = 'iso9660', readOnly = 1);
                self.mediaIsMounted = cdNum

                retry = False
            except:
                ans = self.messageWindow( _("Missing ISO 9660 Image"),
                                          _("The installer has tried to mount "
                                            "image #%s, but cannot find it on "
                                            "the hard drive.\n\n"
                                            "Please copy this image to the "
                                            "drive and click Retry. Click Reboot "
                                            " to abort the installation.")
                                            % (cdNum,), type="custom",
	                                    custom_icon="warning",
                                            custom_buttons=[_("_Reboot"),
	                                                    _("Re_try")])
                if ans == 0:
                    sys.exit(0)
                elif ans == 1:
                    self.discImages = findIsoImages(self.isoPath, self.messageWindow)
开发者ID:abelboldu,项目名称:anaconda-ee,代码行数:34,代码来源:harddrive.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python certificate.create_from_file函数代码示例发布时间:2022-05-26
下一篇:
Python rhpl.getArch函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap