mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
Merge pull request #21138 from bluca/show_extensions
systemctl: pretty-print ExtensionImages property
This commit is contained in:
commit
99987084f6
@ -1617,11 +1617,13 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
|
||||
r = sd_bus_message_enter_container(m, 'r', "ssba(ss)");
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error(r);
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
r = sd_bus_message_read(m, "ssb", &source, &destination, &ignore_enoent);
|
||||
if (r <= 0)
|
||||
break;
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
str = strjoin(ignore_enoent ? "-" : "",
|
||||
source,
|
||||
@ -1632,28 +1634,82 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
|
||||
|
||||
r = sd_bus_message_enter_container(m, 'a', "(ss)");
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(ss)", &partition, &mount_options)) > 0)
|
||||
if (!strextend_with_separator(&str, ":", partition, ":", mount_options))
|
||||
if (!strextend_with_separator(&str, ":", partition, mount_options))
|
||||
return log_oom();
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (!strextend_with_separator(&paths, " ", str))
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return r;
|
||||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
bus_print_property_value(name, expected_value, flags, paths);
|
||||
|
||||
return 1;
|
||||
|
||||
} else if (streq(name, "ExtensionImages")) {
|
||||
_cleanup_free_ char *paths = NULL;
|
||||
|
||||
r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(sba(ss))");
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
for (;;) {
|
||||
_cleanup_free_ char *str = NULL;
|
||||
const char *source, *partition, *mount_options;
|
||||
int ignore_enoent;
|
||||
|
||||
r = sd_bus_message_enter_container(m, 'r', "sba(ss)");
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
if (r == 0)
|
||||
break;
|
||||
|
||||
r = sd_bus_message_read(m, "sb", &source, &ignore_enoent);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
str = strjoin(ignore_enoent ? "-" : "", source);
|
||||
if (!str)
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_message_enter_container(m, 'a', "(ss)");
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
while ((r = sd_bus_message_read(m, "(ss)", &partition, &mount_options)) > 0)
|
||||
if (!strextend_with_separator(&str, ":", partition, mount_options))
|
||||
return log_oom();
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
if (!strextend_with_separator(&paths, " ", str))
|
||||
return log_oom();
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
}
|
||||
|
||||
r = sd_bus_message_exit_container(m);
|
||||
if (r < 0)
|
||||
return bus_log_parse_error(r);
|
||||
|
Loading…
Reference in New Issue
Block a user