Missing detailed printing information when exec_sudo fails

Bug #2024980 reported by luweijun
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
diskimage-builder
Fix Released
Undecided
Unassigned

Bug Description

This patch tries to add more detailed info by appending error output to exec_sudo print.

In current implementation, only a simple static note `Exception: exec_sudo failed` is printed:
```
INFO diskimage_builder.block_device.utils [-] Calling [sudo sgdisk /tmp/dib_image.jZaDPxtX/image0.raw -n 1:0:+550M -t 1:EF00 -c 1:ESP -n 2:0:+8M -t 2:EF02 -c 2:BSP -n 3:0:+2077M -t 3:8300 -c 3:root]
ERROR diskimage_builder.block_device.blockdevice [-] Create failed; rollback initiated
// ... ...
diskimage_builder.block_device.exception.BlockDeviceSetupException: exec_sudo failed
```

but the root reason is missing. We can’t get more error info to make sure what the real root reason even a simple problem like `command not found`, we have to reproduce locally and manually.

After this patch, the error message like:
```
INFO diskimage_builder.block_device.utils [-] Calling [sudo sgdisk /tmp/dib_image.jZaDPxtX/image0.raw -n 1:0:+550M -t 1:EF00 -c 1:ESP -n 2:0:+8M -t 2:EF02 -c 2:BSP -n 3:0:+2077M -t 3:8300 -c 3:root]
ERROR diskimage_builder.block_device.blockdevice [-] Create failed; rollback initiated
// ... ...
diskimage_builder.block_device.exception.BlockDeviceSetupException: exec_sudo failed: sudo: sgdisk: command not found
```
It's easy to find the real problem and solve it.

luweijun (wjunlu)
summary: - Append detailed printing information when exec_sudo fails
+ Missing detailed printing information when exec_sudo fails
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to diskimage-builder (master)

Reviewed: https://review.opendev.org/c/openstack/diskimage-builder/+/886908
Committed: https://opendev.org/openstack/diskimage-builder/commit/864ae115091964a4648667bc72e2c5d8f41effae
Submitter: "Zuul (22348)"
Branch: master

commit 864ae115091964a4648667bc72e2c5d8f41effae
Author: wjunlu <email address hidden>
Date: Sun Jun 25 15:20:37 2023 +0800

    Append detailed printing information when exec_sudo fails

    This patch tries to add more detailed info by appending
    error output to exec_sudo print.

    In current implementation, only a simple static note `Exception:
    exec_sudo failed` is printed:
    ```
    INFO diskimage_builder.block_device.utils [-] Calling [sudo sgdisk
     /tmp/dib_image.jZaDPxtX/image0.raw -n 1:0:+550M -t 1:EF00 -c 1:ESP
     -n 2:0:+8M -t 2:EF02 -c 2:BSP -n 3:0:+2077M -t 3:8300 -c 3:root]
    ERROR diskimage_builder.block_device.blockdevice [-] Create failed;
     rollback initiated
    // ... ...
    diskimage_builder.block_device.exception.BlockDeviceSetupException:
     exec_sudo failed
    ```

    but the root reason is missing. We can’t get more error info to
    make sure what the real root reason even a simple problem like
    `command not found`, we have to reproduce locally and manually.

    After this patch, the error message like:
    ```
    INFO diskimage_builder.block_device.utils [-] Calling [sudo sgdisk
     /tmp/dib_image.jZaDPxtX/image0.raw -n 1:0:+550M -t 1:EF00 -c 1:ESP
     -n 2:0:+8M -t 2:EF02 -c 2:BSP -n 3:0:+2077M -t 3:8300 -c 3:root]
    ERROR diskimage_builder.block_device.blockdevice [-] Create failed;
     rollback initiated
    // ... ...
    diskimage_builder.block_device.exception.BlockDeviceSetupException:
     exec_sudo failed: sudo: sgdisk: command not found
    ```
    We can easily find the real problem and solve it.

    Closes-Bug: #2024980

    Change-Id: I9efcd9cb6621e6403df6de14f122b1cf371bd800

Changed in diskimage-builder:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.