Fix command line arguments has lower priority than config file
*This bug happened because of how oslo is handling the order of command line *Make sure the command line parameter will always send last Change-Id: Ia106ce2bd2994c494a6c25039d92358eeb0abdb9 Closes-Bug: #1454111
This commit is contained in:
parent
4e699ce21b
commit
379c6eb85b
@ -157,9 +157,29 @@ def print_server_info():
|
||||
print('Launching server components %s...' % comp_str)
|
||||
|
||||
|
||||
def get_properly_ordered_parameters():
|
||||
"""In oslo it's important the order of the launch parameters.
|
||||
if --config-file came after the command line parameters the command
|
||||
line parameters are ignored.
|
||||
So to make user command line parameters are never ignored this method
|
||||
moves --config-file to be always first.
|
||||
"""
|
||||
args = sys.argv[1:]
|
||||
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == '--config-file' or arg.startswith('--config-file='):
|
||||
conf_file_value = args[args.index(arg) + 1]
|
||||
args.remove(conf_file_value)
|
||||
args.remove(arg)
|
||||
args.insert(0, arg)
|
||||
args.insert(1, conf_file_value)
|
||||
|
||||
return args
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
config.parse_args()
|
||||
config.parse_args(get_properly_ordered_parameters())
|
||||
|
||||
print_server_info()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user