Skip to content

Commit 4eb2bee

Browse files
Karthik KamurthyKarthik Kamurthy
authored andcommitted
Pull request quattor#132: AQUILONAQD-1225/Exclude_Ring1_From_RO_Batch
Merge in AQUILON_AQD/aqd from ~KAMURTHY/aqd:Bug/AQUILONAQD-1225/Exclude_Ring1_From_RO_Batch to master * commit '741b417d061f5d3e8028b8aab7b587255c20357a': AQUILONAQD-1225/Exclude_Ring1_From_RO_Batch
2 parents 676579a + 741b417 commit 4eb2bee

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

bin/aq.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,9 @@ def is_readonly(command):
317317
command.startswith('dump_'))
318318

319319

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+
322323
allow_override = False
323324
config = SafeConfigParser()
324325

@@ -329,8 +330,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
329330
config.read(conf_file)
330331
config_options = {}
331332
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):
334337
allow_override = True
335338
config_options = dict(config.items("readonly_batch"))
336339
if not auth_option and config.has_section("readonly"):
@@ -366,8 +369,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
366369

367370
# if a client config file is specified on command line
368371
# 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'))
371376
if globalOptions.get('aqconf'):
372377
globalOptions.update(get_default_opts(globalOptions.get('auth'),
373378
globalOptions.get('aqconf'),
@@ -386,10 +391,10 @@ def get_default_opts(auth_option, conf_file=None, readonly=None):
386391
default_aqservice = get_username()
387392

388393
if override_allowed:
389-
host = defaultOpts.get('aqhost')
394+
host = defaultOpts.get('aqhost') or os.environ.get('AQHOST', None)
390395
else:
391396
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
393398

394399
port = globalOptions.get('aqport') or os.environ.get('AQPORT', None) or \
395400
defaultOpts.get('aqport')

0 commit comments

Comments
 (0)