[Home]

Summary:ASTERISK-25042: asterisk.conf options override command-line options.
Reporter:Corey Farrell (coreyfarrell)Labels:
Date Opened:2015-05-01 01:36:52Date Closed:2015-05-12 12:00:03
Priority:MinorRegression?
Status:Closed/CompleteComponents:Core/Configuration
Versions:SVN Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Command-line parameters are processed before {{asterisk.conf}} is read.  This causes asterisk to go against the expectation that any command-line options will override configured options.

For example, if your {{asterisk.conf}} contains:
{noformat}
[options]
verbose=0
debug=0
{noformat}

Then run {{asterisk -cvvvddd}}, you will see that your verbose and debug are set to 0:
{noformat}
*CLI> core set verbose 3
Console verbose was OFF and is now 3.
*CLI> core set debug 3
Core debug was OFF and is now 3.
{noformat}

A few exceptions exist, but for the most part if you set something in {{asterisk.conf}}, the equivalent command-line option will do nothing.

I'm fairly confident the current behaviour of Asterisk is wrong, but I'm not sure if it's OK to fix in 11/13.  I'm can patch this, I'd just like guidance on what versions it should be applied to.  The possible issue I can see is if an init script uses an unwanted option, and an admin has used {{asterisk.conf}} to override it.
Comments:By: Rusty Newton (rnewton) 2015-05-01 17:34:23.892-0500

Probably want to bring this up on the dev list to get a consensus on the preferred behavior.

I tend to agree with you that it would make the most sense if the command line options overrode asterisk.conf. If not, then we should add a warning printed when the command is run, or after Asterisk finishes booting on the CLI to make the user aware of what levels debug and verbose are being run at.

By: Corey Farrell (coreyfarrell) 2015-05-04 13:56:51.120-0500

My idea to fix this is to process the getopt loop twice.
# Use getopt to find {{-C asterisk.conf}}, {{-h}}, {{-V}}, maybe a few others.
# Read {{asterisk.conf}}.
# Reset optind, use getopt to retrieve overridden flags/settings.

By: Matt Jordan (mjordan) 2015-05-04 15:21:50.542-0500

While I agree with your interpretation, I think adjusting this in 11/13 would be a pretty large breaking change. If we decide to modify it, let's do it in master first, then discuss further if we want to do it in the existing branches.

By: Corey Farrell (coreyfarrell) 2015-05-07 09:38:16.746-0500

[~gtj] also expressed on IRC that this should be fixed in master only.

Since this is a breaking change I don't think further discussion about existing branches is needed.