Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list-like methods for seashore.executor._PreparedCommand? #35

Open
kurtbrose opened this issue Jun 20, 2017 · 3 comments
Open

list-like methods for seashore.executor._PreparedCommand? #35

kurtbrose opened this issue Jun 20, 2017 · 3 comments

Comments

@kurtbrose
Copy link
Contributor

Specifically I'm trying to do docker-compose-in-docker:

    docker run -v "$(pwd)":"$(pwd)" \
             -v /var/run/docker.sock:/var/run/docker.sock \
             -e COMPOSE_PROJECT_NAME=$(basename "$(pwd)") \
             --workdir="$(pwd)" \
             -ti --rm \
             dduportal/docker-compose:latest --help

I guess I'll use command() for now and do a raw list of strings. It might be nice if there was some way to still leverage the executor.

executor.command(executor.docker.run(compose_image, volume=[], env={}, workdir='...')._cmd + ['--help']) is a convenient escape hatch that involves less manual intervention than doing the whole thing from scratch; not sure if this is overall a good API or not

@kurtbrose
Copy link
Contributor Author

A cleaner version of that API that might work well:

executor.docker.run(...).extend(['--help'])

Add extend() to _PreparedCommand which just takes a list of strings and adds it to the end. Maybe in general _PreparedCommand could have some list-like methods? (Item assignment, insert, pop?)

@kurtbrose kurtbrose changed the title docker run, arguments for "inner" process -- maybe make _PreparedCommand._cmd a public API? list-like methods for seashore.executor._PreparedCommand? Jun 20, 2017
@kurtbrose
Copy link
Contributor Author

Or maybe tuple is the better analogy than list, since the command should be immutable.

@kurtbrose
Copy link
Contributor Author

Another possibility: instead of build list or tuple-like the API is the same as the root executor:

executor.command(['docker', 'run', 'foo']) --> ['docker', 'run', 'foo']

executor.docker.run.command(['foo']) -> ['docker', 'run', 'foo']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant