Revision 7f62a0b5

b/snf-tools/burnin.py
717 717
                           "FLAVOR ID instead of a randomly chosen one, " \
718 718
                           "useful if disk space is scarce",
719 719
                      default=None)
720
    parser.add_option("--force-image",
721
                      action="store", type="int", dest="force_imageid",
720
    parser.add_option("--image-id",
721
                      action="store", type="string", dest="force_imageid",
722 722
                      metavar="IMAGE ID",
723
                      help="Instead of testing all available images, test " \
724
                           "only the specified IMAGE ID",
723
                      help="Test the specified image id, use 'all' to test " \
724
                           "all available images (mandatory argument)",
725 725
                      default=None)
726 726
    parser.add_option("--show-stale",
727 727
                      action="store_true", dest="show_stale",
......
743 743
    if opts.delete_stale:
744 744
        opts.show_stale = True
745 745

  
746
    if not opts.show_stale:
747
        if not opts.force_imageid:
748
            print >>sys.stderr, "The --image-id argument is mandatory."
749
            parser.print_help()
750
            sys.exit(1)
751

  
752
        if opts.force_imageid != 'all':
753
            try:
754
                opts.force_imageid = int(opts.force_imageid)
755
            except ValueError:
756
                print >>sys.stderr, "Invalid value specified for --image-id." \
757
                                    "Use a numeric id, or `all'."
758
                sys.exit(1)
759

  
746 760
    return (opts, args)
747 761

  
748 762

  
......
785 799
    # The following cases run in parallel
786 800
    par_cases = []
787 801

  
788
    if opts.force_imageid:
789
        test_images = filter(lambda x: x["id"] == opts.force_imageid, DIMAGES)
790
    else:
802
    if opts.force_imageid == 'all':
791 803
        test_images = DIMAGES
804
    else:
805
        test_images = filter(lambda x: x["id"] == opts.force_imageid, DIMAGES)
792 806

  
793 807
    for image in test_images:
794 808
        imageid = image["id"]

Also available in: Unified diff