8 def check_execute(cmd, terminate_on_error=True):
10 Executes a shell commands and check for =! 0 return codes
13 print(
"Executing command '{}'".format(cmd))
15 print(
"Command '{}' exited with code {}".format(cmd, res))
17 print(
"FATAL: Exit code is not 0")
18 if terminate_on_error:
25 def check_path_exists(paths, terminate_on_error=True):
27 Checks if a path exists.
29 @param paths: list of file system path (directories or files)
30 @param terminate_on_error: if true, the execution is terminated if one part
36 print(
"Checking for existance of file {}".format(p))
37 if not os.path.exists(p):
38 print(
"Path {} does not exist".format(p))
39 if terminate_on_error:
44 def create_fake_scripts(folders, scriptname):
46 Creates a fake script inside a nested path
47 :param folders: folders to hold the script
48 :param scriptname: name of the script itself
51 if not os.path.exists(folders):
53 with open(os.path.join(folders, scriptname),
"w")
as f:
54 f.write(
"# not content on purpose")