@@ -707,12 +707,30 @@ def get_parser(self, prog_name):
707707 default = {},
708708 help = _ ('Hints for the scheduler (optional extension)' ),
709709 )
710- parser .add_argument (
710+ config_drive_group = parser .add_mutually_exclusive_group ()
711+ config_drive_group .add_argument (
712+ '--use-config-drive' ,
713+ action = 'store_true' ,
714+ dest = 'config_drive' ,
715+ help = _ ("Enable config drive." ),
716+ )
717+ config_drive_group .add_argument (
718+ '--no-config-drive' ,
719+ action = 'store_false' ,
720+ dest = 'config_drive' ,
721+ help = _ ("Disable config drive." ),
722+ )
723+ # TODO(stephenfin): Drop support in the next major version bump after
724+ # Victoria
725+ config_drive_group .add_argument (
711726 '--config-drive' ,
712727 metavar = '<config-drive-volume>|True' ,
713728 default = False ,
714- help = _ ('Use specified volume as the config drive, '
715- 'or \' True\' to use an ephemeral drive' ),
729+ help = _ (
730+ "**Deprecated** Use specified volume as the config drive, "
731+ "or 'True' to use an ephemeral drive. Replaced by "
732+ "'--use-config-drive'."
733+ ),
716734 )
717735 parser .add_argument (
718736 '--min' ,
@@ -1013,16 +1031,19 @@ def _match_image(image_api, wanted_properties):
10131031 else :
10141032 hints [key ] = values
10151033
1016- # What does a non-boolean value for config-drive do?
1017- # --config-drive argument is either a volume id or
1018- # 'True' (or '1') to use an ephemeral volume
1019- if str (parsed_args .config_drive ).lower () in ("true" , "1" ):
1020- config_drive = True
1021- elif str (parsed_args .config_drive ).lower () in ("false" , "0" ,
1022- "" , "none" ):
1023- config_drive = None
1034+ if isinstance (parsed_args .config_drive , bool ):
1035+ # NOTE(stephenfin): The API doesn't accept False as a value :'(
1036+ config_drive = parsed_args .config_drive or None
10241037 else :
1025- config_drive = parsed_args .config_drive
1038+ # TODO(stephenfin): Remove when we drop support for
1039+ # '--config-drive'
1040+ if str (parsed_args .config_drive ).lower () in ("true" , "1" ):
1041+ config_drive = True
1042+ elif str (parsed_args .config_drive ).lower () in ("false" , "0" ,
1043+ "" , "none" ):
1044+ config_drive = None
1045+ else :
1046+ config_drive = parsed_args .config_drive
10261047
10271048 boot_kwargs = dict (
10281049 meta = parsed_args .property ,
0 commit comments