]> git.ipfire.org Git - thirdparty/suricata-update.git/commitdiff
Avoid failure in case of obsoletion of attribute
authorShivani Bhardwaj <shivanib134@gmail.com>
Mon, 14 Jan 2019 17:22:49 +0000 (22:52 +0530)
committerJason Ish <ish@unx.ca>
Wed, 13 Feb 2019 14:51:52 +0000 (08:51 -0600)
`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.

suricata/update/net.py

index 1392bc55514bac752ef093b433ac06df487ed1b5..bbc8414dd6a3c4a58b1647fdfcc9538ecae48691 100644 (file)
@@ -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])))