Add client with group

This commit is contained in:
Yvan E. Watchman 2022-07-01 12:18:52 +02:00
parent 66e5bee13d
commit 1bf29612dc
2 changed files with 9 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
urbackup_server_web_api_wrapper.egg-info/*
dist/urbackup-server-web-api-wrapper-*.zip
urbackup_api/__pycache__/*
# IDE
.idea

View File

@ -4,9 +4,7 @@ from urllib.parse import urlparse
from urllib.parse import urlencode
from base64 import b64encode
import hashlib
import socket
import shutil
import os
import binascii
import logging
from enum import Enum
@ -220,12 +218,15 @@ class urbackup_server:
"os": e_installer_os.value
})
def add_client(self, clientname):
def add_client(self, clientname, groupname=None):
if not self.login():
return None
ret = self._get_json("add_client", {"clientname": clientname})
data = {"clientname": clientname}
if groupname is not None:
data['group_name'] = groupname
ret = self._get_json("add_client", data)
if ret == None or "already_exists" in ret:
return None