281 Commits

Author SHA1 Message Date
Daniel Nephin
96e9b47059 Inclide the filename in validation errors.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 15:02:12 -05:00
Daniel Nephin
34166ef5a4 Refactor process_errors into smaller functions
So that it passed new max-complexity requirement

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 15:02:12 -05:00
Daniel Nephin
285e52cc7c Add ids to config schemas
Also enforce a max complexity for functions and add some new tests for config.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 15:02:12 -05:00
Joffrey F
d52c969f94 Add test for environment variable dashes support
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
0ab76bb8bc Add a test for invalid field 'name', and fix an existing test for invalid service names.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
7fc577c31d Remove name from config schema.
Refactors config validation of a service to use a ServiceConfig data object.
Instead of passing around a bunch of related scalars, we can use the
ServiceConfig object as a parameter to most of the service validation functions.

This allows for a fix to the config schema, where the name is a field in the
schema, but not actually in the configuration. My passing the name around as
part of the ServiceConfig object, we don't need to add it to the config options.
Fixes #2299

validate_against_service_schema() is moved from a conditional branch in
ServiceExtendsResolver() to happen as one of the last steps after all
configuration is merged. This schema only contains constraints which only need
to be true at the very end of merging.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
3a43110f06 Fix a bug in ExtendsResolver where the service name of the extended service was wrong.
This bug can be seen by the change to the test case. When the extended service
uses a different name, the error was reported incorrectly.

By fixing this bug we can simplify self.signature and self.detect_cycles to
always use self.service_name.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
87d79d4d99 Rename ServiceLoader to ServiceExtendsResolver
ServiceLoader has evolved to be not really all that related to "loading" a
service. It's responsibility is more to do with handling the `extends`
field, which is only part of loading.  The class and its primary method
(make_service_dict()) were renamed to better reflect their responsibility.

As part of that change process_container_options() was removed from
make_service_dict() and renamed to process_service().  It contains logic for
handling the non-extends options.

This change allows us to remove the hacks from testcase.py and only call
the functions we need to format a service dict correctly for integration tests.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
83581c3a0f Validate additional files before merging them.
Consolidates all the top level config handling into `process_config_file` which
is now used for both files and merge sources.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Yves Peter
3313dcb1ce Fixes #1490 progress_stream would print a lot of new lines on "docker-compose pull" if there's no tty.
Signed-off-by: Yves Peter <ypdraw@gmail.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
92d56fab47 Add a warning when the host volume config is being ignored.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
1208f92d9c Update doc wording for ulimits.
and move tests to the correct module

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Kevin Greene
8444551373 Added ulimits functionality to docker compose
Signed-off-by: Kevin Greene <kevin@spantree.net>
2015-11-12 13:54:41 -05:00
Daniel Nephin
73ebd7e560 Only create the default network if at least one service needs it.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
36176befb0 Fix #1549 - flush after each line of logs.
Includes some refactoring of log_printer_test to support checking for flush(), and so that each test calls the unit-under-test directly, instead of through a helper function.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Adrian Budau
4c2eb17ccd Added --force-rm to compose build.
It's a flag passed to docker build that removes the intermediate
containers left behind on fail builds.

Signed-off-by: Adrian Budau <budau.adi@gmail.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
8fb44db92b Cleanup some unit tests and whitespace.
Remove some unnecessary newlines.
Remove a unittest that was attempting to test behaviour that was removed a while ago, so isn't testing anything.
Updated some unit tests to use mocks instead of a custom fake.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:41 -05:00
Daniel Nephin
ba61a6c5fb Don't set the hostname to the service name with networking.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:40 -05:00
Daniel Nephin
3f14df374f Handle non-utf8 unicode without raising an error.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:40 -05:00
Daniel Nephin
e6755d1e7c Use VolumeSpec instead of re-parsing the volume string.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:40 -05:00
Daniel Nephin
c4f59e731d Make working_dir consistent in the config package.
- make it a positional arg, since it's required
- make it the first argument for all functions that require it
- remove an unnecessary one-line function that was only called in one place

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:39 -05:00
Mazz Mosley
0375dccf64 Handle non-ascii chars in volume directories
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-11-12 13:54:39 -05:00
Joffrey F
3daecfa8e4 Update service config_dict computation to include volumes_from mode
Ensure config_hash is updated when volumes_from mode is changed, and
service is recreated on next up as a result.

Signed-off-by: Joffrey F <joffrey@docker.com>
2015-11-12 13:54:39 -05:00
Daniel Nephin
23d4eda2a5 Fix service recreate when image changes to build.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-11-12 13:54:39 -05:00
Daniel Nephin
db164cefd3 Remove the duplicate 'Warning' prefix now that the logger adds the prefix.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-30 15:36:15 -04:00
Daniel Nephin
4d613d3ba7 Use colors when logging warnings or errors, so they are more obvious.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-30 15:36:15 -04:00
Mazz Mosley
da41ed22f9 Fix tests
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-27 19:33:28 -04:00
Daniel Nephin
a9b4fe768d Fix running one-off containers with --x-networking by disabling linking to self.
docker create fails if networking and links are used together.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-27 19:33:28 -04:00
Daniel Nephin
e168fd03ca Fix unicode in environment variables for python2.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-26 13:05:41 -04:00
Daniel Nephin
725088a18b Force windows drives to be lowercase.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-21 11:29:49 -04:00
Daniel Nephin
bf672ec340 Fixes #2205 - extends must be copied from override file.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-20 11:27:11 -04:00
Mazz Mosley
0e4f9c9a66 Environment keys can contain empty values
Environment keys that contain no value, get populated with values taken
from the environment not from the build phase but from running the command `up`.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-19 15:16:19 -04:00
Daniel Nephin
24d4a1045a Fixes #2203 - properly validate files when multiple files are used.
Remove the single-use decorators so the functionality can be used directly as a function.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-19 15:16:19 -04:00
Daniel Nephin
514f0650b2 Give the user a better error message (without a stack trace) when there is a yaml error.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-10-19 12:02:40 -04:00
Daniel Nephin
0409b287ad Merge pull request #2191 from dnephin/networking
Networking
2015-10-14 12:31:26 -04:00
mnowster
6b68a84b9b Merge pull request #2019 from mrfuxi/less-verbose-extends
Allow to extend service using shorthand notation. Closes #1989
2015-10-14 17:13:09 +01:00
Aanand Prasad
d5f5eb1924 Enable use of Docker networking with the --x-networking flag
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-10-14 11:19:43 -04:00
Daniel Nephin
b9c76dfabd Merge pull request #2181 from mnowster/2128-split-drive-not-handling-relative-paths
2128 split drive not handling relative paths
2015-10-14 11:04:42 -04:00
Mazz Mosley
ca36628a0e Test cgroup_parent option is being sent.
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-14 15:02:42 +01:00
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
Karol Duleba
c7ffbf97c8 Extend oneOf error handling. Issue #1989
Signed-off-by: Karol Duleba <mr.fuxi@gmail.com>
2015-10-14 14:31:35 +01:00
Mazz Mosley
c1d5ecaafe Workaround splitdrive limitations
splitdrive doesn't handle relative paths, so if volume_path contains
a relative path, we handle that differently and manually set drive to ''.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-10-13 17:27:25 +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