mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-09-30 03:57:51 +00:00
Hotfix: ssh root key adding
This commit is contained in:
parent
82b7f97dce
commit
8700642260
|
@ -98,12 +98,12 @@ class WriteSSHKey(Resource):
|
||||||
if "ssh" not in data:
|
if "ssh" not in data:
|
||||||
data["ssh"] = {}
|
data["ssh"] = {}
|
||||||
# Return 409 if key already in array
|
# Return 409 if key already in array
|
||||||
for key in data["ssh"]["rootSshKeys"]:
|
for key in data["ssh"]["rootKeys"]:
|
||||||
if key == public_key:
|
if key == public_key:
|
||||||
return {
|
return {
|
||||||
"error": "Key already exists",
|
"error": "Key already exists",
|
||||||
}, 409
|
}, 409
|
||||||
data["ssh"]["rootSshKeys"].append(public_key)
|
data["ssh"]["rootKeys"].append(public_key)
|
||||||
userdata_file.seek(0)
|
userdata_file.seek(0)
|
||||||
json.dump(data, userdata_file, indent=4)
|
json.dump(data, userdata_file, indent=4)
|
||||||
userdata_file.truncate()
|
userdata_file.truncate()
|
||||||
|
|
Loading…
Reference in a new issue