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
This commit is contained in:
parent
ed9bdf805d
commit
864ae11509
1 changed files with 1 additions and 1 deletions
|
@ -136,7 +136,7 @@ def exec_sudo(cmd):
|
|||
proc.wait()
|
||||
|
||||
if proc.returncode:
|
||||
e = BlockDeviceSetupException("exec_sudo failed")
|
||||
e = BlockDeviceSetupException("exec_sudo failed: %s" % out)
|
||||
e.returncode = proc.returncode
|
||||
e.cmd = ' '.join(sudo_cmd)
|
||||
e.output = out
|
||||
|
|
Loading…
Reference in a new issue