Commit Graph

94 Commits

Author SHA1 Message Date
Aarni Koskela d50cc429c2 Enable Ruff I (import sort), autofix
Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 21:28:56 +02:00
Aarni Koskela 249654d4d9 Drop `packaging` dependency
Compare versions like Moby (api/types/versions/compare.go)

Signed-off-by: Aarni Koskela <akx@iki.fi>
2024-01-03 21:12:37 +02:00
Milas Bowman db4878118b
breaking: Python 3.12 compatibility & remove custom SSL adapter (#3185)
Add support for Python 3.12.

`match_hostname` is gone in Python 3.12 and has been unused by
Python since 3.7.

The custom SSL adapter allows passing a specific SSL version; this
was first introduced a looong time ago to handle some SSL issues
at the time.

Closes #3176.

---------

Signed-off-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Signed-off-by: Milas Bowman <milas.bowman@docker.com>
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
2023-11-21 10:42:53 -05:00
Aarni Koskela 3948540c89 Fix or noqa B003 (assigning to os.environ doesn't do what you expect)
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Aarni Koskela 8a3402c049 Replace string formatting with f-strings
Signed-off-by: Aarni Koskela <akx@iki.fi>
2023-08-15 13:36:53 +03:00
Milas Bowman f16c4e1147
utils: fix IPv6 address w/ port parsing (#3006)
This was using a deprecated function (`urllib.splitnport`),
ostensibly to work around issues with brackets on IPv6 addresses.

Ironically, its usage was broken, and would result in mangled IPv6
addresses if they had a port specified in some instances.

Usage of the deprecated function has been eliminated and extra test
cases added where missing. All existing cases pass as-is. (The only
other change to the test was to improve assertion messages.)

Signed-off-by: Milas Bowman <milas.bowman@docker.com>
2022-07-26 11:35:44 -04:00
Anthony Sottile 5fcc293ba2 use python3.6+ constructs
Signed-off-by: Anthony Sottile <asottile@umich.edu>
2021-07-05 18:30:07 -04:00
Nicolas De Loof 563124163a relax PORT_SPEC regex so it accept and ignore square brackets
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
2021-03-10 11:25:18 +01:00
aiordache c7c5b551fc set engine version for unit tests to avoid querying the engine
Signed-off-by: aiordache <anca.iordache@docker.com>
2020-08-20 15:29:24 +02:00
Anca Iordache 2c522fb362
Fix memory conversion to bytes (#2645)
* Fix memory conversion to bytes

Co-authored-by: Ulysses Souza <ulysses.souza@gmail.com>

Signed-off-by: aiordache <anca.iordache@docker.com>
2020-08-17 18:32:48 +02:00
Ulysses Souza b2175c9475 Fix base_url to keep TCP protocol
This fix lets the responsability of changing the
protocol to `parse_host` afterwards, letting
`base_url` with the original value.

Signed-off-by: Ulysses Souza <ulysses.souza@docker.com>
2019-03-26 16:04:06 +01:00
Hannes Ljungberg 35714c46b1 Test all split_port with all valid protocols
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
2019-03-18 22:15:45 +01:00
Joffrey F f83fe7c959 Properly convert non-string filters to expected string format
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-08 17:22:24 -08:00
Joffrey F f302756599 Rewrite utils.parse_host to detect more invalid addresses.
The method now uses parsing methods from urllib to better split provided URLs.
Addresses containing query strings, parameters, passwords or fragments no longer fail silently.
SSH addresses containing paths are no longer accepted.

Signed-off-by: Joffrey F <joffrey@docker.com>
2018-11-01 15:44:43 -07:00
Joffrey F ced86ec813 On Windows, convert paths to use forward slashes before fnmatch call
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-28 17:11:24 -07:00
Joffrey F 81b7d48ad6 Improved .dockerignore pattern processing to better match Docker CLI behavior
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-06-28 17:11:24 -07:00
Joffrey F a9ecb7234f Don't descend into symlinks when building context tar
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-21 14:35:50 +01:00
Joffrey F 9c2b4e12f8 Use same split rules for Dockerfile as other include/exclude patterns
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-03-20 10:14:09 +01:00
mefyl 4295919103
Add test for "/.." patterns in .dockerignore.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-26 12:59:46 +01:00
mefyl bb3ad64060
Fix .dockerignore: accept wildcard in inclusion pattern, honor last line precedence.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-21 17:05:26 +01:00
mefyl c8f5a5ad40
Fix dockerignore handling of absolute path exceptions.
Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-21 17:05:26 +01:00
mefyl 181c1c8eb9 Revert "Correctly support absolute paths in .dockerignore"
This reverts commit 34d50483e2.

Signed-off-by: mefyl <quentin.hocquet@docker.com>
2018-02-19 13:37:35 +01:00
Joffrey F 34d50483e2 Correctly support absolute paths in .dockerignore
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-12 14:59:41 -08:00
Joffrey F 7c19772eb6
Merge pull request #1901 from docker/1899-create_archive_fix
Rewrite access check in create_archive with EAFP
2018-02-05 13:37:01 -08:00
Joffrey F 58639aecfa Rewrite access check in create_archive with EAFP
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-05 13:11:19 -08:00
Joffrey F 04bf470f6e Add workaround for bpo-32713
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-02-01 16:51:36 -08:00
Joffrey F ccbde11c8d Improve separation between auth_configs and general_configs
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 18:42:38 -08:00
Joffrey F a05922e949
Merge pull request #1881 from docker/pytest-asserts
Use pytest asserts
2018-01-30 16:29:07 -08:00
Joffrey F 3422211309 Use pytest asserts
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-30 14:26:24 -08:00
Joffrey F 4e34300379 Do not break when archiving broken symlinks
Signed-off-by: Joffrey F <joffrey@docker.com>
2018-01-29 18:27:12 -08:00
Veli-Matti Lintu fc6773d673 Commit d798afca made changes for the handling of '**' patterns in
.dockerignore. This causes an IndexError with patterns ending
with '**', e.g. 'subdir/**'. This adds a missing boundary check
before checking for trailing '/'.

Signed-off-by: Veli-Matti Lintu <veli-matti.lintu@nosto.com>
2017-08-22 17:00:11 -07:00
Joffrey F 7f5739dc02 Leading slash in .dockerignore should be ignored
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-08-17 13:38:40 -07:00
Jakub Goszczurny bf9d06db25 Generating regexp from .dockerignore file in a similar way as docker-ce.
Signed-off-by: Jakub Goszczurny <szczurmys@o2.pl>
2017-08-17 13:38:40 -07:00
Joffrey F 50a60717f0 split_port should not break when passed a non-string argument
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-06-28 12:22:34 -07:00
kaiyou 0c1271350d Add a specific unit test for splitting port with IPv6
The test was copied from ccec87ca2c

Signed-off-by: kaiyou <pierre@jaury.eu>
2017-06-05 18:21:33 +02:00
Joffrey F 73d8097b3d Fix test issues
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-29 15:39:48 -07:00
Joffrey F 54b3c364cb Raise an error when passing an empty string to split_port
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-03-09 16:12:48 -08:00
Lei Gong eba20084f6 fix: Missing exception handling in split_port when no container port
"localhost:host_port:" case will raise TypeError exception directly

Catch the "TypeError" and give proper error message

* docker/utils/ports.py

Signed-off-by: Lei Gong <xue177125184@gmail.com>
2017-03-09 16:28:34 +08:00
crierr cfc11515bc Allow port range like 8000-8010:80
Signed-off-by: SeungJin Oh <crierr@naver.com>
2017-02-20 02:09:33 +09:00
Joffrey F 20c6fe31e0 Add support for recursive wildcard pattern in .dockerignore
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-02-14 18:29:37 -08:00
Joffrey F e87ed38f69 Ignore socket files in utils.tar
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-24 18:00:42 -08:00
Joffrey F 9450442c8c Accept / as a path separator in dockerignore patterns on all platforms
Signed-off-by: Joffrey F <joffrey@docker.com>
2017-01-06 16:37:15 -08:00
Joffrey F 993f298e85 Move config type creation from docker.utils functions to classes in
docker.types

Signed-off-by: Joffrey F <joffrey@docker.com>
2016-12-01 16:06:41 -08:00
Ben Firshman 6a16edee3e Merge pull request #1277 from bodnarbm/do-not-traverse-ignored-directories-with-no-potential-exceptions
Do not traverse excluded directories that are not prefixes of dockerignore exceptions.
2016-11-29 10:09:43 +00:00
Joffrey F 9643253c50 Merge pull request #1297 from docker/stepanstipl-allow_custom_pid_mode
Allow custom pid mode
2016-11-28 14:00:07 -08:00
Joffrey F 44e57fb95d Re-enable pid_mode checks for API < 1.24
Signed-off-by: Joffrey F <joffrey@docker.com>
2016-11-28 12:01:25 -08:00
Jon Cotton 4a7c772daf
Fix parsing for an environment file with newlines
Fixes the new, purposely broken test added in the previous commit.

Signed-off-by: Jon Cotton <jc@finaltransfer.net>
2016-11-28 19:41:13 +00:00
Brandon Bodnar 9fc8b3a730 Add unit tests for should_check_directory.
Signed-off-by: Brandon Bodnar <bodnarbm@gmail.com>
2016-11-26 21:36:54 -05:00
Ben Firshman 9daa320454
Rename Client to APIClient
Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00
Ben Firshman d5bc7dc99a
Drop support for Python 2.6
Because it's ancient. If you're still using it, you can use an old
version of docker-py.

Signed-off-by: Ben Firshman <ben@firshman.co.uk>
2016-11-22 17:03:03 +00:00