Move md5sum implementation to fs_utils
Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
This commit is contained in:
parent
42ebe34da3
commit
9344c16b7c
@ -190,6 +190,13 @@ def diff(file, other_file):
|
||||
return output.stderr
|
||||
|
||||
|
||||
def md5sum(file, binary=True):
|
||||
output = TestRun.executor.run(f"md5sum {'-b' if binary else ''} {file}")
|
||||
if output.exit_code != 0:
|
||||
raise Exception(f"Md5sum command execution failed! {output.stdout}\n{output.stderr}")
|
||||
return output.stdout.split()[0]
|
||||
|
||||
|
||||
# For some reason separators other than '/' don't work when using sed on system paths
|
||||
# This requires escaping '/' in pattern and target string
|
||||
def escape_sed_string(string: str, sed_replace: bool = False):
|
||||
|
@ -21,11 +21,7 @@ class File(FsItem):
|
||||
return fs_utils.diff(str(self), str(other_file))
|
||||
|
||||
def md5sum(self, binary=True):
|
||||
output = TestRun.executor.run(
|
||||
f"md5sum {'-b' if binary else ''} {self.full_path}")
|
||||
if output.exit_code != 0:
|
||||
raise Exception(f"Md5sum command execution failed! {output.stdout}\n{output.stderr}")
|
||||
return output.stdout.split()[0]
|
||||
return fs_utils.md5sum(str(self), binary)
|
||||
|
||||
def read(self):
|
||||
return fs_utils.read_file(str(self))
|
||||
|
Loading…
Reference in New Issue
Block a user