[enh] also check 'ynh_die' helper, as 'exit' command,…

…is used before system modifications.
This commit is contained in:
Moul 2016-11-15 13:46:07 +01:00
parent 468e6ff936
commit b89eb4c3e8

View file

@ -181,7 +181,7 @@ def check_verifications_done_before_modifying_system(script):
""" """
ex, i = 0, 0 ex, i = 0, 0
while i < len(script): while i < len(script):
if "exit" in script[i]: if "ynh_die" in script[i] or "exit" in script[i]:
ex = i ex = i
i += 1 i += 1
cmd = ("cp", "mkdir", "rm", "chown", "chmod", "apt-get", "apt", "service", cmd = ("cp", "mkdir", "rm", "chown", "chmod", "apt-get", "apt", "service",
@ -198,12 +198,12 @@ def check_verifications_done_before_modifying_system(script):
i += 1 i += 1
if ok == 0: if ok == 0:
print(c.FAIL + "✘ At line", ex + 1, print(c.FAIL + "✘ At line", ex + 1,
"'exit' command is executed with system modification before.") "'ynh_die' or 'exit' command is executed with system modification before.")
print("This system modification is an issue if a verification exit the script.") print("This system modification is an issue if a verification exit the script.")
print("You should move this verification before any system modification." + c.END) print("You should move this verification before any system modification." + c.END)
else: else:
print_right( print_right(
"Verifications (with exit commands) are done before any system modification.") "Verifications (with 'ynh_die' or 'exit' commands) are done before any system modification.")
if __name__ == '__main__': if __name__ == '__main__':
os.system("clear") os.system("clear")