~bregma/libertine/fix-name

« back to all changes in this revision

Viewing changes to tools/libertine-container-manager

libertine-container-manager: Add new "--force" option to force installation of Ubuntu distros that are no longer supported.

Approved by Stephen M. Webb, Libertine CI Bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    return distinfo.get('CODENAME', 'n/a')
68
68
 
69
69
 
70
 
def is_distro_valid(distro):
 
70
def is_distro_valid(distro, force):
 
71
    if force:
 
72
       return UbuntuDistroInfo().valid(distro)
 
73
 
71
74
    supported_distros = UbuntuDistroInfo().supported()
72
75
 
73
76
    try:
210
213
def create(args):
211
214
    password = None
212
215
 
213
 
    if args.distro and not is_distro_valid(args.distro):
 
216
    if args.distro and not is_distro_valid(args.distro, args.force):
214
217
        print("Invalid distro %s" % args.distro, file=sys.stderr)
215
218
        sys.exit(1)
216
219
 
376
379
    parser_create.add_argument(
377
380
        '-n', '--name',
378
381
        help=("User friendly container name."))
 
382
    parser_create.add_argument(
 
383
        '--force', action='store_true',
 
384
        help=("Force the installation of the given valid Ubuntu distro even if "
 
385
              "it is no longer supported."))
379
386
    parser_create.set_defaults(func=create)
380
387
 
381
388
    # Handle the destroy command and its options