Skip to content
  • Iustin Pop's avatar
    Improve the cli.AskUser() function · 47988778
    Iustin Pop authored
    This patch improves the AskUser function by allowing it to:
     - choose from multiple choices (instead of only y/n)
     - give help to the user
     - preserve line breaks and whitespace formatting in the message
    
    With this patch, an instance removal looks like this:
    root@xen-test1-4:~# gnt-instance remove tsetest1
    This will remove the volumes of the instance tsetest1 (including
    mirrors), thus removing all the data of the instance. Continue?
    y/[n]/?: ?
     y - Perform the operation
     n - Do not perform the operation
    
    This will remove the volumes of the instance tsetest1 (including
    mirrors), thus removing all the data of the instance. Continue?
    y/[n]/?: y
    
    The patch also removed the _ask_user member of the opts argument, since
    external code was using it (and thus it makes no sense for it to be a
    private member); now gnt-* scripts are using the AskUser function
    directly.
    
    Reviewed-by: ultrotter
    47988778