YARN-8706. Allow additional flag in docker inspect call.

Contributed by Chandni Singh
This commit is contained in:
Eric Yang 2018-09-14 11:46:59 -04:00
parent a12f12f1af
commit 99237607bf
1 changed files with 3 additions and 2 deletions

View File

@ -558,7 +558,8 @@ cleanup:
int get_docker_inspect_command(const char *command_file, const struct configuration *conf, args *args) { int get_docker_inspect_command(const char *command_file, const struct configuration *conf, args *args) {
const char *valid_format_strings[] = { "{{.State.Status}}", const char *valid_format_strings[] = { "{{.State.Status}}",
"{{range(.NetworkSettings.Networks)}}{{.IPAddress}},{{end}}{{.Config.Hostname}}" }; "{{range(.NetworkSettings.Networks)}}{{.IPAddress}},{{end}}{{.Config.Hostname}}",
"{{.State.Status}},{{.Config.StopSignal}}"};
int ret = 0, i = 0, valid_format = 0; int ret = 0, i = 0, valid_format = 0;
char *format = NULL, *container_name = NULL, *tmp_buffer = NULL; char *format = NULL, *container_name = NULL, *tmp_buffer = NULL;
struct configuration command_config = {0, NULL}; struct configuration command_config = {0, NULL};
@ -578,7 +579,7 @@ int get_docker_inspect_command(const char *command_file, const struct configurat
ret = INVALID_DOCKER_INSPECT_FORMAT; ret = INVALID_DOCKER_INSPECT_FORMAT;
goto free_and_exit; goto free_and_exit;
} }
for (i = 0; i < 2; ++i) { for (i = 0; i < 3; ++i) {
if (strcmp(format, valid_format_strings[i]) == 0) { if (strcmp(format, valid_format_strings[i]) == 0) {
valid_format = 1; valid_format = 1;
break; break;