saltstack/salt — pull request #17087 by umireon (2014-11-01 07:52:17+00:00)
Title: module/dockerio: Separate nsenter argument and command

This PR enables an execution of any arbitary command in docker container.

With a following state:
```
sudo -u postgres createuser admin:
docker.run:
- cid: containerid
```

I got the following error:
```
2014-11-01 06:26:41,280 [salt.loaded.int.module.cmdmod][ERROR ] Command 'nsenter --target 15621 --mount --uts --ipc --net --pid sudo -u postgres createuser admin' failed with return code: 1
2014-11-01 06:26:41,281 [salt.loaded.int.module.cmdmod][ERROR ] stderr: sudo: postgres: command not found
```

This is because nsenter takes ```-u``` as ```--uts```, rendering ```sudo postgres createuser admin```.
Non-existent command ```postgres``` was executed instead of the desired command ```createuser```.

The temporary workaround should be modifying the state as follows:
```
-- sudo -u postgres createuser admin:
docker.run:
- cid: containerid
```

The solution is prepending ```--``` to the command string.

This fix works based on the feature of getopt_long, see http://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html#Using-Getopt.