Commit a80b52a4 authored by Marco Mariani's avatar Marco Mariani

Merge branch 'networkcache-debian'

parents b5f2cfb8 1628248d
...@@ -4,6 +4,7 @@ Changes ...@@ -4,6 +4,7 @@ Changes
0.33.2 (unreleased) 0.33.2 (unreleased)
------------------- -------------------
* networkcache: only match major release number in debian [Marco Mariani]
* slapproxy: Filter by instance_guid, allow computer partition renames * slapproxy: Filter by instance_guid, allow computer partition renames
and change of software_type and requested_state [Marco Mariani] and change of software_type and requested_state [Marco Mariani]
* slapproxy: Stop instance even if buildout/reporting is wrong [Cedric de Saint Martin] * slapproxy: Stop instance even if buildout/reporting is wrong [Cedric de Saint Martin]
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
# #
############################################################################## ##############################################################################
import shutil import ast
import traceback
import json import json
import platform import platform
import shutil
import traceback
try: try:
try: try:
...@@ -47,6 +48,18 @@ def fallback_call(function): ...@@ -47,6 +48,18 @@ def fallback_call(function):
return wrapper return wrapper
def debianize(os):
# keep only the major release number in case of debian
distname, version, id_ = os
if distname == 'debian' and '.' in version:
version = version.split('.')[0]
return distname, version, id_
def os_matches(os1, os2):
return debianize(os1) == debianize(os2)
@fallback_call @fallback_call
def download_network_cached(cache_url, dir_url, software_url, software_root, def download_network_cached(cache_url, dir_url, software_url, software_root,
key, path, logger, signature_certificate_list, key, path, logger, signature_certificate_list,
...@@ -85,7 +98,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root, ...@@ -85,7 +98,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
tags = json.loads(json_information) tags = json.loads(json_information)
if tags.get('machine') != platform.machine(): if tags.get('machine') != platform.machine():
continue continue
if tags.get('os') != str(platform.linux_distribution()): if not os_matches(ast.literal_eval(tags.get('os')),
platform.linux_distribution()):
continue continue
if tags.get('software_url') != software_url: if tags.get('software_url') != software_url:
continue continue
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment