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

Python options.KSOptionParser类代码示例

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

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



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

示例1: _getParser

    def _getParser(self):
        op = KSOptionParser()
        # people would struggle remembering the exact word
        op.add_option("--agreed", "--agree", "--accepted", "--accept",
                      dest="agreed", action="store_true", default=False)

        return op
开发者ID:autotune,项目名称:pykickstart,代码行数:7,代码来源:eula.py


示例2: _getParser

    def _getParser(self):
        try:
            op = KSOptionParser(lineno=self.lineno)
        except TypeError:
            # the latest version has not lineno argument
            op = KSOptionParser()
            self.__new_version = True

        op.add_option(
            "--defaultdesktop",
            dest="defaultdesktop",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--autologinuser",
            dest="autologinuser",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--defaultdm",
            dest="defaultdm",
            action="store",
            type="string",
            nargs=1)
        op.add_option(
            "--session",
            dest="session",
            action="store",
            type="string",
            nargs=1)
        return op
开发者ID:MeeGoIntegration,项目名称:imager,代码行数:33,代码来源:build_ks.py


示例3: _getParser

    def _getParser(self):
        op = KSOptionParser()
        op.add_option("--biospart", dest="biospart")
        op.add_option("--partition", dest="partition")
        op.add_option("--dir", dest="dir", required=1)

        return op
开发者ID:autotune,项目名称:pykickstart,代码行数:7,代码来源:harddrive.py


示例4: _getParser

 def _getParser(self):
     op = KSOptionParser()
     op.add_option("--name", dest="name", action="store", type="string",
                   required=1)
     op.add_option("--dev", dest="devices", action="append", type="string",
                   required=1)
     return op
开发者ID:kenelite,项目名称:pykickstart,代码行数:7,代码来源:dmraid.py


示例5: handle_header

    def handle_header(self, lineno, args):

        op = KSOptionParser()
        op.add_option("--enable", "-e", action="store_true", default=False,
                      dest="state", help="Enable Cloud Support")
        op.add_option("--disable", "-d", action="store_false",
                      dest="state", help="(Default) Disable Cloud Support")
        op.add_option("--allinone", "-a", action="store_true", default=False,
                      dest="mode", help="Specify the mode of Packstack Installation")
        op.add_option("--answer-file", "-f", action="store", type="string",
                      dest="file", help="Specify URL of answers file")
        (options, extra) = op.parse_args(args=args, lineno=lineno)

        # Error Handling
        if str(options.state) == "True":
            self.state = str(options.state)
            if options.file and options.mode:
                msg = "options --allinone and --answer-file are mutually exclusive"
                raise KickstartParseError(msg)
            elif options.file:
                try:
                    response = urllib2.urlopen(options.file)
                    for line in response:
                        self.lines += line
                except urllib2.HTTPError, e:
                    msg = "Kickstart Error:: HTTPError: " + str(e.code)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except urllib2.URLError, e:
                    msg = "Kickstart Error: HTTPError: " + str(e.reason)
                    raise KickstartParseError, formatErrorMsg(lineno, msg=msg)
                except:
开发者ID:gbraad,项目名称:anaconda-packstack-addon,代码行数:31,代码来源:cloud_ks.py


示例6: handle_header

    def handle_header(self, lineno, args):
        """
        The handle_header method is called to parse additional arguments in the
        %addon section line.

        args is a list of all the arguments following the addon ID. For
        example, for the line:
        
            %addon org_fedora_hello_world --reverse --arg2="example"

        handle_header will be called with args=['--reverse', '--arg2="example"']

        :param lineno: the current line number in the kickstart file
        :type lineno: int
        :param args: the list of arguments from the %addon line
        :type args: list
        """

        op = KSOptionParser()
        op.add_option("--reverse", action="store_true", default=False,
                dest="reverse", help="Reverse the display of the addon text")
        (opts, extra) = op.parse_args(args=args, lineno=lineno)
        
        # Reject any additional arguments. Since AddonData.handle_header
        # rejects any arguments, we can use it to create an error message
        # and raise an exception.
        if extra:
            AddonData.handle_header(self, lineno, args)

        # Store the result of the option parsing
        self.reverse = opts.reverse
开发者ID:dashea,项目名称:hello-world-anaconda-addon,代码行数:31,代码来源:hello_world.py


示例7: _getParser

    def _getParser(self):
        op = KSOptionParser(prog="module", description="""
                            The module command makes it possible to manipulate
                            modules.

                            (In this case we mean modules as introduced by the
                            Fedora modularity initiative.)

                            A module is defined by a unique name and a stream id,
                            where single module can (and usually has) multiple
                            available streams.

                            Streams will in most cases corresponds to stable
                            releases of the given software components
                            (such as Node.js, Django, etc.) but there could be
                            also other use cases, such as a raw upstream master
                            branch stream or streams corresponding to an upcoming
                            stable release.

                            For more information see the Fedora modularity
                            initiative documentation:
                            https://docs.pagure.org/modularity/""", version=F29)
        op.add_argument("--name", metavar="<module_name>", version=F29, required=True,
                        help="""
                        Name of the module to enable.""")
        op.add_argument("--stream", metavar="<module_stream_name>", version=F29, required=False,
                        help="""
                        Name of the module stream to enable.""")

        return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:30,代码来源:module.py


示例8: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="url", description="""
                         Install from an installation tree on a remote server
                         via FTP or HTTP.""", version=FC3)
     op.add_argument("--url", required=True, version=FC3, help="""
                     The URL to install from. Variable substitution is done
                     for $releasever and $basearch in the url.""")
     return op
开发者ID:cathywife,项目名称:pykickstart,代码行数:8,代码来源:url.py


示例9: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="eula", version=F20, description="""
                         Automatically accept Red Hat's EULA""")
     # people would struggle remembering the exact word
     op.add_argument("--agreed", "--agree", "--accepted", "--accept",
                     dest="agreed", action="store_true", default=False,
                     version=F20, help="Accept the EULA. This is mandatory option!")
     return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:8,代码来源:eula.py


示例10: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="mouse", description="""
                         Configure the system mouse""", version=RHEL3)
     op.add_argument("--device", default="", version=RHEL3,
                     help="Which device node to use for mouse")
     op.add_argument("--emulthree", default=False, action="store_true",
                     version=RHEL3, help="If set emulate 3 mouse buttons")
     return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:8,代码来源:mouse.py


示例11: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="fcoe", description="""
                         Discover and attach FCoE storage devices accessible via
                         specified network interface
                         """, version=F12)
     op.add_argument("--nic", required=True, version=F12, help="""
                     Name of the network device connected to the FCoE switch""")
     return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:8,代码来源:fcoe.py


示例12: _getParser

    def _getParser(self):
        def drive_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d)

        op = KSOptionParser()
        op.add_option("--drives", dest="ignoredisk", action="callback",
                      callback=drive_cb, nargs=1, type="string", required=1)
        return op
开发者ID:tradej,项目名称:pykickstart-old,代码行数:9,代码来源:ignoredisk.py


示例13: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="iscsiname", description="""
         Assigns an initiator name to the computer. If you use the iscsi
         parameter in your kickstart file, this parameter is mandatory, and
         you must specify iscsiname in the kickstart file before you specify
         iscsi.""", version=FC6)
     op.add_argument("iqn", metavar="<iqn>", nargs=1, version=FC6, help="""
                     IQN name""")
     return op
开发者ID:cathywife,项目名称:pykickstart,代码行数:9,代码来源:iscsiname.py


示例14: handleHeader

    def handleHeader(self, lineno, args):
        """Process the arguments to the %addon header."""
        Section.handleHeader(self, lineno, args)
        op = KSOptionParser(version=self.version)
        (_opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
        self.addon_id = extra[0]

        # if the addon is not registered, create dummy placeholder for it
        if self.addon_id and not hasattr(self.handler.addons, self.addon_id):
            setattr(self.handler.addons, self.addon_id, AddonData(self.addon_id))
开发者ID:mairin,项目名称:anaconda,代码行数:10,代码来源:addons.py


示例15: _getParser

 def _getParser(self):
     op = KSOptionParser(prog="ignoredisk", description="""
         Controls anaconda's access to disks attached to the system. By
         default, all disks will be available for partitioning. Only one of
         the following three options may be used.""", version=FC3)
     op.add_argument("--drives", dest="ignoredisk", type=commaSplit,
                     required=True, version=FC3, help="""
                     Specifies those disks that anaconda should not touch
                     when partitioning, formatting, and clearing.""")
     return op
开发者ID:atodorov,项目名称:pykickstart,代码行数:10,代码来源:ignoredisk.py


示例16: _getParser

    def _getParser(self):
        op = KSOptionParser(prog="liveimg", description="""
            Install a disk image instead of packages. The image can be the
            squashfs.img from a Live iso, or any filesystem mountable by the
            install media (eg. ext4). Anaconda expects the image to contain
            utilities it needs to complete the system install so the best way to
            create one is to use livemedia-creator to make the disk image. If
            the image contains /LiveOS/*.img (this is how squashfs.img is
            structured) the first *img file inside LiveOS will be mounted and
            used to install the target system. The URL may also point to a
            tarfile of the root filesystem. The file must end in .tar, .tbz,
            .tgz, .txz, .tar.bz2, tar.gz, tar.xz""",
            version=F19)
        op.add_argument("--url", metavar="<url>", required=True, version=F19,
                        help="""
                        The URL to install from. http, https, ftp and file are
                        supported.""")
        op.add_argument("--proxy", metavar="<proxyurl>", version=F19, help="""
                        Specify an HTTP/HTTPS/FTP proxy to use while performing
                        the install. The various parts of the argument act like
                        you would expect. Syntax is::

                        ``--proxy=[protocol://][username[:password]@]host[:port]``
                        """)
        op.add_argument("--noverifyssl", action="store_true", version=F19,
                        default=False, help="""
                        For a tree on a HTTPS server do not check the server's
                        certificate with what well-known CA validate and do not
                        check the server's hostname matches the certificate's
                        domain name.""")
        op.add_argument("--checksum", metavar="<sha256>", version=F19,
                        help="Optional sha256 checksum of the image file")
        return op
开发者ID:cathywife,项目名称:pykickstart,代码行数:33,代码来源:liveimg.py


示例17: _getParser

 def _getParser(self):
     op = KSOptionParser()
     op.add_argument("--url", required=True)
     op.add_argument("--proxy")
     op.add_argument("--noverifyssl", action="store_true", default=False)
     op.add_argument("--checksum")
     return op
开发者ID:jlebon,项目名称:pykickstart,代码行数:7,代码来源:liveimg.py


示例18: _getParser

 def _getParser(self):
     op = KSOptionParser()
     op.add_argument("--username", required=True)
     op.add_argument("--iscrypted", dest="isCrypted", action="store_true", default=False)
     op.add_argument("--plaintext", dest="isCrypted", action="store_false")
     op.add_argument("--lock", action="store_true", default=False)
     return op
开发者ID:KevinMGranger,项目名称:pykickstart,代码行数:7,代码来源:sshpw.py


示例19: _getParser

    def _getParser(self):
        def services_cb (option, opt_str, value, parser):
            for d in value.split(','):
                parser.values.ensure_value(option.dest, []).append(d.strip())

        op = KSOptionParser()
        op.add_option("--disabled", dest="disabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        op.add_option("--enabled", dest="enabled", action="callback",
                      callback=services_cb, nargs=1, type="string")
        return op
开发者ID:tradej,项目名称:pykickstart-old,代码行数:11,代码来源:services.py


示例20: _getParser

 def _getParser(self):
     op = KSOptionParser()
     op.add_argument("--target")
     op.add_argument("--ipaddr", required=True)
     op.add_argument("--port")
     op.add_argument("--user")
     op.add_argument("--password")
     return op
开发者ID:KevinMGranger,项目名称:pykickstart,代码行数:8,代码来源:iscsi.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python parser.Packages类代码示例发布时间:2022-05-25
下一篇:
Python load.load_to_str函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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