8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b389b80 commit f4071f2Copy full SHA for f4071f2
arango/database.py
@@ -42,6 +42,8 @@
42
PermissionListError,
43
PermissionResetError,
44
PermissionUpdateError,
45
+ ServerAvailableOptionsGetError,
46
+ ServerCurrentOptionsGetError,
47
ServerDetailsError,
48
ServerEchoError,
49
ServerEncryptionError,
@@ -1118,6 +1120,58 @@ def response_handler(resp: Response) -> Json:
1118
1120
1119
1121
return self._execute(request, response_handler)
1122
1123
+ def options(self) -> Result[Json]:
1124
+ """Return the currently-set server options (ArangoDB 3.12+)
1125
+
1126
+ As this API may reveal sensitive data about the deployment, it can only
1127
+ be accessed from inside the _system database. In addition, there is a
1128
+ policy control startup option --server.options-api that determines if and
1129
+ to whom the API is made available. This option can have the following
1130
+ values:
1131
+ - disabled: API is disabled.
1132
+ - jwt: API can only be accessed via superuser JWT.
1133
+ - admin: API can be accessed by admin users in the _system database only.
1134
+ - public: everyone with access to _system database can access the API.
1135
1136
+ :return: Server options.
1137
+ :rtype: dict
1138
+ """
1139
+ request = Request(method="get", endpoint="/_admin/options")
1140
1141
+ def response_handler(resp: Response) -> Json:
1142
+ if resp.is_success:
1143
+ result: Json = resp.body
1144
+ return result
1145
+ raise ServerCurrentOptionsGetError(resp, request)
1146
1147
+ return self._execute(request, response_handler)
1148
1149
+ def options_available(self) -> Result[Json]:
1150
+ """Return a description of all available server options (ArangoDB 3.12+)
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
+ - public: everyone with access to _system database can access the options API.
1161
1162
1163
1164
1165
+ request = Request(method="get", endpoint="/_admin/options-description")
1166
1167
1168
1169
1170
1171
+ raise ServerAvailableOptionsGetError(resp, request)
1172
1173
1174
1175
#######################
1176
# Database Management #
1177
arango/exceptions.py
@@ -722,6 +722,14 @@ class ServerEncryptionError(ArangoServerError):
722
"""Failed to reload user-defined encryption keys."""
723
724
725
+class ServerCurrentOptionsGetError(ArangoServerError):
726
+ """Failed to retrieve currently-set server options."""
727
728
729
+class ServerAvailableOptionsGetError(ArangoServerError):
730
+ """Failed to retrieve available server options."""
731
732
733
class ServerExecuteError(ArangoServerError):
734
"""Failed to execute raw JavaScript command."""
735
starter.sh
@@ -32,11 +32,10 @@ else
32
exit 1
33
fi
34
35
-conf_file=""
36
-if [[ "${version%.*}" == "3.10" ]]; then
37
- conf_file="${setup}-3.10"
+if [ "$version" == "latest" ]; then
+ conf_file="${setup}-3.12"
38
else
39
- conf_file="${setup}"
+ conf_file="${setup}-${version%.*.*}"
40
41
docker run -d \
tests/static/cluster.conf tests/static/cluster-3.11.conftests/static/cluster.conf renamed to tests/static/cluster-3.11.conf
tests/static/cluster-3.12.conf
@@ -0,0 +1,15 @@
1
+[starter]
2
+mode = cluster
3
+local = true
4
+address = 0.0.0.0
5
+port = 8528
6
7
+[auth]
8
+jwt-secret = /tests/static/keyfile
9
10
+[args]
11
+all.database.password = passwd
12
+all.database.extended-names = true
13
+all.log.api-enabled = true
14
+all.javascript.allow-admin-execute = true
15
+all.server.options-api = admin
tests/static/single.conf tests/static/single-3.11.conftests/static/single.conf renamed to tests/static/single-3.11.conf
tests/static/single-3.12.conf
@@ -0,0 +1,13 @@
+mode = single
tests/test_database.py
@@ -1,6 +1,7 @@
from datetime import datetime
import pytest
+from packaging import version
from arango.aql import AQL
from arango.backup import Backup
@@ -438,3 +439,12 @@ def test_license(sys_db, enterprise):
438
439
assert license == {"license": "none"}
440
with pytest.raises(ServerLicenseSetError):
441
sys_db.set_license("abc")
442
443
444
+def test_options(sys_db, db_version):
445
+ # Skip if below 3.12
446
+ if db_version < version.parse("3.12.0"):
447
+ pytest.skip("Database options require ArangoDB 3.12+")
448
449
+ assert sys_db.options()
450
+ assert sys_db.options_available()