commit message from python script
This commit is contained in:
38
jenkins_modify_jobs/main.py
Normal file
38
jenkins_modify_jobs/main.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#! /usr/bin/env python3.10
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
def show_all_files_directory(dir_path = str, search_endung = False, search_string = False):
|
||||||
|
li_all = []
|
||||||
|
for root_folder, dirs, files in os.walk(dir_path, topdown=False):
|
||||||
|
for name in files:
|
||||||
|
FullPATH = str(os.path.join(root_folder, name))
|
||||||
|
if not search_endung is False:
|
||||||
|
if FullPATH.endswith(search_endung):
|
||||||
|
li_all.append(FullPATH)
|
||||||
|
elif not search_string is False:
|
||||||
|
if not FullPATH.find(search_string) == -1:
|
||||||
|
li_all.append(FullPATH)
|
||||||
|
else:
|
||||||
|
li_all.append(FullPATH)
|
||||||
|
return li_all
|
||||||
|
|
||||||
|
|
||||||
|
def modify_jenkins_configfile(config_file_list = list):
|
||||||
|
for config_file in config_file_list:
|
||||||
|
config_file_FullPath = config_file
|
||||||
|
print("open..." + config_file_FullPath)
|
||||||
|
with open(config_file_FullPath , "r") as read_config:
|
||||||
|
for line in read_config:
|
||||||
|
print(line.rstrip("\n"))
|
||||||
|
print("#" * len(config_file_FullPath))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
test = show_all_files_directory(dir_path=os.sep + "home" + os.sep + "jonnybravo" + os.sep + ".jenkins" + os.sep + "data" + os.sep + "jobs", search_string="config.xml")
|
||||||
|
modify_jenkins_configfile(config_file_list=test)
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user