docker-archive / v1.10-migrator

Prepare docker graph directory for content addressability
Apache License 2.0
24 stars 24 forks source link

pflag: ignore invalid flags #15

Open cyphar opened 8 years ago

cyphar commented 8 years ago

In order to ensure that it is possible to use /etc/sysconfig/docker, we have to ignore any undefined flags. Since the migrator doesn't require any positional arguments, this means we can ignore all undefined and left-over arguments.

We print warnings so the user is somewhat aware of what's going on.

Signed-off-by: Aleksa Sarai asarai@suse.de

I know it's bad form to modify a vendored package, but I feel like this is a special case (upstream wouldn't accept it, but having this code means that people can just append their normal Docker command-line flags to the migrator).

/cc @tonistiigi

tonistiigi commented 8 years ago

@icecrime What do you think of this?

cyphar commented 8 years ago

For some background, in order to make the migration as smooth as possible, we package a script with our migration package so that it will "auto-detect" which storage drivers to migrate and sourcing /etc/sysconfig/docker is made much easier with this patch.

icecrime commented 8 years ago

I don't quite understand the use case, but I'm not opposed neither given that the change is not of huge importance.

cyphar commented 8 years ago

Here's a simplified usecase:

% cat /our/auto/migration/script
source /etc/sysconfig/docker
migrator $DOCKER_OPTS