You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by haosdent huang <ha...@gmail.com> on 2016/04/02 10:07:19 UTC

Re: Review Request 44832: Validate string when convert `Flags` to `hashmap`.

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

(Updated April 2, 2016, 8:07 a.m.)


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


Changes
-------

Rebase.


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


Repository: mesos


Description
-------

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


Diffs (updated)
-----

  src/common/parse.hpp 9036dae1b55e0c222ddedd15599ea56933c84cd7 

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


Re: Review Request 44832: Validate string when convert `Flags` to `hashmap`.

Posted by Ben Mahler <be...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/44832/#review127727
-----------------------------------------------------------


Ship it!




Ship It!

- Ben Mahler


On April 2, 2016, 8:07 a.m., haosdent huang wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/44832/
> -----------------------------------------------------------
> 
> (Updated April 2, 2016, 8:07 a.m.)
> 
> 
> 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 9036dae1b55e0c222ddedd15599ea56933c84cd7 
> 
> 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
> 
>