Esempio n. 1
0
 def make_parser(cls):
     """Create an option parser shared across all instances of this class"""
     parser = config.IPAOptionParser(version=version.VERSION,
                                     usage=cls.usage,
                                     formatter=config.IPAFormatter())
     cls.option_parser = parser
     cls.add_options(parser)
Esempio n. 2
0
def parse_options():
    usage = "%prog start|stop|restart|status\n"
    parser = config.IPAOptionParser(usage=usage,
                                    formatter=config.IPAFormatter())

    parser.add_option(
        "-d",
        "--debug",
        action="store_true",
        dest="debug",
        help="Display debugging information",
    )
    parser.add_option(
        "-f",
        "--force",
        action="store_true",
        dest="force",
        help="Force IPA to start. Combine options "
        "--skip-version-check and --ignore-service-failures",
    )
    parser.add_option(
        "--ignore-service-failures",
        action="store_true",
        dest="ignore_service_failures",
        help="If any service start fails, do not rollback the "
        "services, continue with the operation",
    )
    parser.add_option(
        "--skip-version-check",
        action="store_true",
        dest="skip_version_check",
        default=False,
        help="skip version check",
    )

    options, args = parser.parse_args()
    safe_options = parser.get_safe_opts(options)

    if options.force:
        options.ignore_service_failures = True
        options.skip_version_check = True

    return safe_options, options, args