Skip to content

Commit 015dd1f

Browse files
authored
Merge pull request #149 from ana530/deletecomponent
kwargs bugfix
2 parents d331878 + 9a15510 commit 015dd1f

File tree

6 files changed

+31
-23
lines changed

6 files changed

+31
-23
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Changelog
22

33
Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) convention.
4+
5+
## [0.7.1] - 2023-01-10
6+
7+
### Bugfix
8+
9+
- Keyword arguments fixed, host -> databaseAddress and user -> username PR [#149] (https://github.com/datajoint/pharus/pull/149)
10+
411
## [0.7.0] - 2023-01-05
512

613
### Added
@@ -242,6 +249,7 @@ Observes [Semantic Versioning](https://semver.org/spec/v2.0.0.html) standard and
242249
- Support for DataJoint attribute types: `varchar`, `int`, `float`, `datetime`, `date`, `time`, `decimal`, `uuid`.
243250
- Check dependency utility to determine child table references.
244251

252+
[0.7.1]: https://github.com/datajoint/pharus/compare/0.7.0...0.7.1
245253
[0.7.0]: https://github.com/datajoint/pharus/compare/0.6.4...0.7.0
246254
[0.6.4]: https://github.com/datajoint/pharus/compare/0.6.3...0.6.4
247255
[0.6.3]: https://github.com/datajoint/pharus/compare/0.6.2...0.6.3

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ To start the API server, use the command:
2929

3030
.. code-block:: bash
3131
32-
PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml up -d
32+
PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml up -d
3333
3434
To stop the API server, use the command:
3535

3636
.. code-block:: bash
3737
38-
PHARUS_VERSION=0.7.0docker-compose -f docker-compose-deploy.yaml down
38+
PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml down
3939
4040
References
4141
----------

docker-compose-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml pull
2-
# PHARUS_VERSION=0.7.0 docker-compose -f docker-compose-deploy.yaml up -d
1+
# PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml pull
2+
# PHARUS_VERSION=0.7.1 docker-compose -f docker-compose-deploy.yaml up -d
33
#
44
# Intended for production deployment.
55
# Note: You must run both commands above for minimal outage

pharus/server.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def wrapper(**kwargs):
6868
if "database_host" in request.args:
6969
encoded_jwt = request.headers.get("Authorization").split()[1]
7070
connect_creds = {
71-
"host": request.args["database_host"],
72-
"user": jwt.decode(
71+
"databaseAddress": request.args["database_host"],
72+
"username": jwt.decode(
7373
encoded_jwt,
7474
crypto_serialization.load_der_public_key(
7575
b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode())
@@ -86,8 +86,8 @@ def wrapper(**kwargs):
8686
algorithms="RS256",
8787
)
8888
connection = dj.Connection(
89-
host=connect_creds["host"],
90-
user=connect_creds["user"],
89+
host=connect_creds["databaseAddress"],
90+
user=connect_creds["username"],
9191
password=connect_creds["password"],
9292
)
9393
return function(connection, **kwargs)
@@ -126,7 +126,7 @@ def api_version() -> str:
126126
Content-Type: application/json
127127
128128
{
129-
"version": "0.7.0"
129+
"version": "0.7.1"
130130
}
131131
132132
:statuscode 200: No error.
@@ -173,8 +173,8 @@ def login() -> dict:
173173
Accept: application/json
174174
175175
{
176-
"host": "tutorial-db.datajoint.io",
177-
"user": "user1",
176+
"databaseAddress": "tutorial-db.datajoint.io",
177+
"username": "user1",
178178
"password": "password1"
179179
}
180180
@@ -237,8 +237,8 @@ def login() -> dict:
237237
)
238238
time.sleep(1)
239239
connect_creds = {
240-
"host": request.args["database_host"],
241-
"user": jwt.decode(
240+
"databaseAddress": request.args["database_host"],
241+
"username": jwt.decode(
242242
auth_info["jwt"],
243243
crypto_serialization.load_der_public_key(
244244
b64decode(environ.get("PHARUS_OIDC_PUBLIC_KEY").encode())
@@ -256,12 +256,12 @@ def login() -> dict:
256256
)
257257
)
258258
connect_creds = request.json
259-
if connect_creds.keys() < {"host", "user", "password"}:
259+
if connect_creds.keys() < {"databaseAddress", "username", "password"}:
260260
return dict(error="Invalid Request, check headers and/or json body")
261261
try:
262262
dj.Connection(
263-
host=connect_creds["host"],
264-
user=connect_creds["user"],
263+
host=connect_creds["databaseAddress"],
264+
user=connect_creds["username"],
265265
password=connect_creds["password"],
266266
)
267267
except pymysql.err.OperationalError as e:
@@ -276,8 +276,8 @@ def login() -> dict:
276276
password=root_password,
277277
).query("FLUSH PRIVILEGES")
278278
dj.Connection(
279-
host=connect_creds["host"],
280-
user=connect_creds["user"],
279+
host=connect_creds["databaseAddress"],
280+
user=connect_creds["username"],
281281
password=connect_creds["password"],
282282
)
283283
else:

pharus/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
"""Package metadata."""
2-
__version__ = "0.7.0"
2+
__version__ = "0.7.1"

tests/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ def token(client):
2626
yield client.post(
2727
"/login",
2828
json=dict(
29-
host=getenv("TEST_DB_SERVER"),
30-
user=getenv("TEST_DB_USER"),
29+
databaseAddress=getenv("TEST_DB_SERVER"),
30+
username=getenv("TEST_DB_USER"),
3131
password=getenv("TEST_DB_PASS"),
3232
),
3333
).json["jwt"]
@@ -47,8 +47,8 @@ def group1_token(client, connection):
4747
yield client.post(
4848
"/login",
4949
json=dict(
50-
host=getenv("TEST_DB_SERVER"),
51-
user="group1",
50+
databaseAddress=getenv("TEST_DB_SERVER"),
51+
username="group1",
5252
password="group1",
5353
),
5454
).json["jwt"]

0 commit comments

Comments
 (0)