Skip to content

Commit 5c82769

Browse files
author
Viktoria
committed
Remove using paramiko
1 parent 6cb3a80 commit 5c82769

File tree

6 files changed

+93
-132
lines changed

6 files changed

+93
-132
lines changed

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"six>=1.9.0",
1313
"psutil",
1414
"packaging",
15-
"paramiko",
1615
"fabric",
1716
"sshtunnel"
1817
]

testgres/cache.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ def call_initdb(initdb_dir, log=logfile):
5757
# our initdb caching mechanism breaks this contract.
5858
pg_control = os.path.join(data_dir, XLOG_CONTROL_FILE)
5959
system_id = generate_system_id()
60-
os_ops.write(pg_control, system_id, truncate=True, binary=True, read_and_write=True)
60+
cur_pg_control = os_ops.read(pg_control, binary=True)
61+
new_pg_control = system_id + cur_pg_control[len(system_id):]
62+
os_ops.write(pg_control, new_pg_control, truncate=True, binary=True, read_and_write=True)
6163

6264
# XXX: build new WAL segment with our system id
6365
_params = [get_bin_path("pg_resetwal"), "-D", data_dir, "-f"]

testgres/operations/local_ops.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,12 @@ def touch(self, filename):
198198
with open(filename, "a"):
199199
os.utime(filename, None)
200200

201-
def read(self, filename, encoding=None):
202-
with open(filename, "r", encoding=encoding) as file:
203-
return file.read()
201+
def read(self, filename, encoding=None, binary=False):
202+
mode = "rb" if binary else "r"
203+
with open(filename, mode) as file:
204+
if binary:
205+
return file.read()
206+
return file.read().decode(encoding or 'utf-8')
204207

205208
def readlines(self, filename, num_lines=0, binary=False, encoding=None):
206209
"""

0 commit comments

Comments
 (0)