Skip to content

Commit

Permalink
Fix commandline backends prefixing with host
Browse files Browse the repository at this point in the history
  • Loading branch information
jhollowe committed Nov 23, 2024
1 parent f239422 commit 5de7c1d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions proxmoxer/backends/command_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ def loads_errors(self, response):
class CommandBaseBackend:
def __init__(self):
self.session = None
self.target = ""
self.target = None

def get_session(self):
return self.session

def get_base_url(self):
return self.target
return ""

def get_serializer(self):
return JsonSimpleSerializer()
3 changes: 2 additions & 1 deletion proxmoxer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ def __init__(self, host=None, backend="https", service="PVE", **kwargs):
}

def __repr__(self):
return f"ProxmoxAPI ({self._backend_name} backend for {self._store['base_url']})"
dest = getattr(self._backend, "target", self._store.get("base_url"))
return f"ProxmoxAPI ({self._backend_name} backend for {dest})"

def get_tokens(self):
"""Return the auth and csrf tokens.
Expand Down
2 changes: 1 addition & 1 deletion tests/test_command_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def test_init(self):
b = command_base.CommandBaseBackend()

assert b.session is None
assert b.target == ""
assert b.target is None

def test_get_session(self):
assert self.backend.get_session() == self.sess
Expand Down

0 comments on commit 5de7c1d

Please sign in to comment.