Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 00302b7

Browse files
committed
Tag for 2.5.4 release
- Update nvidia-docker for docker ce - Update tesla nc driver - Use SHA256 checksums instead of MD5 for downloads
1 parent f978287 commit 00302b7

File tree

4 files changed

+65
-29
lines changed

4 files changed

+65
-29
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
## [Unreleased]
44

5+
## [2.5.4] - 2017-03-08
6+
### Changed
7+
- Downloaded files are now verified via SHA256 instead of MD5
8+
- Updated NC-series Tesla driver to 375.39
9+
10+
### Fixed
11+
- `nvidia-docker` updated to 1.0.1 for compatibility with Docker CE
12+
513
## [2.5.3] - 2017-03-01
614
### Added
715
- `pool rebootnode` command added which allows single node reboot control.

convoy/fleet.py

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,34 @@
6262
_ROOT_PATH = pathlib.Path(__file__).resolve().parent.parent
6363
_AZUREFILE_DVD_BIN = {
6464
'url': (
65-
'https://github.com/Azure/azurefile-dockervolumedriver/releases'
66-
'/download/v0.5.1/azurefile-dockervolumedriver'
65+
'https://github.com/Azure/azurefile-dockervolumedriver/releases/'
66+
'download/v0.5.1/azurefile-dockervolumedriver'
67+
),
68+
'sha256': (
69+
'288f809a1290ea8daf89d222507bda9b3709a9665cec8b70354a50252395e127'
6770
),
68-
'md5': 'ee14da21efdfda4bedd85a67adbadc14'
6971
}
7072
_NVIDIA_DOCKER = {
7173
'ubuntuserver': {
7274
'url': (
73-
'https://github.com/NVIDIA/nvidia-docker/releases'
74-
'/download/v1.0.0/nvidia-docker_1.0.0-1_amd64.deb'
75+
'https://github.com/NVIDIA/nvidia-docker/releases/download/'
76+
'v1.0.1/nvidia-docker_1.0.1-1_amd64.deb'
77+
),
78+
'sha256': (
79+
'9fbfd98f87ef2fd2e2137e3ba59431890dde6caf96f113ea0a1bd15bb3e51afa'
7580
),
76-
'md5': '4572a32fe599949381f83c44f8fc57f9',
7781
'target': 'resources/nvidia-docker.deb'
78-
}
82+
},
7983
}
8084
_NVIDIA_DRIVER = {
8185
'compute': {
8286
'url': (
83-
'http://us.download.nvidia.com/XFree86/Linux-x86_64/375.20'
84-
'/NVIDIA-Linux-x86_64-375.20.run'
87+
'http://us.download.nvidia.com/XFree86/Linux-x86_64/'
88+
'375.39/NVIDIA-Linux-x86_64-375.39.run'
89+
),
90+
'sha256': (
91+
'91be5a20841678d671f32074e2901791fe12c00ce1f3b6b3c4199ce302da85a7'
8592
),
86-
'md5': '874ec6d875f532ee9995082176cf9074',
8793
},
8894
'license': (
8995
'http://www.nvidia.com/content/DriverDownload-March2009'
@@ -294,8 +300,8 @@ def _setup_nvidia_driver_package(blob_client, config, vm_size):
294300
pkg = pathlib.Path(_ROOT_PATH, _NVIDIA_DRIVER['target'])
295301
# check to see if package is downloaded
296302
if (not pkg.exists() or
297-
util.compute_md5_for_file(pkg, False) !=
298-
_NVIDIA_DRIVER[gpu_type]['md5']):
303+
util.compute_sha256_for_file(pkg, False) !=
304+
_NVIDIA_DRIVER[gpu_type]['sha256']):
299305
# display license link
300306
if not util.confirm_action(
301307
config,
@@ -311,10 +317,10 @@ def _setup_nvidia_driver_package(blob_client, config, vm_size):
311317
response = urllibreq.urlopen(_NVIDIA_DRIVER[gpu_type]['url'])
312318
with pkg.open('wb') as f:
313319
f.write(response.read())
314-
# check md5
315-
if (util.compute_md5_for_file(pkg, False) !=
316-
_NVIDIA_DRIVER[gpu_type]['md5']):
317-
raise RuntimeError('md5 mismatch for {}'.format(pkg))
320+
# check sha256
321+
if (util.compute_sha256_for_file(pkg, False) !=
322+
_NVIDIA_DRIVER[gpu_type]['sha256']):
323+
raise RuntimeError('sha256 mismatch for {}'.format(pkg))
318324
return pkg
319325

320326

@@ -333,18 +339,18 @@ def _setup_nvidia_docker_package(blob_client, config):
333339
pkg = pathlib.Path(_ROOT_PATH, _NVIDIA_DOCKER[offer]['target'])
334340
# check to see if package is downloaded
335341
if (not pkg.exists() or
336-
util.compute_md5_for_file(pkg, False) !=
337-
_NVIDIA_DOCKER[offer]['md5']):
342+
util.compute_sha256_for_file(pkg, False) !=
343+
_NVIDIA_DOCKER[offer]['sha256']):
338344
# download package
339345
logger.debug('downloading NVIDIA docker to {}'.format(
340346
_NVIDIA_DOCKER[offer]['target']))
341347
response = urllibreq.urlopen(_NVIDIA_DOCKER[offer]['url'])
342348
with pkg.open('wb') as f:
343349
f.write(response.read())
344-
# check md5
345-
if (util.compute_md5_for_file(pkg, False) !=
346-
_NVIDIA_DOCKER[offer]['md5']):
347-
raise RuntimeError('md5 mismatch for {}'.format(pkg))
350+
# check sha256
351+
if (util.compute_sha256_for_file(pkg, False) !=
352+
_NVIDIA_DOCKER[offer]['sha256']):
353+
raise RuntimeError('sha256 mismatch for {}'.format(pkg))
348354
return pkg
349355

350356

@@ -363,17 +369,17 @@ def _setup_azurefile_volume_driver(blob_client, config):
363369
# check to see if binary is downloaded
364370
bin = pathlib.Path(_ROOT_PATH, 'resources/azurefile-dockervolumedriver')
365371
if (not bin.exists() or
366-
util.compute_md5_for_file(bin, False) !=
367-
_AZUREFILE_DVD_BIN['md5']):
372+
util.compute_sha256_for_file(bin, False) !=
373+
_AZUREFILE_DVD_BIN['sha256']):
368374
# download package
369375
logger.debug('downloading Azure File Docker Volume Driver')
370376
response = urllibreq.urlopen(_AZUREFILE_DVD_BIN['url'])
371377
with bin.open('wb') as f:
372378
f.write(response.read())
373-
# check md5
374-
if (util.compute_md5_for_file(bin, False) !=
375-
_AZUREFILE_DVD_BIN['md5']):
376-
raise RuntimeError('md5 mismatch for {}'.format(bin))
379+
# check sha256
380+
if (util.compute_sha256_for_file(bin, False) !=
381+
_AZUREFILE_DVD_BIN['sha256']):
382+
raise RuntimeError('sha256 mismatch for {}'.format(bin))
377383
if (publisher == 'canonical' and offer == 'ubuntuserver' and
378384
sku.startswith('14.04')):
379385
srv = pathlib.Path(

convoy/util.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,28 @@ def convert_string_to_timedelta(string):
315315
return datetime.timedelta(days, totsec)
316316

317317

318+
def compute_sha256_for_file(file, as_base64, blocksize=65536):
319+
# type: (pathlib.Path, bool, int) -> str
320+
"""Compute SHA256 hash for file
321+
:param pathlib.Path file: file to compute md5 for
322+
:param bool as_base64: return as base64 encoded string
323+
:param int blocksize: block size in bytes
324+
:rtype: str
325+
:return: SHA256 for file
326+
"""
327+
hasher = hashlib.sha256()
328+
with file.open('rb') as filedesc:
329+
while True:
330+
buf = filedesc.read(blocksize)
331+
if not buf:
332+
break
333+
hasher.update(buf)
334+
if as_base64:
335+
return base64_encode_string(hasher.digest())
336+
else:
337+
return hasher.hexdigest()
338+
339+
318340
def compute_md5_for_file(file, as_base64, blocksize=65536):
319341
# type: (pathlib.Path, bool, int) -> str
320342
"""Compute MD5 hash for file

convoy/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
2323
# DEALINGS IN THE SOFTWARE.
2424

25-
__version__ = '2.5.3'
25+
__version__ = '2.5.4'

0 commit comments

Comments
 (0)