From 9de1b66bcabb23e1f4715a0b47aba086e8e214ce Mon Sep 17 00:00:00 2001 From: jonnybravo Date: Mon, 6 Nov 2023 19:07:03 +0100 Subject: [PATCH] commit message from python script --- create_mygit_default_conf/main.py | 3 +-- jenkins/search_string_inFile.py | 25 +++++-------------------- play_with_sqllite/startegie.db | Bin 20480 -> 20480 bytes 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/create_mygit_default_conf/main.py b/create_mygit_default_conf/main.py index 22179e9..c4ef6b3 100755 --- a/create_mygit_default_conf/main.py +++ b/create_mygit_default_conf/main.py @@ -12,8 +12,7 @@ list_my_git_projects = [ "https://gitlab.com", "https:ubuntu:5000" ] -my_username = "jonnybravo" - +my_username = os.environ["USER"] if not os.path.exists(user_gitconfig): os.popen("touch " + user_gitconfig) diff --git a/jenkins/search_string_inFile.py b/jenkins/search_string_inFile.py index 9ae2b04..3121e26 100644 --- a/jenkins/search_string_inFile.py +++ b/jenkins/search_string_inFile.py @@ -1,33 +1,18 @@ #! /usr/bin/env python3 -import os - -def read_all_sub_Folder(target_folder = str, search_string = str): - key_liste = [] - for root, dirs, files in os.walk(target_folder, topdown=False, ): - for name in files: - if name == search_string: - FullPATH = str(os.path.join(root, name)) - #if FullPATH.endswith(".pub") is False :#and FullPATH.endswith("known_hosts") is False and FullPATH.endswith("authorized_keys") is False: - #if FullPATH. - key_liste.append({"FullPath": FullPATH, - "Name": name, - "Root": root, - "Folder": dirs}) - return key_liste +import my_search if __name__ == "__main__": search_jenkins_folder = "/home/jonnybravo/.jenkins/data/jobs" search_string = """./test_play.yml""" - for i in read_all_sub_Folder(target_folder=search_jenkins_folder, search_string="config.xml"): + for i_full in my_search.read_all_sub_Folder(target_folder=search_jenkins_folder, search_string="config.xml"): #print(i["FullPath"]) - with open(i["FullPath"], 'r') as file: + with open(i_full["FullPath"], 'r') as file: data = file.read() index = data.find(search_string) - print(index) if not index == -1: - print("Ist in file vorhanden", file, sep=" ") + print("Ist in file vorhanden", file.name, sep=" ") #data = data.replace('-1', '') - #with open(i["FullPath"], 'w') as file: + #with open(i["FullPath"], 'w') as file: # file.write(data) diff --git a/play_with_sqllite/startegie.db b/play_with_sqllite/startegie.db index 957e85a8565d1a59df810d2c01c8e4cb57dd9b76..267f00681ca21e2623eaf26dea4a9ae938ea2006 100644 GIT binary patch delta 61 zcmZozz}T>Wae}m<90LObD-gqgoCX4V*V`SaDn$L%kk$LkEehz^} J1`3N51OR3@48#Bc delta 61 zcmZozz}T>Wae}lUCj$cmD-go~`$QdMM$U~1n|T>oCyVe+V`SdEn$L%kk!AA_ehz^} J4g!l56aZZS4441_