Commit Graph

239 Commits

Author SHA1 Message Date
Mohit Soni f4efa29377 Added support for cgroup_parent
This change adds cgroup-parent support to compose project. It allows
each service to specify a 'cgroup_parent' option.

Signed-off-by: Mohit Soni <mosoni@paypal.com>
2015-10-14 15:02:42 +01:00
Mazz Mosley 8efc39e616 Improve boolean warning message.
Including examples of more boolean types, eg yes/N as it's not
always immediately clear that they are treated as booleans.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 14:59:08 +01:00
Aanand Prasad 627f1acdc4 Merge pull request #2126 from mnowster/1188-support-ro-options-in-volumes-from
1188 support ro options in volumes from
2015-10-07 11:57:14 +01:00
Mazz Mosley f9028703f4 Pick the first container
Rather than inefficiently looping through all the containers that a
service has and overriding each volumes_from value, pick the first
one and return that.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Mazz Mosley 467c731869 address PR feedback
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-07 11:27:13 +01:00
Aanand Prasad fda615008c Merge pull request #2142 from dnephin/fix_error_cant_connect
Fix error when compose can't connect to docker
2015-10-07 11:22:32 +01:00
Daniel Nephin 15d0c60a73 Fix split buffer with inconsistently delimited json objects.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:43:07 -04:00
Daniel Nephin 3661e8bc74 Fix build against the swarm cluster by joining buffered output before parsing json.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-06 10:37:05 -04:00
Vincent Demeester 5b55a08846 Add support for ro option in volumes_from
Fixes #1188

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2015-10-06 13:12:55 +01:00
Daniel Nephin fbaea58fc1 Fix #2133 - fix call to get_client()
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-05 15:57:49 -04:00
Mazz Mosley bef5c2238e Skip a test for now
This needs resolving outside of this PR, as it is a much bigger piece
of work.

https://github.com/docker/compose/issues/2128

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 15:29:26 +01:00
Mazz Mosley af8032a5f4 Fix incorrect test name
I'd written relative, when I meant absolute. D'oh.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Mazz Mosley 2276326d7e volume path compatibility with engine
An expanded windows path of c:\shiny\thing:\shiny:rw
needs to be changed to be linux style path, including the drive,
like /c/shiny/thing /shiny
to be mounted successfully by the engine.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-02 12:01:56 +01:00
Mazz Mosley f4cd5b1d45 Handle windows volume paths
When a relative path is expanded and we're on a windows platform,
it expands to include the drive, eg C:\ , which was causing a ConfigError
as we split on ":" in parse_volume_spec and that was giving too many parts.

Use os.path.splitdrive instead of manually calculating the drive.

This should help us deal with windows drives as part of the volume
path better than us doing it manually.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-01 16:06:57 +01:00
Aanand Prasad e38334efbd Don't expand volume names
Only expand volume host paths if they begin with a dot.

This is a breaking change. The deprecation warning preparing users for
this change has been removed.

Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-01 14:48:38 +01:00
Daniel Nephin 78c0734cbd Disable some tests in windows for now.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-23 10:42:57 -04:00
Daniel Nephin be0611bf3e Cleanup get_default_config_files tests.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin 39ae85db8a Support a default docker-compose.override.yml for overrides
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin 89be7f1fa7 Unit tests for multiple files
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin 831276f531 Move config_test to the correct package name.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin 10b3188214 Support multiple config files
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Daniel Nephin 258d0fa0c6 Remove some functions from Command class
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-17 14:13:50 -04:00
Mazz Mosley 39ba2c5a7c Fix leaky tests
It was mocking self.client but relying on the call to
utils.create_host_config which was not mocked. So now that function
has moved to also be on self.client we need to redefine the test
boundary, up to where we would call docker-py, not the result of
docker-py.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Mazz Mosley 6f6c04b5c9 Test what we are sending, not what we get
This is a unit test and we are mocking the client. The method to get
the create_config_host now lives on the client, so we mock that too.

So we can test to the boundary that the method is called with the
arguments we expect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-17 17:11:00 +01:00
Mazz Mosley 4b2fd7699b Relax constraints on key naming for environment
One of the use cases is swarm requires at least : character, so going
from conservative to relaxed.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
Mazz Mosley 8caeffe27e Log a warning when boolean is found in `environment`
We're going to warn people that allowing a boolean in the environment is
being deprecated, so in a future release we can disallow it. This is to
ensure boolean variables are quoted in strings to ensure they don't get
mis-parsed by YML.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
Mazz Mosley a594a2ccc2 Disallow booleans in environment
When users were putting true/false/yes/no in the environment key,
the YML parser was converting them into True/False, rather than leaving
them as a string.

This change will force people to put them in quotes, thus ensuring
that the value gets passed through as intended.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 15:33:30 +01:00
Mazz Mosley cf7b595385 Improve error messages from oneOf schema errors
oneOf schema ValidationError takes a little more work to parse and
pull out more detail so we can give a better error message back to
the user.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-15 14:29:00 +01:00
Mazz Mosley 418ec5336b Improved messaging for simple type validator
English language is a tricky old thing and I've pulled out the validator type
parsing so that we can prefix our validator types with the correct article,
'an' or 'a'.

Doing a bit of extra hard work to ensure the error message is clear and
well constructed english.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-14 17:23:58 +01:00
Daniel Nephin 413b76e228 Fix warning message when a container uses a non-json log driver
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-11 12:54:27 -04:00
Aanand Prasad 87a50317ad Merge pull request #1954 from nhumrich/master
Allow for user relative paths on EXTEND
2015-09-10 16:35:40 -07:00
Nick H a372275c6e Allow for user relative paths
'~/' in a path currently doesnt work, you get the following error:

[Errno 2] No such file or directory: u'/home/USER/folder/~/some/path/.yml'

Signed-off-by: Nick H <nick.humrich@gmail.com>
2015-09-09 14:54:08 -06:00
Mazz Mosley 4bed5de291 Remove item unique constraint for command
The command value can be a list, which would be a Unix command-line
invocation broken up into individual values, thus needing the ability to
have non unique values.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-09 16:39:06 +01:00
Aanand Prasad 85709d85d2 Merge pull request #1862 from mrfuxi/costom-container-name-in-logs
Use custom container name in logs
2015-09-08 14:36:28 -07:00
Mazz Mosley 866979c57b Allow entrypoint to be a list or string
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-07 17:26:38 +01:00
Karol Duleba d83d6306c9 Use custom container name in logs. Fixes #1851
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-09-07 14:03:00 +01:00
Aanand Prasad 10cb0c921a Merge pull request #1963 from shin-/1923-catch-timeout
Exit gracefully when requests encounter a ReadTimeout exception.
2015-09-04 16:14:32 -07:00
Daniel Nephin 0484e22a84 Add enum34 and use it to create a ConvergenceStrategy enum.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-04 10:45:53 -04:00
Aanand Prasad 6a47fa066e Merge pull request #1960 from dnephin/fix_smart_recreate_when_service_is_removed
Fix config_hash context to properly represent the service
2015-09-03 11:41:30 -07:00
Daniel Nephin 187ad4ce26 Refactor network_mode logic out of Service.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 13:02:46 -04:00
Daniel Nephin c183e52502 Fixes #1757 - include all service properties in the config_dict()
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Mazz Mosley 7326608369 expose array can contain either strings or numbers
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-03 16:44:01 +01:00
Joffrey F 6a95f6d628 custom timeout test rewrite
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 18:00:08 -07:00
Aanand Prasad 6baed6c354 Merge pull request #1965 from dnephin/fix_compose_up_attach
Attach to all containers when no service names are specified
2015-09-02 17:37:43 -07:00
Daniel Nephin 48466d7d82 Fix #1961 - docker-compose up should attach to all containers with no service names are specified, and add tests.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-02 16:08:18 -04:00
Mazz Mosley 6a399a5b2f Update tests to be compatible with validation
Some were missing build '.' from their dicts, others were the
incorrect type and one I've moved from integration to unit.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley 950577d60f Split validation into fields and service
We want to give feedback to the user as soon as possible about the
validity of the config supplied for the services.

When extending a service, we can validate that the fields are
correct against our schema but we must wait until the *end* of
the extends cycle once all of the extended dicts have been merged
into the service dict, to perform the final validation check on the
config to ensure it is a complete valid service.

Doing this before that had happened resulted in false reports of
invalid config, as common config when split out, by itself, is not
a valid service but *is* valid config to be included.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 4a8b2947ca Interpolate extended config
This refactoring is now really coming together. Construction is
happening in the __init__, which is a constructor and helps
clean up the design and clarity of intent of the code. We can now
see (nearly) everything that is being constructed when a ServiceLoader
is created. It needs all of these data constructs to perform the
domain logic and actions. Which are now clearer to see and moving
more towards the principle of functions doing (mostly)one thing and
function names being more descriptive.

resolve_extends is now concerned with the resolving of extends, rather
than the construction, validation, pre processing and *then* resolving
of extends.

Happy days :)

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 36757cde1c Validate extended service against our schema
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 8a6061bfb9 __init__ takes service name and dict
Moving service name and dict out of the function make_service_dict
and into __init__. We always call make_service_dict with those so
let's put them in the initialiser. Slightly cleaner design intent.

The whole purpose of the ServiceLoader is to take a
service name&service dictionary then validate, process and return
service dictionaries ready to be created.

This is also another step towards cleaning the code up so we can
interpolate and validate an extended dictionary.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00