Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pywinrm for openSUSE:Factory checked in at 2022-04-14 17:25:35 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pywinrm (Old) and /work/SRC/openSUSE:Factory/.python-pywinrm.new.1941 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pywinrm" Thu Apr 14 17:25:35 2022 rev:7 rq:970081 version:0.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pywinrm/python-pywinrm.changes 2021-10-18 22:01:58.130083878 +0200 +++ /work/SRC/openSUSE:Factory/.python-pywinrm.new.1941/python-pywinrm.changes 2022-04-14 17:26:13.287316404 +0200 @@ -1,0 +2,9 @@ +Thu Apr 14 06:48:11 UTC 2022 - [email protected] + +- version update to 0.4.3 + * Fix invalid regex escape sequences. + * Decoding CLIXML failures for run_ps will create a UserWarning rather than printing the warning. + * Remove usage of deprecated Python API to support Python 3.11 +- do not require mock for build + +------------------------------------------------------------------- Old: ---- pywinrm-0.4.2.tar.gz New: ---- pywinrm-0.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pywinrm.spec ++++++ --- /var/tmp/diff_new_pack.D1Hz8H/_old 2022-04-14 17:26:13.783316984 +0200 +++ /var/tmp/diff_new_pack.D1Hz8H/_new 2022-04-14 17:26:13.791316994 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-pywinrm # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-pywinrm -Version: 0.4.2 +Version: 0.4.3 Release: 0 Summary: Python library for Windows Remote Management License: MIT @@ -26,7 +26,6 @@ URL: https://github.com/diyan/pywinrm/ Source: https://github.com/diyan/pywinrm/archive/refs/tags/v%{version}.tar.gz#/pywinrm-%{version}.tar.gz BuildRequires: %{python_module kerberos} -BuildRequires: %{python_module mock} BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests >= 2.9.1} BuildRequires: %{python_module requests_ntlm >= 0.3.0} @@ -65,6 +64,8 @@ %python_expand %fdupes %{buildroot}%{$python_sitelib} %check +# https://github.com/diyan/pywinrm/issues/345 +sed -i 's:import mock:from unittest import mock:' winrm/tests/test_transport.py %pyunittest discover -v %files %{python_files} ++++++ pywinrm-0.4.2.tar.gz -> pywinrm-0.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/.github/workflows/ci.yml new/pywinrm-0.4.3/.github/workflows/ci.yml --- old/pywinrm-0.4.2/.github/workflows/ci.yml 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/.github/workflows/ci.yml 2022-04-14 06:09:29.000000000 +0200 @@ -8,9 +8,9 @@ branches: - master -env: - WINRM_USERNAME: pywinrm-test - WINRM_PASSWORD: Password123! +# env: +# WINRM_USERNAME: pywinrm-test +# WINRM_PASSWORD: Password123! jobs: test: @@ -28,6 +28,7 @@ - 3.7 - 3.8 - 3.9 + - '3.10' - pypy-2.7 - pypy-3.7 arch: @@ -57,26 +58,33 @@ python-version: ${{ matrix.python-version }} architecture: ${{ matrix.arch }} - - name: set up Windows integration tests - if: startsWith(matrix.os, 'windows') - shell: pwsh - run: | - Write-Host 'Create local admin user' - $userParams = @{ - Name = $env:WINRM_USERNAME - Password = (ConvertTo-SecureString -AsPlainText -Force -String $env:WINRM_PASSWORD) - AccountNeverExpires = $true - PasswordNeverExpires = $true - } - $null = New-LocalUser @userParams - Add-LocalGroupMember -Group Administrators -Member $userParams.Name - - Write-Host 'Setting up WinRM settings' - Enable-PSRemoting -Force -SkipNetworkProfileCheck - Enable-WSManCredSSP -Role Server -Force - Set-Item WSMan:\localhost\Service\Auth\Basic $true - Set-Item WSMan:\localhost\Service\Auth\CredSSP $true - Set-Item WSMan:\localhost\Service\AllowUnencrypted $true + # - name: Remove extra modules to speed up PowerShell startup module due to slow WinRM issue + # if: startsWith(matrix.os, 'windows') + # shell: bash + # run: | + # rm -rf "/c/Program Files/WindowsPowerShell/Modules/AWSPowerShell" + # rm -rf "/c/Program Files/WindowsPowerShell/Modules/Microsoft.Graph*" + + # - name: set up Windows integration tests + # if: startsWith(matrix.os, 'windows') + # shell: pwsh + # run: | + # Write-Host 'Create local admin user' + # $userParams = @{ + # Name = $env:WINRM_USERNAME + # Password = (ConvertTo-SecureString -AsPlainText -Force -String $env:WINRM_PASSWORD) + # AccountNeverExpires = $true + # PasswordNeverExpires = $true + # } + # $null = New-LocalUser @userParams + # Add-LocalGroupMember -Group Administrators -Member $userParams.Name + + # Write-Host 'Setting up WinRM settings' + # Enable-PSRemoting -Force -SkipNetworkProfileCheck + # Enable-WSManCredSSP -Role Server -Force + # Set-Item WSMan:\localhost\Service\Auth\Basic $true + # Set-Item WSMan:\localhost\Service\Auth\CredSSP $true + # Set-Item WSMan:\localhost\Service\AllowUnencrypted $true - name: set up Linux dependencies if: startsWith(matrix.os, 'ubuntu') @@ -103,9 +111,9 @@ if: startsWith(matrix.os, 'windows') run: | pytest -v --flake8 --cov=winrm --cov-report=term-missing winrm/tests/ - env: - WINRM_TRANSPORT: basic - WINRM_ENDPOINT: http://localhost:5985/wsman + # env: + # WINRM_TRANSPORT: basic + # WINRM_ENDPOINT: http://localhost:5985/wsman - name: upload coverage data if: "!endsWith(matrix.python-version, '2.7')" # Uses an older coverals version that doesn't support GHA @@ -113,20 +121,20 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: run integration with NTLM - if: startsWith(matrix.os, 'windows') - run: | - Set-Item WSMan:\localhost\Service\AllowUnencrypted $false - py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py - env: - WINRM_TRANSPORT: ntlm - WINRM_ENDPOINT: http://localhost:5985/wsman - - - name: run integration with CredSSP - if: startsWith(matrix.os, 'windows') - run: | - Set-Item WSMan:\localhost\Service\AllowUnencrypted $false - py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py - env: - WINRM_TRANSPORT: credssp - WINRM_ENDPOINT: http://localhost:5985/wsman + # - name: run integration with NTLM + # if: startsWith(matrix.os, 'windows') + # run: | + # Set-Item WSMan:\localhost\Service\AllowUnencrypted $false + # py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py + # env: + # WINRM_TRANSPORT: ntlm + # WINRM_ENDPOINT: http://localhost:5985/wsman + + # - name: run integration with CredSSP + # if: startsWith(matrix.os, 'windows') + # run: | + # Set-Item WSMan:\localhost\Service\AllowUnencrypted $false + # py.test -v winrm/tests/test_integration_protocol.py winrm/tests/test_integration_session.py + # env: + # WINRM_TRANSPORT: credssp + # WINRM_ENDPOINT: http://localhost:5985/wsman diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/CHANGELOG.md new/pywinrm-0.4.3/CHANGELOG.md --- old/pywinrm-0.4.2/CHANGELOG.md 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/CHANGELOG.md 2022-04-14 06:09:29.000000000 +0200 @@ -1,5 +1,10 @@ # Changelog +### Version 0.4.3 +- Fix invalid regex escape sequences. +- Decoding CLIXML failures for `run_ps` will create a `UserWarning` rather than printing the warning. +- Remove usage of deprecated Python API to support Python 3.11 + ### Version 0.4.2 - Dropped Python 3.5 from support matrix as it is EOL. - Remove dependency on `distutils` that is deprecated in Python 3.10. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/requirements-test.txt new/pywinrm-0.4.3/requirements-test.txt --- old/pywinrm-0.4.2/requirements-test.txt 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/requirements-test.txt 2022-04-14 06:09:29.000000000 +0200 @@ -1,6 +1,5 @@ # this assumes the base requirements have been satisfied via setup.py -# pin specific versions to keep things more stable over time; only pin sub-packages if necessary -pytest==4.4.2 -pytest-cov==2.7.1 +pytest +pytest-cov pytest-flake8==1.0.7 -mock==3.0.5 +mock diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/setup.py new/pywinrm-0.4.3/setup.py --- old/pywinrm-0.4.2/setup.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/setup.py 2022-04-14 06:09:29.000000000 +0200 @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -__version__ = '0.4.2' +__version__ = '0.4.3' project_name = 'pywinrm' # PyPi supports only reStructuredText, so pandoc should be installed @@ -23,7 +23,7 @@ license='MIT license', packages=find_packages(), package_data={'winrm.tests': ['*.ps1']}, - install_requires=['xmltodict', 'requests>=2.9.1', 'requests_ntlm>=0.3.0', 'six'], + install_requires=['xmltodict', 'requests>=2.9.1', 'requests_ntlm>=1.1.0', 'six'], extras_require={ 'credssp': ['requests-credssp>=1.0.0'], 'kerberos:sys_platform=="win32"': ['winkerberos>=0.5.0'], @@ -44,6 +44,7 @@ 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: Implementation :: PyPy', 'Topic :: Software Development :: Libraries :: Python Modules', 'Topic :: System :: Clustering', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/__init__.py new/pywinrm-0.4.3/winrm/__init__.py --- old/pywinrm-0.4.2/winrm/__init__.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/__init__.py 2022-04-14 06:09:29.000000000 +0200 @@ -2,6 +2,7 @@ import re from base64 import b64encode import xml.etree.ElementTree as ET +import warnings from winrm.protocol import Protocol @@ -78,10 +79,10 @@ new_msg += s.text.replace("_x000D__x000A_", "\n") except Exception as e: # if any of the above fails, the msg was not true xml - # print a warning and return the orignal string - # TODO do not print, raise user defined error instead - print("Warning: there was a problem converting the Powershell" - " error message: %s" % (e)) + # print a warning and return the original string + warnings.warn( + "There was a problem converting the Powershell error " + "message: %s" % (e)) else: # if new_msg was populated, that's our error message # otherwise the original error message will be used @@ -104,7 +105,7 @@ @staticmethod def _build_url(target, transport): match = re.match( - '(?i)^((?P<scheme>http[s]?)://)?(?P<host>[0-9a-z-_.]+)(:(?P<port>\d+))?(?P<path>(/)?(wsman)?)?', target) # NOQA + r'(?i)^((?P<scheme>http[s]?)://)?(?P<host>[0-9a-z-_.]+)(:(?P<port>\d+))?(?P<path>(/)?(wsman)?)?', target) # NOQA scheme = match.group('scheme') if not scheme: # TODO do we have anything other than HTTP/HTTPS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/encryption.py new/pywinrm-0.4.3/winrm/encryption.py --- old/pywinrm-0.4.2/winrm/encryption.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/encryption.py 2022-04-14 06:09:29.000000000 +0200 @@ -92,7 +92,7 @@ """ Takes in the encrypted response from the server and decrypts it - :param response: The response that needs to be decrytped + :param response: The response that needs to be decrypted :return: The unencrypted message from the server """ content_type = response.headers['Content-Type'] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/exceptions.py new/pywinrm-0.4.3/winrm/exceptions.py --- old/pywinrm-0.4.2/winrm/exceptions.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/exceptions.py 2022-04-14 06:09:29.000000000 +0200 @@ -7,7 +7,7 @@ class WinRMTransportError(Exception): - """WinRM errors specific to transport-level problems (unexpcted HTTP error codes, etc)""" + """WinRM errors specific to transport-level problems (unexpected HTTP error codes, etc)""" @property def protocol(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/protocol.py new/pywinrm-0.4.3/winrm/protocol.py --- old/pywinrm-0.4.2/winrm/protocol.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/protocol.py 2022-04-14 06:09:29.000000000 +0200 @@ -56,7 +56,7 @@ Any other value will be considered the CA trust path to use. @param string cert_pem: client authentication certificate file path in PEM format # NOQA @param string cert_key_pem: client authentication certificate key file path in PEM format # NOQA - @param string server_cert_validation: whether server certificate should be validated on Python versions that suppport it; one of 'validate' (default), 'ignore' #NOQA + @param string server_cert_validation: whether server certificate should be validated on Python versions that support it; one of 'validate' (default), 'ignore' #NOQA @param bool kerberos_delegation: if True, TGT is sent to target server to allow multiple hops # NOQA @param int read_timeout_sec: maximum seconds to wait before an HTTP connect/read times out (default 30). This value should be slightly higher than operation_timeout_sec, as the server can block *at least* that long. # NOQA @param int operation_timeout_sec: maximum allowed time in seconds for any single wsman HTTP operation (default 20). Note that operation timeouts while receiving output (the only wsman operation that should take any significant time, and where these timeouts are expected) will be silently retried indefinitely. # NOQA @@ -436,9 +436,9 @@ @param string command_id: The command id on the remote machine. See #run_command #@return [Hash] Returns a Hash with a key :exitcode and :data. - Data is an Array of Hashes where the cooresponding key + Data is an Array of Hashes where the corresponding key # is either :stdout or :stderr. The reason it is in an Array so so - we can get the output in the order it ocurrs on + we can get the output in the order it occurs on # the console. """ stdout_buffer, stderr_buffer = [], [] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/tests/test_session.py new/pywinrm-0.4.3/winrm/tests/test_session.py --- old/pywinrm-0.4.2/winrm/tests/test_session.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/tests/test_session.py 2022-04-14 06:09:29.000000000 +0200 @@ -1,3 +1,5 @@ +import pytest + from winrm import Session @@ -78,3 +80,13 @@ expected = msg actual = s._clean_error_msg(msg) assert actual == expected + + +def test_decode_clixml_invalid_xml(): + s = Session('windows-host.example.com', auth=('john.smith', 'secret')) + msg = b'#< CLIXML\r\n<in >dasf<?dsfij>' + + with pytest.warns(UserWarning, match="There was a problem converting the Powershell error message"): + actual = s._clean_error_msg(msg) + + assert actual == msg diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/transport.py new/pywinrm-0.4.3/winrm/transport.py --- old/pywinrm-0.4.2/winrm/transport.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/transport.py 2022-04-14 06:09:29.000000000 +0200 @@ -1,7 +1,6 @@ from __future__ import unicode_literals import sys import os -import inspect import requests import requests.auth import warnings @@ -228,12 +227,10 @@ if self.auth_method == 'kerberos': if not HAVE_KERBEROS: - raise WinRMError("requested auth method is kerberos, but requests_kerberos is not installed") + raise WinRMError("requested auth method is kerberos, but pykerberos is not installed") - man_args = dict( + session.auth = HTTPKerberosAuth( mutual_authentication=REQUIRED, - ) - opt_args = dict( delegate=self.kerberos_delegation, force_preemptive=True, principal=self.username, @@ -242,8 +239,6 @@ service=self.service, send_cbt=self.send_cbt ) - kerb_args = self._get_args(man_args, opt_args, HTTPKerberosAuth.__init__) - session.auth = HTTPKerberosAuth(**kerb_args) encryption_available = hasattr(session.auth, 'winrm_encryption_available') and session.auth.winrm_encryption_available elif self.auth_method in ['certificate', 'ssl']: if self.auth_method == 'ssl' and not self.cert_pem and not self.cert_key_pem: @@ -257,15 +252,12 @@ elif self.auth_method == 'ntlm': if not HAVE_NTLM: raise WinRMError("requested auth method is ntlm, but requests_ntlm is not installed") - man_args = dict( + + session.auth = HttpNtlmAuth( username=self.username, - password=self.password + password=self.password, + send_cbt=self.send_cbt, ) - opt_args = dict( - send_cbt=self.send_cbt - ) - ntlm_args = self._get_args(man_args, opt_args, HttpNtlmAuth.__init__) - session.auth = HttpNtlmAuth(**ntlm_args) # check if requests_ntlm has the session_security attribute available for encryption encryption_available = hasattr(session.auth, 'session_security') # TODO: ssl is not exactly right here- should really be client_cert @@ -275,17 +267,13 @@ if not HAVE_CREDSSP: raise WinRMError("requests auth method is credssp, but requests-credssp is not installed") - man_args = dict( + session.auth = HttpCredSSPAuth( username=self.username, - password=self.password - ) - opt_args = dict( + password=self.password, disable_tlsv1_2=self.credssp_disable_tlsv1_2, auth_mechanism=self.credssp_auth_mechanism, minimum_version=self.credssp_minimum_version ) - credssp_args = self._get_args(man_args, opt_args, HttpCredSSPAuth.__init__) - session.auth = HttpCredSSPAuth(**credssp_args) encryption_available = True else: raise WinRMError("unsupported auth method: %s" % self.auth_method) @@ -355,24 +343,3 @@ else: response_text = response.content return response_text - - def _get_args(self, mandatory_args, optional_args, function): - argspec = set(inspect.getargspec(function).args) - function_args = dict() - for name, value in mandatory_args.items(): - if name in argspec: - function_args[name] = value - else: - raise Exception("Function %s does not contain mandatory arg " - "%s, check installed version with pip list" - % (str(function), name)) - - for name, value in optional_args.items(): - if name in argspec: - function_args[name] = value - else: - warnings.warn("Function %s does not contain optional arg %s, " - "check installed version with pip list" - % (str(function), name)) - - return function_args diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pywinrm-0.4.2/winrm/vendor/requests_kerberos/kerberos_.py new/pywinrm-0.4.3/winrm/vendor/requests_kerberos/kerberos_.py --- old/pywinrm-0.4.2/winrm/vendor/requests_kerberos/kerberos_.py 2021-05-10 23:39:20.000000000 +0200 +++ new/pywinrm-0.4.3/winrm/vendor/requests_kerberos/kerberos_.py 2022-04-14 06:09:29.000000000 +0200 @@ -98,7 +98,7 @@ else: # There's no need to re-compile this EVERY time it is called. Compile # it once and you won't have the performance hit of the compilation. - regex = re.compile('(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I) + regex = re.compile(r'(?:.*,)*\s*Negotiate\s*([^,]*),?', re.I) _negotiate_value.regex = regex authreq = response.headers.get('www-authenticate', None)
