@@ -317,8 +317,9 @@ def is_readonly(command):
317
317
command .startswith ('dump_' ))
318
318
319
319
320
- def get_default_opts (auth_option , conf_file = None , readonly = None ):
321
-
320
+ def get_default_opts (auth_option , conf_file = None , readonly = None ,
321
+ globalopts_aqhost = None ):
322
+
322
323
allow_override = False
323
324
config = SafeConfigParser ()
324
325
@@ -329,8 +330,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
329
330
config .read (conf_file )
330
331
config_options = {}
331
332
if readonly and config .has_section ("readonly_batch" ) and \
332
- get_username () in config .get \
333
- ("readonly_batch" , "proids" ).split (',\n ' ):
333
+ get_username () in \
334
+ config .get ("readonly_batch" , "proids" ).split (',\n ' ) \
335
+ and (globalopts_aqhost == config .get ("readonly_auth" , "aqhost" )
336
+ or globalopts_aqhost is None ):
334
337
allow_override = True
335
338
config_options = dict (config .items ("readonly_batch" ))
336
339
if not auth_option and config .has_section ("readonly" ):
@@ -366,8 +369,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
366
369
367
370
# if a client config file is specified on command line
368
371
# that should overide env or default options.
369
- defaultOpts , override_allowed = get_default_opts (globalOptions .get ('auth' ),
370
- readonly = is_readonly (command ))
372
+ defaultOpts , override_allowed = \
373
+ get_default_opts (globalOptions .get ('auth' ),
374
+ readonly = is_readonly (command ),
375
+ globalopts_aqhost = globalOptions .get ('aqhost' ))
371
376
if globalOptions .get ('aqconf' ):
372
377
globalOptions .update (get_default_opts (globalOptions .get ('auth' ),
373
378
globalOptions .get ('aqconf' ),
@@ -386,10 +391,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
386
391
default_aqservice = get_username ()
387
392
388
393
if override_allowed :
389
- host = defaultOpts .get ('aqhost' )
394
+ host = defaultOpts .get ('aqhost' ) or os . environ . get ( 'AQHOST' , None )
390
395
else :
391
396
host = globalOptions .get ('aqhost' ) or os .environ .get ('AQHOST' , None ) or \
392
- defaultOpts .get ('aqhost' ) or default_aqhost
397
+ defaultOpts .get ('aqhost' ) or default_aqhost
393
398
394
399
port = globalOptions .get ('aqport' ) or os .environ .get ('AQPORT' , None ) or \
395
400
defaultOpts .get ('aqport' )
0 commit comments