ubuntu / zsys

ZSys daemon and client for zfs systems
GNU General Public License v3.0
301 stars 43 forks source link

Dry run for system state removal inconsistent with actions performed #221

Open cmatsuoka opened 2 years ago

cmatsuoka commented 2 years ago

Describe the bug Output of zsysctl state remove -s --dry-run lists actions that are not performed in the command execution.

To Reproduce Steps to reproduce the behavior:

  1. Choose a saved state containing system and user states:
    $ zsysctl show | grep autozsys_hlarab
    - Name:       rpool/ROOT/ubuntu_u4zsnf@autozsys_hlarab
     - rpool/USERDATA/claudio_secsbv@autozsys_hlarab (2022-02-05 21:21:44)
     - rpool/USERDATA/root_secsbv@autozsys_hlarab (2022-02-05 21:21:43)
  2. Do a dry run of zsysctl remove state -s on the selected state and note the actions to be performed.
    $ sudo zsysctl state remove -s -v --dry-run autozsys_hlarab
    INFO Requesting to remove system state "autozsys_hlarab" 
    Deleting state rpool/USERDATA/claudio_secsbv@autozsys_hlarab
    Deleting state rpool/USERDATA/root_secsbv@autozsys_hlarab
    Deleting state rpool/ROOT/ubuntu_u4zsnf@autozsys_hlarab
  3. Execute the command without --dry-run:
    $ sudo zsysctl state remove -s -v autozsys_hlarab
    INFO Requesting to remove system state "autozsys_hlarab" 
    ZSys is adding automatic system snapshot to GRUB menu
  4. Show the available saved states:
    $ zsysctl show | grep autozsys_hlarab
     - rpool/USERDATA/claudio_secsbv@autozsys_hlarab (2022-02-05 21:21:44)
     - rpool/USERDATA/root_secsbv@autozsys_hlarab (2022-02-05 21:21:43)

Expected behavior Dry run output should match the actual actions performed (by either deleting user state when using -s, or by not listing user state removal actions in the dry run output and adjusting the state remove command help message).

Installed versions:

Additional context User states are correctly removed if not using -s.