5
5
from flask import Flask , jsonify , request , abort
6
6
app = Flask (__name__ )
7
7
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
10
10
)
11
11
12
12
def download_file (url ):
@@ -122,6 +122,9 @@ def on_receive_jenkins_poke():
122
122
123
123
create_symlink (source = os .path .join (untar_location , "vector" ), linkname = arg_symlink )
124
124
125
+ if arg_config_location :
126
+ create_symlink (source = arg_config_location , linkname = os .path .join (untar_location , "vector" , 'config.json' ))
127
+
125
128
return jsonify ({})
126
129
127
130
if __name__ == "__main__" :
@@ -154,6 +157,12 @@ def on_receive_jenkins_poke():
154
157
to the /vector directory INSIDE the tarball."
155
158
)
156
159
)
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
+ )
157
166
args = parser .parse_args ()
158
167
if args .jenkins .endswith ("/" ): # important for urljoin
159
168
arg_jenkins_url = args .jenkins
@@ -162,9 +171,10 @@ def on_receive_jenkins_poke():
162
171
arg_extract_path = args .extract
163
172
arg_should_clean = args .clean
164
173
arg_symlink = args .symlink
174
+ arg_config_location = args .config
165
175
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 " %
167
177
(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 )
169
179
)
170
180
app .run (host = "0.0.0.0" , port = args .port , debug = True )
0 commit comments