Commit Graph

1844 Commits

Author SHA1 Message Date
Aanand Prasad 536638aaae Merge pull request #1962 from dnephin/use_enum_for_enum
Create a ConvergenceStrategy enum
2015-09-04 15:05:09 -07:00
Daniel Nephin d84ee667ad Merge pull request #1983 from mnowster/update-testing-docs
Running a single test command updated
2015-09-04 12:28:08 -04:00
Mazz Mosley 31e8137452 Running a single test command updated
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-04 17:23:22 +01:00
Daniel Nephin ff427e68ee Merge pull request #1982 from mnowster/fix-trailing-white-space
Remove trailing white space from docs/index.md
2015-09-04 12:20:29 -04:00
Mazz Mosley 0f60c783fa Remove trailing white space
Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-04 17:01:44 +01: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
mnowster d4372bc98f Merge pull request #1967 from charleswhchan/issue-1958
Fix #1958. Remove release notes for old version of Docker Compose.
2015-09-04 11:44:33 +01:00
Charles Chan 000bf1c16a Fix #1958. Remove release notes for old version of Docker Compose.
Replace by link to the latest CHANGELOG in GitHub.

Signed-off-by: Charles Chan <charleswhchan@users.noreply.github.com>
2015-09-03 21:18:26 -07:00
Aanand Prasad a1ec26435c Test against Docker 1.8.2 RC1
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-03 18:30:50 -07: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
Aanand Prasad c2f9ffad28 Merge pull request #1974 from dnephin/upgrade_requests
Bump requests to 2.7 to fix the ResponseNotReady() error
2015-09-03 11:38:17 -07:00
Aanand Prasad dcf2f3f28c Merge pull request #1970 from mnowster/fix-expose-allowed-values
fix expose schema definition
2015-09-03 11:36:03 -07:00
Daniel Nephin 9d7ad796a3 bump requests to 2.7 to fix the ResponseNotReady() error, and add a missing default for tox posargs
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 14:11:44 -04:00
Daniel Nephin db9f577ad6 Extract link names into a function.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2015-09-03 14:08:44 -04: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
Daniel Nephin 08ba857807 Cleanup some project logic.
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin e801981fed Sort config keys
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2015-09-03 12:04:38 -04:00
Daniel Nephin ef56523883 Make external_links a regular service.option so that it's part of the config hash
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
mnowster 2073805bc1 Merge pull request #1952 from aanand/bundle-schema-json
Bundle schema.json in binary
2015-09-03 10:40:11 +01:00
Aanand Prasad ecea79fd4e Bundle schema files
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 18:09:34 -07: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 b165ae07c9 Configure PyInstaller using docker-compose.spec
Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
2015-09-02 17:47:14 -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
Joffrey F f9c7346380 HTTP_TIMEOUT as importable constant for consistency
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 16:29:19 -07:00
Joffrey F b110bbe9e3 Refined error message when timeout is encountered.
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 14:31:30 -07:00
Joffrey F e634fe3fd6 Deprecation warning when DOCKER_CLIENT_TIMEOUT is used
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 14:28:57 -07:00
Aanand Prasad 027414cfc0 Merge pull request #1918 from dnephin/fix_scripts_test
Fix scripts/test and add to note about pre-commit hook to contributing
2015-09-02 14:28:51 -07:00
Aanand Prasad 0060437f57 Merge pull request #1927 from mnowster/validate-extended-services
Validate and interpolate extended services
2015-09-02 13:41:21 -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
Joffrey F 80c9092999 Document COMPOSE_HTTP_TIMEOUT env config
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 12:52:48 -07:00
Joffrey F b54b932b54 Exit gracefully when requests encounter a ReadTimeout exception.
Signed-off-by: Joffrey F <joffrey@docker.com>
2015-09-02 11:54:20 -07: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 d31d24d19f Work around some coupling of links, net & volume_from
This is minimal disruptive change I could make to ensure
the service integration tests worked, now we have some validation
happening.

There is some coupling/entanglement/assumption going on here.

Project when creating a service, using it's class method from_dicts
performs some transformations on links, net & volume_from, which
get passed on to Service when creating. Service itself, then performs
some transformation on those values. This worked fine in the tests before
because those options were merely passed on via make_service_dict.

This is no longer true with our validation in place. You can't pass to
ServiceLoader [(obj, 'string')] for links, the validation expects it to be
a list of strings. Which it would be when passed into Project.from_dicts
method.

I think the tests need some re-factoring but for now, manually deleting
keys out of the kwargs and then putting them back in for Service Creation
allows the tests to continue.

I am not super happy about this approach. Hopefully we can come back and
improve it.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:43:52 +01:00
Mazz Mosley 9b8e404d13 Pass service_name to process_errors
Previously on Buffy... The process_errors was parsing a load of
ValidationErrors that we get back from jsonschema which included
assumptions about the state of the instance we're validating.

Now it's split in two and we're doing field separate to service,
those assumptions don't hold and we can't logically retrieve the
service_name from the error parsing when we're doing service schema
validation, have to explicitly pass this in.

process_errors is high on my list for some future re-factoring to help
make it a bit clearer, smaller state of doing things.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley f51a5431ec Correct some schema field definitions
Now validation is split in two, the integration tests helped
highlight some places where the schema definition was incorrect.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 9979880c9f Add in volume_driver
I'd missed out this field by accident previously.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 4b487e3957 Refactor extends back out of __init__
If make_service_dict is our factory function then we'll give it the
responsibility of validation/construction and resolving.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 9fa6e42f55 process_errors handle both schemas
Now the schema has been split into two, we need to modify the
process_errors function to accomodate.

Previously if an error.path was empty then it meant they were root
errors. Now that service_schema checks after the service has been
resolved, our service name is a key within the dictionary and
so our root error logic check is no longer true.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +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 37bf8235b7 Get extended config path
Refactored out into it's own function.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 538a501eec Refactor validating extends file path
Separating out the steps we need to resolve extends, so that it
will be clear to insert pre-processing of interpolation and
validation.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley 02c52ae673 Move resolve_environment within __init__
resolve_environment is specific to ServiceLoader, the function
does not need to be on the global scope, it is a part of the
ServiceLoader object. The environment needs to be resolved
before we can make any service dicts, it belongs in the
constructor.

This is cleaning up the design a little and being clearer
about intent and scope of functions.

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
Mazz Mosley 1344533b24 filename is not optional
While it can be set to ultimately a value of None, when a
config file is read in from stdin, it is not optional.

We kinda make use of it's ability to be set to None in our
tests but functionally and design wise, it is required.

If filename is not set, extends does not work.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Mazz Mosley c907f35e74 Raise if working_dir is None
Check for this in the init so we can remove the duplication of
raising in further functions.

A ServiceLoader isn't valid without one.

Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
2015-09-02 15:42:38 +01:00
Aanand Prasad 3bee62e4c5 Merge pull request #1956 from bfirsh/link-to-zenhub
Link to ZenHub instead of Waffle
2015-09-01 17:31:45 -07:00