From: Shivani Bhardwaj Date: Mon, 14 Jan 2019 17:22:49 +0000 (+0530) Subject: Avoid failure in case of obsoletion of attribute X-Git-Tag: 1.1.0rc1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75682f145b3e9f98c8092f2aa8ac06f733fbf3cb;p=thirdparty%2Fsuricata-update.git Avoid failure in case of obsoletion of attribute `platform` is currently (Py3.7) shipped with `linux_distribution` attribute but it has been Deprecated since Py3.5. In future when it becomes obsolete, suricata-update will break while creating User-Agent header. In order to avoid this, check for the attribute before adding it to User-Agent. This renders redmine issue #2645 invalid. --- diff --git a/suricata/update/net.py b/suricata/update/net.py index 1392bc5..bbc8414 100644 --- a/suricata/update/net.py +++ b/suricata/update/net.py @@ -67,7 +67,7 @@ def build_user_agent(): params.append("CPU: %s" % (platform.machine())) params.append("Python: %s" % (platform.python_version())) - if uname_system == "Linux": + if uname_system == "Linux" and hasattr(platform, "linux_distribution"): distribution = platform.linux_distribution() params.append("Dist: %s/%s" % ( str(distribution[0]), str(distribution[1])))