26 lines
669 B
Python
26 lines
669 B
Python
import random
|
|
import string
|
|
import subprocess
|
|
|
|
def run_successfull_cmd(command):
|
|
command = command.split()
|
|
output = subprocess.run(command, capture_output=True, encoding='UTF-8')
|
|
assert output.returncode == 0
|
|
return output.stdout
|
|
|
|
def gen_rand_name(max_name_len):
|
|
name_len = random.randint(3, max_name_len)
|
|
return ''.join(random.choice(string.ascii_letters) for x in range(name_len))
|
|
|
|
def check_log_string(log_file, search_str):
|
|
lines = ''
|
|
with open(log_file, 'r') as my_log:
|
|
lines = my_log.readlines()
|
|
for line in lines:
|
|
if search_str in line:
|
|
return True
|
|
|
|
print(lines)
|
|
return False
|
|
|