forked from saratov/infra
proxmoxer: replace patches in single patch
This commit is contained in:
parent
970efb4b99
commit
390cfa18d3
@ -1,31 +0,0 @@
|
|||||||
commit 81b160cc62c7699badd06dba9c072dfa3fbe219d
|
|
||||||
Author: James Lin <jlin@Jamess-MacBook-Pro-2.local>
|
|
||||||
Date: Thu Nov 14 10:24:58 2019 +1300
|
|
||||||
|
|
||||||
added timeout settings for auth request
|
|
||||||
|
|
||||||
diff --git a/proxmoxer/backends/https.py b/proxmoxer/backends/https.py
|
|
||||||
index ad76a47..e96b822 100644
|
|
||||||
--- a/proxmoxer/backends/https.py
|
|
||||||
+++ b/proxmoxer/backends/https.py
|
|
||||||
@@ -38,9 +38,10 @@ class AuthenticationError(Exception):
|
|
||||||
|
|
||||||
|
|
||||||
class ProxmoxHTTPAuth(AuthBase):
|
|
||||||
- def __init__(self, base_url, username, password, verify_ssl=False):
|
|
||||||
+ def __init__(self, base_url, username, password, verify_ssl=False, timeout=5):
|
|
||||||
response_data = requests.post(base_url + "/access/ticket",
|
|
||||||
verify=verify_ssl,
|
|
||||||
+ timeout=timeout,
|
|
||||||
data={"username": username, "password": password}).json()["data"]
|
|
||||||
if response_data is None:
|
|
||||||
raise AuthenticationError("Couldn't authenticate user: {0} to {1}".format(username, base_url + "/access/ticket"))
|
|
||||||
@@ -122,7 +123,7 @@ class Backend(object):
|
|
||||||
if auth_token is not None:
|
|
||||||
self.auth = ProxmoxHTTPTokenAuth(auth_token, csrf_token)
|
|
||||||
else:
|
|
||||||
- self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl)
|
|
||||||
+ self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl, timeout)
|
|
||||||
self.verify_ssl = verify_ssl
|
|
||||||
self.mode = mode
|
|
||||||
self.timeout = timeout
|
|
@ -11,9 +11,7 @@ python27.pkgs.buildPythonPackage rec {
|
|||||||
sha256 = "145hvphvlzvwq6sn31ldnin0ii50blsapxz0gv2zx3grzp6x9hvh";
|
sha256 = "145hvphvlzvwq6sn31ldnin0ii50blsapxz0gv2zx3grzp6x9hvh";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [ ./show_reason_on_exceptions.patch ];
|
patches = [ ./proxmoxer.patch ];
|
||||||
patches = [ ./added_timeout_settings_for_auth_request.diff ];
|
|
||||||
patches = [ ./fix_pvesh_output_format_for_version_more_than_5.3.diff ];
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -1,9 +1,39 @@
|
|||||||
commit 60662c4891859ca1b6cf87d7068958d4f9dc7f21
|
--- a/proxmoxer/core.py 1970-01-01 04:00:01.000000000 +0400
|
||||||
Author: timansky <timansky@kolesa.team>
|
+++ b/proxmoxer/core.py 2018-10-29 15:21:20.241881023 +0400
|
||||||
Date: Wed Dec 18 16:04:56 2019 +0600
|
@@ -76,7 +76,7 @@
|
||||||
|
|
||||||
Fix pvesh output format for version > 5.3
|
if resp.status_code >= 400:
|
||||||
|
raise ResourceException("{0} {1}: {2}".format(resp.status_code, httplib.responses[resp.status_code],
|
||||||
|
- resp.content))
|
||||||
|
+ resp.reason))
|
||||||
|
elif 200 <= resp.status_code <= 299:
|
||||||
|
return self._store["serializer"].loads(resp)
|
||||||
|
|
||||||
|
diff --git a/proxmoxer/backends/https.py b/proxmoxer/backends/https.py
|
||||||
|
index ad76a47..e96b822 100644
|
||||||
|
--- a/proxmoxer/backends/https.py
|
||||||
|
+++ b/proxmoxer/backends/https.py
|
||||||
|
@@ -38,9 +38,10 @@ class AuthenticationError(Exception):
|
||||||
|
|
||||||
|
|
||||||
|
class ProxmoxHTTPAuth(AuthBase):
|
||||||
|
- def __init__(self, base_url, username, password, verify_ssl=False):
|
||||||
|
+ def __init__(self, base_url, username, password, verify_ssl=False, timeout=5):
|
||||||
|
response_data = requests.post(base_url + "/access/ticket",
|
||||||
|
verify=verify_ssl,
|
||||||
|
+ timeout=timeout,
|
||||||
|
data={"username": username, "password": password}).json()["data"]
|
||||||
|
if response_data is None:
|
||||||
|
raise AuthenticationError("Couldn't authenticate user: {0} to {1}".format(username, base_url + "/access/ticket"))
|
||||||
|
@@ -122,7 +123,7 @@ class Backend(object):
|
||||||
|
if auth_token is not None:
|
||||||
|
self.auth = ProxmoxHTTPTokenAuth(auth_token, csrf_token)
|
||||||
|
else:
|
||||||
|
- self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl)
|
||||||
|
+ self.auth = ProxmoxHTTPAuth(self.base_url, user, password, verify_ssl, timeout)
|
||||||
|
self.verify_ssl = verify_ssl
|
||||||
|
self.mode = mode
|
||||||
|
self.timeout = timeout
|
||||||
diff --git a/proxmoxer/backends/base_ssh.py b/proxmoxer/backends/base_ssh.py
|
diff --git a/proxmoxer/backends/base_ssh.py b/proxmoxer/backends/base_ssh.py
|
||||||
index da624d9..b3ba1b3 100644
|
index da624d9..b3ba1b3 100644
|
||||||
--- a/proxmoxer/backends/base_ssh.py
|
--- a/proxmoxer/backends/base_ssh.py
|
@ -1,11 +0,0 @@
|
|||||||
--- a/proxmoxer/core.py 1970-01-01 04:00:01.000000000 +0400
|
|
||||||
+++ b/proxmoxer/core.py 2018-10-29 15:21:20.241881023 +0400
|
|
||||||
@@ -76,7 +76,7 @@
|
|
||||||
|
|
||||||
if resp.status_code >= 400:
|
|
||||||
raise ResourceException("{0} {1}: {2}".format(resp.status_code, httplib.responses[resp.status_code],
|
|
||||||
- resp.content))
|
|
||||||
+ resp.reason))
|
|
||||||
elif 200 <= resp.status_code <= 299:
|
|
||||||
return self._store["serializer"].loads(resp)
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user