From f74e2f8abbc55ed693de43dedef602ecc565cdd7 Mon Sep 17 00:00:00 2001 From: John Hollowell Date: Fri, 22 May 2020 16:53:17 -0400 Subject: [PATCH] Update proxmoxer to 1.1.0 (#35951) --- CODEOWNERS | 2 +- .../components/proxmoxve/__init__.py | 21 +++++++------------ .../components/proxmoxve/manifest.json | 4 ++-- requirements_all.txt | 2 +- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 20336249168..fcc8edf7710 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -312,7 +312,7 @@ homeassistant/components/plugwise/* @laetificat @CoMPaTech @bouwew homeassistant/components/plum_lightpad/* @ColinHarrington homeassistant/components/point/* @fredrike homeassistant/components/powerwall/* @bdraco @jrester -homeassistant/components/proxmoxve/* @k4ds3 +homeassistant/components/proxmoxve/* @k4ds3 @jhollowe homeassistant/components/ps4/* @ktnrg45 homeassistant/components/ptvsd/* @swamp-ig homeassistant/components/push/* @dgomes diff --git a/homeassistant/components/proxmoxve/__init__.py b/homeassistant/components/proxmoxve/__init__.py index 315fb8b1c91..0919feb15e3 100644 --- a/homeassistant/components/proxmoxve/__init__.py +++ b/homeassistant/components/proxmoxve/__init__.py @@ -1,7 +1,6 @@ """Support for Proxmox VE.""" from enum import Enum import logging -import time from proxmoxer import ProxmoxAPI from proxmoxer.backends.https import AuthenticationError @@ -137,25 +136,21 @@ class ProxmoxClient: self._connection_start_time = None def build_client(self): - """Construct the ProxmoxAPI client.""" + """Construct the ProxmoxAPI client. Allows inserting the realm within the `user` value.""" + + if "@" in self._user: + user_id = self._user + else: + user_id = f"{self._user}@{self._realm}" self._proxmox = ProxmoxAPI( self._host, port=self._port, - user=f"{self._user}@{self._realm}", + user=user_id, password=self._password, verify_ssl=self._verify_ssl, ) - self._connection_start_time = time.monotonic() - def get_api_client(self): - """Return the ProxmoxAPI client and rebuild it if necessary.""" - - connection_age = time.monotonic() - self._connection_start_time - - # Workaround for the Proxmoxer bug where the connection stops working after some time - if connection_age > 30 * 60: - self.build_client() - + """Return the ProxmoxAPI client.""" return self._proxmox diff --git a/homeassistant/components/proxmoxve/manifest.json b/homeassistant/components/proxmoxve/manifest.json index 2735bab1b04..4040ca7c469 100644 --- a/homeassistant/components/proxmoxve/manifest.json +++ b/homeassistant/components/proxmoxve/manifest.json @@ -2,6 +2,6 @@ "domain": "proxmoxve", "name": "Proxmox VE", "documentation": "https://www.home-assistant.io/integrations/proxmoxve", - "codeowners": ["@k4ds3"], - "requirements": ["proxmoxer==1.0.4"] + "codeowners": ["@k4ds3", "@jhollowe"], + "requirements": ["proxmoxer==1.1.0"] } diff --git a/requirements_all.txt b/requirements_all.txt index fc3645a3880..d2f63a96407 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1115,7 +1115,7 @@ prometheus_client==0.7.1 protobuf==3.6.1 # homeassistant.components.proxmoxve -proxmoxer==1.0.4 +proxmoxer==1.1.0 # homeassistant.components.systemmonitor psutil==5.7.0