55from flask import Flask , jsonify , request , abort
66app = Flask (__name__ )
77
8- arg_jenkins_url , arg_extract_path , arg_should_clean , arg_symlink = (
9- None , None , None , None
8+ arg_jenkins_url , arg_extract_path , arg_should_clean , arg_symlink , arg_config_location = (
9+ None , None , None , None , None
1010)
1111
1212def download_file (url ):
@@ -122,6 +122,9 @@ def on_receive_jenkins_poke():
122122
123123 create_symlink (source = os .path .join (untar_location , "vector" ), linkname = arg_symlink )
124124
125+ if arg_config_location :
126+ create_symlink (source = arg_config_location , linkname = os .path .join (untar_location , "vector" , 'config.json' ))
127+
125128 return jsonify ({})
126129
127130if __name__ == "__main__" :
@@ -154,6 +157,12 @@ def on_receive_jenkins_poke():
154157 to the /vector directory INSIDE the tarball."
155158 )
156159 )
160+ parser .add_argument (
161+ "--config" , dest = "config" , help = (
162+ "Write a symlink to config.json in the extracted tarball. \
163+ To this location."
164+ )
165+ )
157166 args = parser .parse_args ()
158167 if args .jenkins .endswith ("/" ): # important for urljoin
159168 arg_jenkins_url = args .jenkins
@@ -162,9 +171,10 @@ def on_receive_jenkins_poke():
162171 arg_extract_path = args .extract
163172 arg_should_clean = args .clean
164173 arg_symlink = args .symlink
174+ arg_config_location = args .config
165175 print (
166- "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s" %
176+ "Listening on port %s. Extracting to %s%s. Symlinking to %s. Jenkins URL: %s. Config location: %s " %
167177 (args .port , arg_extract_path ,
168- " (clean after)" if arg_should_clean else "" , arg_symlink , arg_jenkins_url )
178+ " (clean after)" if arg_should_clean else "" , arg_symlink , arg_jenkins_url , arg_config_location )
169179 )
170180 app .run (host = "0.0.0.0" , port = args .port , debug = True )
0 commit comments