diff --git a/LohnRechner/lohn_calc.py b/LohnRechner/lohn_calc.py
index c965c29..7a1c384 100644
--- a/LohnRechner/lohn_calc.py
+++ b/LohnRechner/lohn_calc.py
@@ -60,6 +60,7 @@ class steuer_rechner:
print("richtig")
elif my_input == 'y':
print("richtg eingabe y")
+ modify_data = steuer_rechner.modify_data(self, month="Okt", money=1231.12)
elif my_input == 'n':
print("raus")
break
diff --git a/jenkins/create_job from_template.py b/jenkins/create_job from_template.py
index d8a912f..4ff65c9 100644
--- a/jenkins/create_job from_template.py
+++ b/jenkins/create_job from_template.py
@@ -7,7 +7,7 @@ server = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', passw
user = server.get_whoami()
version = server.get_version()
#vars_für den Job
-job_name="test_4"
+job_name="test_5"
finish_config=job_name + "_config.xml"
git_url='https://gitea.schlaubistechtalk.de/JonnyBravo/test_play.git'
command_line='./test_play.yml'
diff --git a/jenkins/test_5_config.xml b/jenkins/test_5_config.xml
new file mode 100644
index 0000000..16fb769
--- /dev/null
+++ b/jenkins/test_5_config.xml
@@ -0,0 +1,43 @@
+
+
+
+ false
+
+
+ 2
+
+
+ https://gitea.schlaubistechtalk.de/JonnyBravo/test_play.git
+ e4acf1ed-a858-429d-b5a6-c149431563db
+
+
+
+
+ */master
+
+
+ false
+
+
+
+ true
+ false
+ false
+ false
+
+
+ H/2 * * * *
+ false
+
+
+ false
+
+
+ ./test_play.yml
+
+
+
+
+
+
+
diff --git a/jenkins_modify_jobs/main.py b/jenkins_modify_jobs/main.py
index 7f8c451..653450a 100644
--- a/jenkins_modify_jobs/main.py
+++ b/jenkins_modify_jobs/main.py
@@ -1,6 +1,11 @@
#! /usr/bin/env python3.10
-import os
+import jenkins, os
+
+import xml.etree.ElementTree as ET
+#connect
+server = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='113c3449636622439627ab1d51454fc07c')
+
def show_all_files_directory(dir_path = str, search_endung = False, search_string = False):
li_all = []
@@ -23,10 +28,9 @@ def show_all_directory(dir_path = str, search_endung = False, search_string = Fa
for root_folder, dirs, files in os.walk(dir_path, topdown=False):
for name in dirs:
FullPATH = str(os.path.join(root_folder, name))
- if name == search_string:
+ #print(name)
+ if not name.find(search_string) == -1:
li_all.append(FullPATH)
- print(FullPATH)
-
return li_all
@@ -39,12 +43,25 @@ def modify_jenkins_configfile(config_file_list = list):
print(line.rstrip("\n"))
print("#" * len(config_file_FullPath))
+def added_config_to_jenkins_xml(config_xml = str):
+ xml_root = ET.parse(config_xml).getroot()
+ xml_str = ET.tostring(xml_root, encoding='utf8', method='xml').decode()
+
+ for strategy in xml_root.findall('sources/data/jenkins.branch.BranchSource'):
+ value = strategy.get('id')
+ print(strategy.get('id'))
+ print(value)
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")
- test2 = show_all_directory(dir_path=os.sep + "home" + os.sep + "jonnybravo" + os.sep + ".jenkins" + os.sep + "data" + os.sep + "jobs", search_string="ansible_test")
+ find_folder = show_all_directory(dir_path=os.sep + "home" + os.sep + "jonnybravo" + os.sep + ".jenkins" + os.sep + "data" + os.sep + "jobs", search_string="mulit")
+ for config_file in find_folder:
+ file = config_file + os.sep + "config.xml"
+ print(file)
+ added_config_to_jenkins_xml(file)
#modify_jenkins_configfile(config_file_list=test)
+
if __name__ == "__main__":
main()
\ No newline at end of file
diff --git a/jenkins_modify_jobs/test.py b/jenkins_modify_jobs/test.py
new file mode 100644
index 0000000..62ee2a4
--- /dev/null
+++ b/jenkins_modify_jobs/test.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+import jenkins
+
+if __name__ == '__main__':
+ #server = Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='113c3449636622439627ab1d51454fc07c')
+ server = jenkins.Jenkins('https://man-dan-03:9443', username='JonnyBravo', password='113c3449636622439627ab1d51454fc07c')
+ job_config = server.get_job_config('mulit_pipeline')
+ #print(job_config)
+ #config=job.get_config()
+ old_config_part = """
+
+ """
+ new_config_part = """
+
+ """
+ new = job_config.replace(new_config_part, old_config_part)
+ server.reconfig_job('mulit_pipeline', new)
+ #new = config.replace('oldvalue', 'newvalue')
+ #job.update_config(new)
\ No newline at end of file