Skip to content

Commit

Permalink
Merge #3178
Browse files Browse the repository at this point in the history
3178: [iso] Complement error message on failure to open r=townsend2010 a=ricab

Add more information to the exception that is thrown when `QFile` fails to `open` to create a cloud-init ISO, in the hope that we can gain some insight into why this keeps failing in CI (e.g. https://github.com/canonical/multipass/actions/runs/5690481781/job/15423903919#step:13:101)


Co-authored-by: Ricardo Abreu <[email protected]>
  • Loading branch information
bors[bot] and ricab authored Aug 1, 2023
2 parents b6c1e2a + 35f0e84 commit 608e218
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/iso/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ add_library(iso STATIC
cloud_init_iso.cpp)

target_link_libraries(iso
fmt
Qt6::Core)
4 changes: 3 additions & 1 deletion src/iso/cloud_init_iso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/

#include <multipass/cloud_init_iso.h>
#include <multipass/format.h>

#include <QFile>

Expand Down Expand Up @@ -389,7 +390,8 @@ void mp::CloudInitIso::write_to(const Path& path)
{
QFile f{path};
if (!f.open(QIODevice::WriteOnly))
throw std::runtime_error{"failed to open file for writing during cloud-init generation"};
throw std::runtime_error{fmt::format(
"Failed to open file for writing during cloud-init generation: {}; path: {}", f.errorString(), path)};

const uint32_t num_reserved_bytes = 32768u;
const uint32_t num_reserved_blocks = num_blocks(num_reserved_bytes);
Expand Down

0 comments on commit 608e218

Please sign in to comment.