-
Notifications
You must be signed in to change notification settings - Fork 264
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch to requests, add NTLM and kerberos delegation support
- Loading branch information
1 parent
41aa058
commit 1213eaf
Showing
15 changed files
with
429 additions
and
1,812 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
environment: | ||
global: | ||
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the | ||
# /E:ON and /V:ON options are not enabled in the batch script intepreter | ||
# See: http://stackoverflow.com/a/13751649/163740 | ||
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\scripts\\run_with_compiler.cmd" | ||
matrix: | ||
- PYTHON: "C:\\Python27" | ||
PYTHON_VERSION: "2.7.9" | ||
PYTHON_ARCH: "32" | ||
|
||
- PYTHON: "C:\\Python27-x64" | ||
PYTHON_VERSION: "2.7.9" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Python33" | ||
PYTHON_VERSION: "3.3.5" | ||
PYTHON_ARCH: "32" | ||
|
||
- PYTHON: "C:\\Python33-x64" | ||
PYTHON_VERSION: "3.3.5" | ||
PYTHON_ARCH: "64" | ||
|
||
- PYTHON: "C:\\Python34" | ||
PYTHON_VERSION: "3.4.3" | ||
PYTHON_ARCH: "32" | ||
|
||
- PYTHON: "C:\\Python34-x64" | ||
PYTHON_VERSION: "3.4.3" | ||
PYTHON_ARCH: "64" | ||
init: | ||
# Override default Python version/architecture | ||
- set PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH% | ||
- python -c "import platform; print('Python', platform.python_version(), platform.architecture()[0])" | ||
- if not exist %PYTHON%\\Scripts\\pip.exe curl https://bootstrap.pypa.io/get-pip.py | python | ||
|
||
install: | ||
- winrm set winrm/config/service/auth @{Basic="true"} | ||
- winrm set winrm/config/service @{AllowUnencrypted="true"} | ||
- "%WITH_COMPILER% pip install cffi coveralls" | ||
- pip install -r requirements.txt | ||
|
||
build: off # Do not run MSBuild, build stuff at install step | ||
|
||
build_script: | ||
- echo build_script | ||
|
||
test_script: | ||
# configure winrm envvars for tests | ||
- ps: | | ||
$ErrorActionPreference = "Stop" | ||
$env:WINRM_USERNAME=$($env:USERNAME) | ||
$env:WINRM_PASSWORD=[Microsoft.Win32.Registry]::GetValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", '') | ||
$env:WINRM_TRANSPORT="basic" | ||
$env:WINRM_ENDPOINT="http://localhost:5985/wsman" | ||
py.test -v --cov-report=term-missing --cov=. | ||
after_test: | ||
- echo after_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
:: To build extensions for 64 bit Python 3, we need to configure environment | ||
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: | ||
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) | ||
:: | ||
:: To build extensions for 64 bit Python 2, we need to configure environment | ||
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: | ||
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) | ||
:: | ||
:: 32 bit builds do not require specific environment configurations. | ||
:: | ||
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the | ||
:: cmd interpreter, at least for (SDK v7.0) | ||
:: | ||
:: More details at: | ||
:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows | ||
:: http://stackoverflow.com/a/13751649/163740 | ||
:: | ||
:: Author: Olivier Grisel | ||
:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ | ||
@ECHO OFF | ||
|
||
SET COMMAND_TO_RUN=%* | ||
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows | ||
|
||
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" | ||
IF %MAJOR_PYTHON_VERSION% == "2" ( | ||
SET WINDOWS_SDK_VERSION="v7.0" | ||
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( | ||
SET WINDOWS_SDK_VERSION="v7.1" | ||
) ELSE ( | ||
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" | ||
EXIT 1 | ||
) | ||
|
||
IF "%PYTHON_ARCH%"=="64" ( | ||
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture | ||
SET DISTUTILS_USE_SDK=1 | ||
SET MSSdk=1 | ||
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% | ||
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release | ||
ECHO Executing: %COMMAND_TO_RUN% | ||
call %COMMAND_TO_RUN% || EXIT 1 | ||
) ELSE ( | ||
ECHO Using default MSVC build environment for 32 bit architecture | ||
ECHO Executing: %COMMAND_TO_RUN% | ||
call %COMMAND_TO_RUN% || EXIT 1 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
[bdist_rpm] | ||
requires = python-xmltodict python-isodate | ||
|
||
[pytest] | ||
norecursedirs = .git .idea env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,30 @@ | ||
import re | ||
from __future__ import unicode_literals | ||
|
||
|
||
class WinRMWebServiceError(Exception): | ||
"""Generic WinRM SOAP Error""" | ||
pass | ||
|
||
|
||
class WinRMAuthorizationError(Exception): | ||
"""Authorization Error""" | ||
pass | ||
|
||
|
||
class WinRMWSManFault(Exception): | ||
"""A Fault returned in the SOAP response. The XML node is a WSManFault""" | ||
pass | ||
|
||
class WinRMError(Exception): | ||
""""Generic WinRM error""" | ||
code = 500 | ||
|
||
class WinRMTransportError(Exception): | ||
""""Transport-level error""" | ||
"""Unused- only here for backcompat on things that import it""" | ||
code = 500 | ||
|
||
def __init__(self, transport, message): | ||
self.transport = transport | ||
self.message = message | ||
|
||
def __str__(self): | ||
return '{0} {1}. {2}'.format(self.code, re.sub( | ||
'Error$', '', self.__class__.__name__), self.message) | ||
class WinRMOperationTimeoutError(Exception): | ||
""" | ||
Raised when a WinRM-level operation timeout (not a connection-level timeout) has occurred. This is | ||
considered a normal error that should be retried transparently by the client when waiting for output from | ||
a long-running process. | ||
""" | ||
code = 500 | ||
|
||
def __repr__(self): | ||
return "{0}(code={1}, transport='{2}', message='{3}')".format( | ||
self.__class__.__name__, self.code, self.transport, self.message) | ||
class AuthenticationError(WinRMError): | ||
"""Authorization Error""" | ||
code = 401 | ||
|
||
|
||
class UnauthorizedError(WinRMTransportError): | ||
"""Raise if the user is not authorized""" | ||
code = 401 | ||
class BasicAuthDisabledError(AuthenticationError): | ||
message = 'WinRM/HTTP Basic authentication is not enabled on remote host' | ||
|
||
|
||
class TimeoutError(WinRMTransportError): | ||
pass | ||
class InvalidCredentialsError(AuthenticationError): | ||
pass |
Oops, something went wrong.