Skip to content

Commit

Permalink
Merge pull request #3572 from canonical/fix_info_failure_on_old_ubuntu
Browse files Browse the repository at this point in the history
[daemon] fix the multipass info after multipass launch failure
  • Loading branch information
ricab authored Jul 10, 2024
2 parents 9a9bcf8 + 2bebce6 commit 6ee0b4e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/daemon/runtime_instance_info_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ void mp::RuntimeInstanceInfoHelper::populate_runtime_info(mp::VirtualMachine& vm
info->set_disk_total(results[Keys::disk_total_key].as<std::string>());
info->set_cpu_count(results[Keys::cpus_key].as<std::string>());
instance_info->set_cpu_times(results[Keys::cpu_times_key].as<std::string>());
instance_info->set_uptime(results[Keys::uptime_key].as<std::string>());
// Some older versions Ubuntu might return nothing from "uptime -p" command, which makes the
// results[Keys::uptime_key] null, so IsNull check is necessary here
instance_info->set_uptime(results[Keys::uptime_key].IsNull() ? "0 minutes"
: results[Keys::uptime_key].as<std::string>());

auto current_release = results[Keys::current_release_key].as<std::string>();
instance_info->set_current_release(!current_release.empty() ? current_release : original_release);
Expand Down

0 comments on commit 6ee0b4e

Please sign in to comment.