Hello community,

here is the log from the commit of package python-pywbem for openSUSE:Factory 
checked in at 2020-12-16 10:59:55
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pywbem (Old)
 and      /work/SRC/openSUSE:Factory/.python-pywbem.new.2328 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-pywbem"

Wed Dec 16 10:59:55 2020 rev:16 rq:855859 version:1.1.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-pywbem/python-pywbem.changes      
2020-10-29 09:49:04.284206585 +0100
+++ /work/SRC/openSUSE:Factory/.python-pywbem.new.2328/python-pywbem.changes    
2020-12-16 10:59:56.287537514 +0100
@@ -1,0 +2,7 @@
+Mon Dec 14 17:02:26 UTC 2020 - Benjamin Greiner <[email protected]>
+
+- Fix fail because of urllib3 deprecation warnings
+  * gh#pywbem/pywbem#2533
+  * pywbem-pr2533-fix-urllib3-warnings.patch 
+
+-------------------------------------------------------------------

New:
----
  pywbem-pr2533-fix-urllib3-warnings.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-pywbem.spec ++++++
--- /var/tmp/diff_new_pack.fOgtcO/_old  2020-12-16 10:59:57.439538645 +0100
+++ /var/tmp/diff_new_pack.fOgtcO/_new  2020-12-16 10:59:57.443538649 +0100
@@ -26,6 +26,8 @@
 Group:          System/Management
 URL:            https://pywbem.github.io/
 Source0:        
https://github.com/pywbem/pywbem/archive/%{version}.tar.gz#/pywbem-%{version}.tar.gz
+# PATCH-FIX-UPSTREAM pywbem-pr2533-fix-urllib3-warnings.patch -- 
gh#pywbem/pywbem#2533
+Patch0:         pywbem-pr2533-fix-urllib3-warnings.patch
 BuildRequires:  %{python_module FormEncode}
 BuildRequires:  %{python_module PyYAML}
 BuildRequires:  %{python_module base}

++++++ pywbem-pr2533-fix-urllib3-warnings.patch ++++++
From fa3363bb06f8ac80bb6f74a3e52cce7cd4527cb0 Mon Sep 17 00:00:00 2001
From: Andreas Maier <[email protected]>
Date: Sat, 14 Nov 2020 08:10:50 +0100
Subject: [PATCH] Fixed DeprecationWarning issued by urllib3

Details:

* Version 1.26.0 of urllib3 started issuing a DeprecationWarning about the
  use of the 'method_whitelist' init parameter in Retry. The replacement
  parameter is 'allowed_methods', which was introduced also in 1.26.0.
  In addition, the DeprecationWarning states that the 'method_whitelist'
  paremeter will be removed in urllib3 version 2.0.

  Fixed that by determining at the module level of _cim_operations.py
  which parameter to use and preparing the init kwargs, using
  'allowed_methods' when the DeprecationWarning is issued or TypeError
  to cover for the future removal.

Signed-off-by: Andreas Maier <[email protected]>
---
 (docs/changes.rst          |  3 +++)
 pywbem/_cim_operations.py | 31 ++++++++++++++++++++++++-------
 2 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/pywbem/_cim_operations.py b/pywbem/_cim_operations.py
index 79e54ae84..bd2d9f81a 100644
--- a/pywbem/_cim_operations.py
+++ b/pywbem/_cim_operations.py
@@ -138,6 +138,7 @@
 from xml.dom import minidom
 from collections import namedtuple
 import logging
+import warnings
 
 import requests
 from requests.packages import urllib3
@@ -170,6 +171,28 @@
 HTTP_RETRY_BACKOFF_FACTOR = 0.1  # Backoff factor for retries
 HTTP_MAX_REDIRECTS = 5           # Max number of HTTP redirects
 
+# urllib3 1.26.0 started issuing a DeprecationWarning for using the
+# 'method_whitelist' init parameter of Retry and announced its removal in
+# version 2.0. The replacement parameter is 'allowed_methods'.
+# Find out which init parameter to use:
+with warnings.catch_warnings():
+    warnings.filterwarnings('error')
+    try:
+        urllib3.Retry(method_whitelist={})
+    except (DeprecationWarning, TypeError):
+        RETRY_METHODS_PARM = 'allowed_methods'
+    else:
+        RETRY_METHODS_PARM = 'method_whitelist'
+
+RETRY_KWARGS = dict(
+    total=HTTP_TOTAL_RETRIES,
+    connect=HTTP_CONNECT_RETRIES,
+    read=HTTP_READ_RETRIES,
+    redirect=HTTP_MAX_REDIRECTS,
+    backoff_factor=HTTP_RETRY_BACKOFF_FACTOR
+)
+RETRY_KWARGS[RETRY_METHODS_PARM] = {'POST'}
+
 # Global named tuples. Used by the pull operation responses to return
 # (entities, end_of_sequence, and enumeration_context) to the caller.
 
@@ -770,13 +793,7 @@ def __init__(self, url, creds=None, default_namespace=None,
                         type(self.ca_certs)))
         self.session.verify = verify
 
-        retry = urllib3.Retry(
-            total=HTTP_TOTAL_RETRIES,
-            connect=HTTP_CONNECT_RETRIES,
-            read=HTTP_READ_RETRIES,
-            method_whitelist={'POST'},
-            redirect=HTTP_MAX_REDIRECTS,
-            backoff_factor=HTTP_RETRY_BACKOFF_FACTOR)
+        retry = urllib3.Retry(**RETRY_KWARGS)
 
         # While it would be technically sufficient to set a retry transport
         # adapter only for the scheme specified in the input URL, we are
_______________________________________________
openSUSE Commits mailing list -- [email protected]
To unsubscribe, email [email protected]
List Netiquette: https://en.opensuse.org/openSUSE:Mailing_list_netiquette
List Archives: 
https://lists.opensuse.org/archives/list/[email protected]

Reply via email to