Skip to content
Snippets Groups Projects
  • Thomas Woerner's avatar
    d05ad6b1
    module_params_get*: Fail on empty string in string list parameters · d05ad6b1
    Thomas Woerner authored
    So far it is possible to pass list parameters with empty strings to the
    modules. The use of empty strings in list does not make a lot of sense,
    though. The simple solution is to add a check to module_params_get for
    empty strings in returned lists.
    
    The option allow_empty_string can be set to True to allow an empty string
    in the list with a list len of 1. The option defaults to False. It is
    needed for some parameters the modules, like for example userauthtype in
    the user module. It is using "" to reset to the default value.
    
    module_params_get_lowercase has been changed to use module_params_get to
    have one place to add the check.
    
    Due to an issue in Ansible it is possible to use the empty string "" for
    lists with choices, even if the empty list is not part of the choices.
    Ansible issue https://github.com/ansible/ansible/issues/77108
    d05ad6b1
    History
    module_params_get*: Fail on empty string in string list parameters
    Thomas Woerner authored
    So far it is possible to pass list parameters with empty strings to the
    modules. The use of empty strings in list does not make a lot of sense,
    though. The simple solution is to add a check to module_params_get for
    empty strings in returned lists.
    
    The option allow_empty_string can be set to True to allow an empty string
    in the list with a list len of 1. The option defaults to False. It is
    needed for some parameters the modules, like for example userauthtype in
    the user module. It is using "" to reset to the default value.
    
    module_params_get_lowercase has been changed to use module_params_get to
    have one place to add the check.
    
    Due to an issue in Ansible it is possible to use the empty string "" for
    lists with choices, even if the empty list is not part of the choices.
    Ansible issue https://github.com/ansible/ansible/issues/77108