Commit a80b52a4 authored by Marco Mariani's avatar Marco Mariani

Merge branch 'networkcache-debian'

parents b5f2cfb8 1628248d
......@@ -4,6 +4,7 @@ Changes
0.33.2 (unreleased)
-------------------
* networkcache: only match major release number in debian [Marco Mariani]
* slapproxy: Filter by instance_guid, allow computer partition renames
and change of software_type and requested_state [Marco Mariani]
* slapproxy: Stop instance even if buildout/reporting is wrong [Cedric de Saint Martin]
......
......@@ -12,10 +12,11 @@
#
##############################################################################
import shutil
import traceback
import ast
import json
import platform
import shutil
import traceback
try:
try:
......@@ -47,6 +48,18 @@ def fallback_call(function):
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
def download_network_cached(cache_url, dir_url, software_url, software_root,
key, path, logger, signature_certificate_list,
......@@ -85,7 +98,8 @@ def download_network_cached(cache_url, dir_url, software_url, software_root,
tags = json.loads(json_information)
if tags.get('machine') != platform.machine():
continue
if tags.get('os') != str(platform.linux_distribution()):
if not os_matches(ast.literal_eval(tags.get('os')),
platform.linux_distribution()):
continue
if tags.get('software_url') != software_url:
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