-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44832/
-----------------------------------------------------------

Review request for mesos, Adam B, Ben Mahler, and Kevin Klues.


Bugs: MESOS-2023
    https://issues.apache.org/jira/browse/MESOS-2023


Repository: mesos


Description
-------

Validate string when convert `Flags` to `hashmap<string, string>`.


Diffs
-----

  src/common/parse.hpp 9535fad0d50b469fbb4dc6ac5cf5c89b40d29b47 

Diff: https://reviews.apache.org/r/44832/diff/


Testing
-------

1. Without pass `--env=`.
```
$ ./src/mesos-execute  --master=127.0.0.1:5050 --name=test --command='echo $a'
```

Output:
```
Starting task test
Forked command at 4542
sh -c 'echo $a'
I0315 11:45:39.153188  4402 slave.cpp:3002] Handling status update TASK_RUNNING 
(UUID: 06b8f974-b6ec-4d10-b1d8-f84b5d4f728d) for task test of framework 
cf1af3e0-dd66-41e8-8c56-7ad80d7dce98-0001 from execu
tor(1)@127.0.0.1:54698
I0315 11:45:39.153964  4401 status_update_manager.cpp:320] Received status 
update TASK_RUNNING (UUID: 06b8f974-b6ec-4d10-b1d8-f84b5d4f728d) for task test 
of framework cf1af3e0-dd66-41e8-8c56-7ad80d7dce98-
0001
```

2. Pass `--env=`.
```
$ ./src/mesos-execute  --master=127.0.0.1:5050 --name=test --command='echo $a' 
--env="{\"a\": \"stdin\"}"
```

Output:
```
Registered executor on localhost
Starting task test
Forked command at 4675
sh -c 'echo $a'
stdin
I0315 11:46:34.797502  4408 slave.cpp:3002] Handling status update TASK_RUNNING 
(UUID: 16040c40-f5e4-4bf0-8690-447f2901310b) for task test of framework 
cf1af3e0-dd66-41e8-8c56-7ad80d7dce98-0003 from execu
tor(1)@127.0.0.1:57831
```

3. Pass incorrect json format in `--env=`.
```
./src/mesos-execute  --master=127.0.0.1:5050 --name=test --command='echo $a' 
--env="{\"a\": {}}"
Failed to load flag 'env': Failed to load value '{"a": {}}': The value of key 
'a' in '{"a":{}}' is not a valid string.
```


Thanks,

haosdent huang

Reply via email to