mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Add version option to docker_daemon plugin
As requested on #147, there is now an option to specify the Docker version to be installed when using the `docker_daemon` plugin. The version string is validated against a pattern extracted from the Docker's CHANGELOG. If the version is not present, it will just download the latest available. The download method was also changed from `urllib` to `wget`, so we can see its progress if needed. This closes #147.
This commit is contained in:
parent
8076ad3ae1
commit
0f5de13bae
2 changed files with 17 additions and 3 deletions
|
@ -3,6 +3,15 @@ $schema: http://json-schema.org/draft-04/schema#
|
||||||
title: Install Docker plugin manifest
|
title: Install Docker plugin manifest
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
plugins:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
docker_daemon:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
version:
|
||||||
|
pattern: '^\d\.\d{1,2}\.\d$'
|
||||||
|
type: string
|
||||||
system:
|
system:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
|
|
|
@ -25,13 +25,18 @@ class AddDockerDeps(Task):
|
||||||
class AddDockerBinary(Task):
|
class AddDockerBinary(Task):
|
||||||
description = 'Add docker binary'
|
description = 'Add docker binary'
|
||||||
phase = phases.system_modification
|
phase = phases.system_modification
|
||||||
DOCKER_URL = 'https://get.docker.io/builds/Linux/x86_64/docker-latest'
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def run(cls, info):
|
def run(cls, info):
|
||||||
import urllib
|
from bootstrapvz.common.tools import log_check_call
|
||||||
|
docker_version = info.manifest.plugins['docker_daemon'].get('version', False)
|
||||||
|
docker_url = 'https://get.docker.io/builds/Linux/x86_64/docker-'
|
||||||
|
if docker_version:
|
||||||
|
docker_url += docker_version
|
||||||
|
else:
|
||||||
|
docker_url += 'latest'
|
||||||
bin_docker = os.path.join(info.root, 'usr/bin/docker')
|
bin_docker = os.path.join(info.root, 'usr/bin/docker')
|
||||||
urllib.urlretrieve(cls.DOCKER_URL, bin_docker)
|
log_check_call(['wget', '-O', bin_docker, docker_url])
|
||||||
os.chmod(bin_docker, 0755)
|
os.chmod(bin_docker, 0755)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue