Пример #1
0
    parser.add_argument('-l', '--log-dest')

    # Parse the arguments.
    args = parser.parse_args()

    # Just print the help information and quit.
    if args.help:
        usage()
        sys.exit(0)

    # Just print the version information and quit.
    if args.version:
        print(version())
        sys.exit(0)

    # Set the logging level.
    level = 20
    if args.verbose:
        level = 10

    # Create the logger (very useful).
    logger = loggers.get_logger(
        name  = "check_firmware",
        log   = not args.no_log,
        level = level,
        path  = args.log_dest
    )

    # Call the program to action.
    main(logger, args.verbose)
    # Parse the arguments.
    args = parser.parse_args()

    # Print help information and quit.
    if args.help:
        usage()
        sys.exit(0)

    # Print version information and quit.
    if args.version:
        print(version())
        sys.exit(0)

    # Set up the logger.
    logger = loggers.get_logger(name=psm.universal.attributes["name"], log=not args.no_log, path=args.log_dest)

    apps = args.apps if args.apps else []
    service = args.service
    action = args.action
    user = args.user
    template = args.template
    language = args.language

    # Output some information.
    output = (
        "{bar}\n"
        "{version}\n"
        "    service:  {service}\n"
        "    action:   {action}\n"
        "    app(s):   {apps}\n"
Пример #3
0
    # Parse the arguments.
    args = parser.parse_args()

    # Print help information and quit.
    if args.help:
        usage()
        sys.exit(0)

    # Print version information and quit.
    if args.version:
        print(version())
        sys.exit(0)

    # Set up the logger.
    logger = loggers.get_logger(name=psm.universal.attributes['name'],
                                log=not args.no_log,
                                path=args.log_dest)

    apps = args.apps if args.apps else []
    service = args.service
    action = args.action
    user = args.user
    template = args.template
    language = args.language

    if args.no_check_app and args.no_check_bin:
        parser.error("Cannot give both --no-check-app and --no-check-bin.")

    if args.no_check_app:
        no_check = True
        no_check_type = 'app'
Пример #4
0
    if args.version:
        print(version())
        sys.exit(0)

    # Set the logging level. There's the regular level, the verbose level,
    # and the super-verbose level.
    if args.verbose is None:
        log_level = 20
    elif args.verbose == 1:
        log_level = 10
    else:
        log_level = 5

    # Build the logger.
    logger = loggers.get_logger(name="cleanup_manager", log=not args.no_log, level=log_level, path=args.log_dest)

    # Set output logging prompts.
    for logging_level in [x for x in logger.prompts.keys() if x <= loggers.INFO]:
        logger.set_prompt(logging_level, "")

    # Get the necessary information to perform cleanup. Either calculate the
    # unix date of the time to delete before, or find the amount of space to
    # delete off the given volume.
    if args.keep_after:
        free_space = None
        keep_after = date_to_unix(args.keep_after, args.date_format)
    elif args.freeup:
        keep_after = None
        free_space = volume_size_target(args.freeup, args.target, logger)
    if args.version:
        print(version())
        sys.exit(0)

    # Set the logging level. There's the regular level, the verbose level,
    # and the super-verbose level.
    if args.verbose is None:
        log_level = 20
    elif args.verbose == 1:
        log_level = 10
    else:
        log_level = 5

    # Build the logger.
    logger = loggers.get_logger(name='cleanup_manager',
                                log=not args.no_log,
                                level=log_level,
                                path=args.log_dest)

    # Set output logging prompts.
    for logging_level in [
            x for x in logger.prompts.keys() if x <= loggers.INFO
    ]:
        logger.set_prompt(logging_level, '')

    # Get the necessary information to perform cleanup. Either calculate the
    # unix date of the time to delete before, or find the amount of space to
    # delete off the given volume.
    if args.keep_after:
        free_space = None
        keep_after = date_to_unix(args.keep_after, args.date_format)
    elif args.freeup: