Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.

Commit 9bf52a6

Browse files
Ben Bonenfantclaytonlemons
andauthored
v7.1.2 release (#396)
* b64 decode the server_cas string when parsing a config file (#394) * Fix tests from base64 bug fix (#395) * update changelog and version Co-authored-by: Clayton Lemons <[email protected]>
1 parent 35b0cd0 commit 9bf52a6

File tree

4 files changed

+47
-34
lines changed

4 files changed

+47
-34
lines changed

CHANGELOG.md

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

3+
## 7.1.2 (2022-03-16)
4+
- Fix bug where server CAs were not expected to be b64encoded within the pachctl config file.
5+
36
## 7.1.1 (2022-02-04)
47
- Update protobuf files to v2.0.5
58
- Fix bug where only 20MiB of data could be retrieved with `client.get_file`

src/python_pachyderm/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import json
3+
from base64 import b64decode
34
from pathlib import Path
45
from typing import TextIO
56
from urllib.parse import urlparse
@@ -413,7 +414,9 @@ def _parse_config(config):
413414
host = u.hostname
414415
port = u.port
415416
tls = u.scheme == "grpcs" or u.scheme == "https"
416-
root_certs = bytes(root_certs, "utf-8") if root_certs is not None else None
417+
root_certs = (
418+
b64decode(bytes(root_certs, "utf-8")) if root_certs is not None else None
419+
)
417420

418421
return host, port, pachd_address, auth_token, root_certs, transaction_id, tls
419422

tests/test_client.py

Lines changed: 39 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import io
22
import os
33
import json
4+
from base64 import b64encode
45
from pathlib import Path
56

67
import pytest
@@ -11,38 +12,39 @@
1112

1213

1314
def test_check_config_order(mocker):
15+
server_cas = b64encode(b"foo").decode()
1416
env_config = json.loads(
15-
"""
16-
{
17-
"v2": {
17+
f"""
18+
{{
19+
"v2": {{
1820
"active_context": "local",
19-
"contexts": {
20-
"local": {
21+
"contexts": {{
22+
"local": {{
2123
"pachd_address": "grpcs://172.17.0.6:30650",
22-
"server_cas": "foo",
24+
"server_cas": "{server_cas}",
2325
"session_token": "bar",
2426
"active_transaction": "baz"
25-
}
26-
}
27-
}
28-
}
27+
}}
28+
}}
29+
}}
30+
}}
2931
"""
3032
)
3133
spout_config = json.loads(
32-
"""
33-
{
34-
"v2": {
34+
f"""
35+
{{
36+
"v2": {{
3537
"active_context": "local",
36-
"contexts": {
37-
"local": {
38+
"contexts": {{
39+
"local": {{
3840
"pachd_address": "[::1]:80",
39-
"server_cas": "foo",
41+
"server_cas": "{server_cas}",
4042
"session_token": "bar",
4143
"active_transaction": "baz"
42-
}
43-
}
44-
}
45-
}
44+
}}
45+
}}
46+
}}
47+
}}
4648
"""
4749
)
4850
local_config = json.loads(
@@ -97,6 +99,9 @@ def test_check_config_order(mocker):
9799

98100

99101
def test_parse_config():
102+
server_cas = b"foo"
103+
server_cas_base64 = b64encode(server_cas)
104+
100105
(
101106
host,
102107
port,
@@ -114,21 +119,22 @@ def test_parse_config():
114119
"contexts": {
115120
"local": {
116121
"pachd_address": "grpcs://172.17.0.6:30650",
117-
"server_cas": "foo",
122+
"server_cas": "%s",
118123
"session_token": "bar",
119124
"active_transaction": "baz"
120125
}
121126
}
122127
}
123128
}
124129
"""
130+
% server_cas_base64.decode()
125131
)
126132
)
127133
assert host == "172.17.0.6"
128134
assert port == 30650
129135
assert pachd_address == "grpcs://172.17.0.6:30650"
130136
assert auth_token == "bar"
131-
assert root_certs == b"foo"
137+
assert root_certs == server_cas
132138
assert transaction_id == "baz"
133139
assert tls is True
134140

@@ -271,22 +277,23 @@ def test_client_new_from_config():
271277
)
272278

273279
# check that pachd address and other context fields are respected
280+
server_cas = b64encode(b"foo").decode()
274281
client = python_pachyderm.Client.new_from_config(
275282
config_file=io.StringIO(
276-
"""
277-
{
278-
"v2": {
283+
f"""
284+
{{
285+
"v2": {{
279286
"active_context": "local",
280-
"contexts": {
281-
"local": {
287+
"contexts": {{
288+
"local": {{
282289
"pachd_address": "grpcs://172.17.0.6:30650",
283-
"server_cas": "foo",
290+
"server_cas": "{server_cas}",
284291
"session_token": "bar",
285292
"active_transaction": "baz"
286-
}
287-
}
288-
}
289-
}
293+
}}
294+
}}
295+
}}
296+
}}
290297
"""
291298
)
292299
)

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"pachyderm": "2.0.5",
3-
"python-pachyderm": "7.1.1",
3+
"python-pachyderm": "7.1.2",
44
"kubernetes": "1.21.0",
55
"minikube": "1.22.0"
66
}

0 commit comments

Comments
 (0)