Commit Graph

11 Commits

Author SHA1 Message Date
Simon Ferquel 8efa6a9567 Fix tests with missing mocks
A recent change in moby/moby made tests with missing client mocks fail with panic.
This adds those missing mocks for the impacted tests.

Signed-off-by: Simon Ferquel <simon.ferquel@docker.com>
2018-11-08 11:37:49 +01:00
Kir Kolyshkin 6f8070deb2 Switch from x/net/context to context
Since go 1.7, "context" is a standard package. Since go 1.9,
x/net/context merely provides some types aliased to those in
the standard context package.

The changes were performed by the following script:

for f in $(git ls-files \*.go | grep -v ^vendor/); do
	sed -i 's|golang.org/x/net/context|context|' $f
	goimports -w $f
	for i in 1 2; do
		awk '/^$/ {e=1; next;}
			/\t"context"$/ {e=0;}
			{if (e) {print ""; e=0}; print;}' < $f > $f.new && \
				mv $f.new $f
		goimports -w $f
	done
done

[v2: do awk/goimports fixup twice]
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2018-05-11 16:49:43 -07:00
Sebastiaan van Stijn d0bea64185
Preserve resolved image-digest if QueryRegistry == false
When re-deploying a stack without re-resolving the image digest,
the service's ContainerSpec was updated with the image-reference
as specified in the stack/compose file.

As a result, the image-digest that was resolved in a previous
deploy was overwritten, causing the service to be re-deployed.

This patch preserves the previously resolve image-digest
by copying it from the current service spec.

A unit test is also added to verify that the image information
in the service spec is not updated if QueryRegistry is disabled.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-08-03 18:49:07 +02:00
Sebastiaan van Stijn 2429f15672
Don't attempt to remove unsupported resources on older daemon
When running `docker stack rm <some stack>` against an older daemon,
a warning was printed for "configs" being ignored;

    WARNING: ignoring "configs" (requires API version 1.30, but the Docker daemon API version is 1.26)

Given that an old daemon cannot _have_ configs, there should not be
a need to warn, or _attempt_ to remove these resources.

This patch removes the warning, and skips fetching (and removing)
configs.

A check if _secrets_ are supported by the daemon is also added,
given that this would result in an error when attempted against
an older (pre 1.13) daemon.

There is one situation where this could lead to secrets or
configs being left behind; if the client is connecting to a
daemon that _does_ support secrets, configs, but the API version
is overridden using `DOCKER_API_VERSION`, no warning is printed,
and secrets and configs are not attempted to be removed.

Given that `DOCKER_API_VERSION` is regarded a feature for
debugging / "power users", it should be ok to ignore this.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2017-07-11 10:29:03 -07:00
Arash Deshmeh 535af2d868 add unit tests to stack package
Signed-off-by: Arash Deshmeh <adeshmeh@ca.ibm.com>
2017-06-20 14:31:00 -04:00
Vincent Demeester 2128b3f112
Do not call the config endpoint if API is lower than 1.30
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-06-14 09:56:53 +02:00
John Stephens f05cd11ee2
Remove stack configs on stack removal
Signed-off-by: John Stephens <johnstep@docker.com>
2017-05-26 18:17:43 -07:00
Gaetan de Villele 295140edf2 cli: gofmt + goimports
Signed-off-by: Gaetan de Villele <gdevillele@gmail.com>
2017-05-08 10:51:30 -07:00
Tibor Vass 57230a7212 rm client and vendor it instead
Signed-off-by: Tibor Vass <tibor@docker.com>
2017-05-08 10:33:56 -07:00
Daniel Nephin 10641c2aae Update imports.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
2017-04-17 18:07:56 -04:00
Daniel Nephin 1630fc40f8 Import docker/docker/cli
Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-04-17 17:40:59 -04:00