@@ -282,6 +282,24 @@ def __call__(self, server_url, job_id, output_dir):
282282 with open (self .conf_fp , 'U' ) as conf_file :
283283 config .readfp (conf_file )
284284
285+ # the plugin coupling protocoll can be set in three ways
286+ # 1. default is always "filesystem", i.e. first value in
287+ # _ALLOWED_PLUGIN_COUPLINGS. This is to be downward compatible.
288+ # 2. the plugin configuration can hold a section 'network' with an
289+ # option 'PLUGINCOUPLING'. For old config files, this might not
290+ # (yet) be the case. Therefore, we are double checking existance
291+ # of this section and parameter here.
292+ # 3. you can set the environment variable QIITA_PLUGINCOUPLING
293+ # Precedence is 3, 2, 1, i.e. the environment variable overrides the
294+ # other two ways.
295+ plugincoupling = self ._ALLOWED_PLUGIN_COUPLINGS [0 ]
296+ if config .has_section ('network' ) and \
297+ config .has_option ('network' , 'PLUGINCOUPLING' ):
298+ plugincoupling = config .get ('network' , 'PLUGINCOUPLING' )
299+ if 'QIITA_PLUGINCOUPLING' in environ .keys () and \
300+ environ ['QIITA_PLUGINCOUPLING' ] is not None :
301+ plugincoupling = environ ['QIITA_PLUGINCOUPLING' ]
302+
285303 qclient = QiitaClient (server_url , config .get ('oauth2' , 'CLIENT_ID' ),
286304 config .get ('oauth2' , 'CLIENT_SECRET' ),
287305 # for this group of tests, confirm optional
@@ -290,8 +308,7 @@ def __call__(self, server_url, job_id, output_dir):
290308 # from validating the server's cert using
291309 # certifi's pem cache.
292310 ca_cert = config .get ('oauth2' , 'SERVER_CERT' ),
293- plugincoupling = config .get ('network' ,
294- 'PLUGINCOUPLING' ))
311+ plugincoupling = plugincoupling )
295312
296313 if job_id == 'register' :
297314 self ._register (qclient )
0 commit comments