Merge pull request #729 from thriqon/allow-docker-ce-version-number
Allow docker ce version number as parameter to type
This commit is contained in:
commit
a9427f6b2d
4 changed files with 20 additions and 5 deletions
|
@ -20,6 +20,9 @@ OPTIONAL PARAMETERS
|
||||||
-------------------
|
-------------------
|
||||||
state
|
state
|
||||||
'present' or 'absent', defaults to 'present'
|
'present' or 'absent', defaults to 'present'
|
||||||
|
version
|
||||||
|
The specific version to install. Defaults to the special value 'latest',
|
||||||
|
meaning the version the package manager will install by default.
|
||||||
|
|
||||||
|
|
||||||
BOOLEAN PARAMETERS
|
BOOLEAN PARAMETERS
|
||||||
|
@ -38,6 +41,8 @@ EXAMPLES
|
||||||
# Remove docker
|
# Remove docker
|
||||||
__docker --state absent
|
__docker --state absent
|
||||||
|
|
||||||
|
# Install specific version
|
||||||
|
__docker --state present --version 18.03.0.ce
|
||||||
|
|
||||||
AUTHORS
|
AUTHORS
|
||||||
-------
|
-------
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
os=$(cat "$__global/explorer/os")
|
os=$(cat "$__global/explorer/os")
|
||||||
state=$(cat "$__object/parameter/state")
|
state=$(cat "$__object/parameter/state")
|
||||||
|
version=$(cat "$__object/parameter/version")
|
||||||
|
|
||||||
case "$os" in
|
case "$os" in
|
||||||
centos)
|
centos)
|
||||||
|
@ -33,7 +34,11 @@ case "$os" in
|
||||||
--gpgcheck 1 \
|
--gpgcheck 1 \
|
||||||
--gpgkey 'https://download.docker.com/linux/centos/gpg' \
|
--gpgkey 'https://download.docker.com/linux/centos/gpg' \
|
||||||
--state "${state}"
|
--state "${state}"
|
||||||
|
if [ "$version" != "latest" ]; then
|
||||||
|
require="__yum_repo/docker-ce-stable" __package docker-ce --version "${version}" --state "${state}"
|
||||||
|
else
|
||||||
require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
|
require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "CentOS version 7 is required!" >&2
|
echo "CentOS version 7 is required!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -47,14 +52,17 @@ case "$os" in
|
||||||
fi
|
fi
|
||||||
__apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \
|
__apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \
|
||||||
--uri "https://download.docker.com/linux/${os}/gpg" --state "${state}"
|
--uri "https://download.docker.com/linux/${os}/gpg" --state "${state}"
|
||||||
export CDIST_ORDER_DEPENDENCY=on
|
|
||||||
__apt_source docker \
|
require="__apt_key_uri/docker" __apt_source docker \
|
||||||
--uri "https://download.docker.com/linux/${os}" \
|
--uri "https://download.docker.com/linux/${os}" \
|
||||||
--distribution "$(cat "$__global/explorer/lsb_codename")" \
|
--distribution "$(cat "$__global/explorer/lsb_codename")" \
|
||||||
--state "${state}" \
|
--state "${state}" \
|
||||||
--component "stable"
|
--component "stable"
|
||||||
__package docker-ce --state "${state}"
|
if [ "$version" != "latest" ]; then
|
||||||
unset CDIST_ORDER_DEPENDENCY
|
require="__apt_source/docker" __package docker-ce --version "${version}" --state "${state}"
|
||||||
|
else
|
||||||
|
require="__apt_source/docker" __package docker-ce --state "${state}"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
|
||||||
|
|
1
cdist/conf/type/__docker/parameter/default/version
Normal file
1
cdist/conf/type/__docker/parameter/default/version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
latest
|
|
@ -1 +1,2 @@
|
||||||
state
|
state
|
||||||
|
version
|
||||||
|
|
Loading…
Reference in a new issue