summaryrefslogtreecommitdiff
path: root/docker/utils/utils.py
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3009 from milas/lint-flake8Milas Bowman2022-07-261-0/+1
|\ | | | | ci: add flake8 job
| * lint: fix outstanding flake8 violationsMilas Bowman2022-07-261-0/+1
| | | | | | | | | | | | | | Since flake8 wasn't actually being run in CI, we'd accumulated some violations. Signed-off-by: Milas Bowman <milas.bowman@docker.com>
* | deps: use `packaging` instead of deprecated `distutils` (#2931)Francesco Casalegno2022-07-261-3/+3
|/ | | | | Replace `distutils.Version` (deprecated) with `packaging.Version` Signed-off-by: Francesco Casalegno <francesco.casalegno@gmail.com>
* utils: fix IPv6 address w/ port parsing (#3006)Milas Bowman2022-07-261-14/+24
| | | | | | | | | | | | | 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>
* use python3.6+ constructsAnthony Sottile2021-07-051-16/+16
| | | | Signed-off-by: Anthony Sottile <asottile@umich.edu>
* Remove support to pre python 3.6set-minimal-python-to-3_6Ulysses Souza2021-03-221-29/+20
| | | | Signed-off-by: Ulysses Souza <ulyssessouza@gmail.com>
* Fix memory conversion to bytes (#2645)Anca Iordache2020-08-171-1/+1
| | | | | | | | * Fix memory conversion to bytes Co-authored-by: Ulysses Souza <ulysses.souza@gmail.com> Signed-off-by: aiordache <anca.iordache@docker.com>
* Implement context management, lifecycle and unittests.Anca Iordache2020-02-051-11/+4
| | | | Signed-off-by: Anca Iordache <anca.iordache@docker.com>
* Fix base_url to keep TCP protocolUlysses Souza2019-03-261-3/+1
| | | | | | | | 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>
* Properly convert non-string filters to expected string formatJoffrey F2018-11-081-1/+4
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Update links docs and fix bug in normalize_linksJoffrey F2018-11-081-1/+1
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Rewrite utils.parse_host to detect more invalid addresses.ssh_protocol_supportJoffrey F2018-11-011-58/+72
| | | | | | | | 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>
* Add support for SSH protocol in base_urlJoffrey F2018-11-011-5/+11
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Move build utils to appropriate fileJoffrey F2018-03-291-89/+0
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Support building with Dockerfile outside of contextJoffrey F2018-03-291-1/+11
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Rewrite access check in create_archive with EAFPJoffrey F2018-02-051-5/+3
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Add workaround for bpo-32713Joffrey F2018-02-051-0/+4
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Remove parameters and methods marked as deprecatedJoffrey F2018-01-311-25/+0
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Do not break when archiving broken symlinks1841-tar-broken-symlinksJoffrey F2018-01-291-1/+2
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Merge pull request #1830 from mhank/1822-reformat-hostsJoffrey F2017-12-131-1/+7
|\ | | | | Fix format in which hosts are being stored for Swarm services
| * Change format in which hosts are being stored for Swarm servicesMichael Hankin2017-12-051-2/+8
| | | | | | | | Signed-off-by: Michael Hankin <mhank@users.noreply.github.com>
| * Change format of extra hostsMichael Hankin2017-12-031-1/+1
| | | | | | | | Signed-off-by: Michael Hankin <mjhankin1@gmail.com>
* | Fix common issues with build context creation: inaccessible files and fifosfix-context-buildingJoffrey F2017-11-291-7/+14
|/ | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Add support for new ContainerSpec parametersJoffrey F2017-11-071-0/+6
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Add support for recursive wildcard pattern in .dockerignoreJoffrey F2017-02-141-132/+0
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Add create_plugin implementationJoffrey F2017-02-091-11/+28
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Ignore socket files in utils.tarJoffrey F2017-01-241-2/+7
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Accept / as a path separator in dockerignore patterns on all platformscompose-4302-dockerignore-windowsJoffrey F2017-01-061-9/+17
| | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Move config type creation from docker.utils functions to classes inconfig_typesJoffrey F2016-12-011-596/+15
| | | | | | docker.types Signed-off-by: Joffrey F <joffrey@docker.com>
* Merge pull request #1308 from docker/docker_clientJoffrey F2016-11-301-1/+1
|\ | | | | Rename Client -> DockerClient
| * Rename Client -> DockerClientdocker_clientJoffrey F2016-11-281-1/+1
| | | | | | | | | | | | | | Replace references to old Client with APIClient Moved contents of services.md to appropriate locations Signed-off-by: Joffrey F <joffrey@docker.com>
* | Merge pull request #1277 from ↵Ben Firshman2016-11-291-19/+32
|\ \ | | | | | | | | | | | | bodnarbm/do-not-traverse-ignored-directories-with-no-potential-exceptions Do not traverse excluded directories that are not prefixes of dockerignore exceptions.
| * | Prevent traversing excluded directories with no possible dockerignore exceptionsBrandon Bodnar2016-11-261-19/+32
| |/ | | | | | | | | | | Fixes an issue where all files in a rather large excluded folder are traversed and examined when creating the build context for potential exception to the exclusion, even though the exclusion rule is for a completely unrelated folder. Signed-off-by: Brandon Bodnar <bodnarbm@gmail.com>
* | Merge pull request #1297 from docker/stepanstipl-allow_custom_pid_modeJoffrey F2016-11-281-3/+3
|\ \ | | | | | | Allow custom pid mode
| * | Re-enable pid_mode checks for API < 1.24stepanstipl-allow_custom_pid_modeJoffrey F2016-11-281-0/+2
| | | | | | | | | | | | Signed-off-by: Joffrey F <joffrey@docker.com>
| * | Allow custom PID mode for the containerStepan Stipl2016-11-281-3/+1
| |/ | | | | | | | | | | | | Docker added support for sharing PID namespaces with other containers since version 1.12 (see https://github.com/docker/docker/pull/22481). Signed-off-by: Stepan Stipl <stepan@stipl.net>
* | Fix parsing for an environment file with newlinesJon Cotton2016-11-281-1/+5
|/ | | | | | Fixes the new, purposely broken test added in the previous commit. Signed-off-by: Jon Cotton <jc@finaltransfer.net>
* Add docstrings to low-level APIBen Firshman2016-11-221-0/+51
| | | | Signed-off-by: Ben Firshman <ben@firshman.co.uk>
* Merge pull request #1236 from docker/host_config_isolationJoffrey F2016-11-171-1/+9
|\ | | | | Add support for isolation param in host config
| * Add support for isolation param in host confighost_config_isolationJoffrey F2016-09-291-1/+9
| | | | | | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* | Convert dicts to Healthcheck objects, string commands to CMD-SHELL listsAanand Prasad2016-11-161-1/+4
| | | | | | | | Signed-off-by: Aanand Prasad <aanand.prasad@gmail.com>
* | Add support for passing healthcheck to create_containerJamie Greeff2016-11-161-1/+8
| | | | | | | | Signed-off-by: Jamie Greeff <jamie@greeff.me>
* | WIPJoffrey F2016-11-041-0/+14
| | | | | | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* | Fix dockerignore exclusion logic on Windowswin32-test-fixesJoffrey F2016-10-141-2/+2
| | | | | | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* | Merge pull request #1256 from docker/format_env_unicode_bugJoffrey F2016-10-131-0/+3
|\ \ | | | | | | Do not break when calling format_environment with unicode values
| * | Do not break when calling format_environment with unicode valuesformat_env_unicode_bugJoffrey F2016-10-121-0/+3
| |/ | | | | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* | Remove trailing slashes in result of utils.parse_hostbase_url_trailing_slashJoffrey F2016-10-121-2/+2
|/ | | | Signed-off-by: Joffrey F <joffrey@docker.com>
* Pass file object to Tarfile.addfile()Christian Bundy2016-09-271-1/+12
| | | | | | | | | | This resolves an issue where TarFile.gettarinfo() doesn't include the file object, meaning that TarFile.addfile(TarFile.gettarinfo()) doesn't pass the test suite. Instead, this uses an open() within a try...except block to include a file object for each file without passing a file object when the path is a directory. Signed-off-by: Christian Bundy <christianbundy@fraction.io>
* Synthesize executable bit on WindowsSebastian Schwarz2016-09-271-1/+5
| | | | | | | | | | | The build context is tarred up on the client and then sent to the Docker daemon. However Windows permissions don't match the Unix ones. Therefore we have to mark all files as executable when creating a build context on Windows, like `docker build` already does: https://github.com/docker/docker/issues/11047. Signed-off-by: Sebastian Schwarz <seschwar@gmail.com>
* Fix licensesBen Firshman2016-09-051-14/+0
| | | | | | | * Complete main LICENSE * Remove unnecessary licenses from individual files Signed-off-by: Ben Firshman <ben@firshman.co.uk>