|Summary:||ASTERISK-16019: [patch] Pretty Config Files|
|Reporter:||Andrew Latham (lathama)||Labels:|
|Date Opened:||2010-04-27 10:48:32||Date Closed:||2011-06-07 14:00:43|
|Environment:||Attachments:||( 0) config_cleanup.2.sh|
|Description:||As a feature here is a script that will clean up the config files. This is useful when users.conf and other files have been grown to large.|
****** ADDITIONAL INFORMATION ******
1. erase all blank lines
2. add line before any line with [
3. optionally remove all comments
|Comments:||By: Andrew Latham (lathama) 2010-04-27 10:50:50|
Propose this is added to "contrib/scripts"
By: Leif Madsen (lmadsen) 2010-04-27 10:51:46
Would you mind adding a few comments to the top of the file (and maybe beside the sed lines) indicating what the file is doing? This way when someone looks at the file it'll be clear to them what it was intended for. After that I'll merge it to the contrib/scripts/ directory. Thanks!
By: Andrew Latham (lathama) 2010-04-27 10:53:07
Yes that sounds like a wonderful idea (oops)..
By: Andrew Latham (lathama) 2010-04-27 10:57:08
By: Andrew Latham (lathama) 2010-04-27 10:58:49
With cron can resolve https://issues.asterisk.org/view.php?id=14509
By: Paul Belanger (pabelanger) 2010-04-27 13:07:42
I would suggest expanding this script to remove hard-coded values like /etc/asterisk and commented out code. Perhaps adding logic to pass arguments.
By: Andrew Latham (lathama) 2010-04-27 13:21:38
If the basic file is submitted it would be easy for any developer to submit diffs. I am sure that at some point in time this will be more complex. This works for me today.
By: Andrew Latham (lathama) 2010-04-27 16:48:21
added file to fix mistake with adding lines before a line with [
Correct action was to find a [ at the beginning of the line, not anywhere in the line.
By: Tzafrir Cohen (tzafrir) 2010-04-28 12:16:57
1. Please use /bin/sh
2. I wonder if it's possible to fix this issue in the code. Right now the script is over-aggressive: modifying all config files even if there's no need to. It will fail if you e.g. have a single read-only file there.
3. Furthermore, it would be slightly more effecient to have a single sed command:
sed -i -e 's/foo/bar/g' -e 's/aaa/bbb/g' *.conf
By: Andrew Latham (lathama) 2010-04-28 12:48:48
Noted... I added some comments about the intention in the file. This is meant for those integrators that choose to look at the config files.
By: Andrew Latham (lathama) 2010-04-29 11:09:33
Can someone remove the first three versions of the script. Any more comments on this in its simple form.
By: Paul Belanger (pabelanger) 2010-04-29 12:12:21
Done. Some work still needs to be done on this script before it can be excepted into /trunk.
By: Andrew Latham (lathama) 2010-04-29 12:43:24
This was intended as documentation or notes about how to do a task that I often run into. We can change this to a .txt and remove the #!/bin/sh if that is better.
I also need to ask a "Bug Marshall" about what needs done about predated submissions and the new license. I have some code submissions that predates the June 28 2007 date.
By: Leif Madsen (lmadsen) 2010-04-29 13:53:39
lathama: predated license button pressed :)
By: Andrew Latham (lathama) 2010-05-18 11:11:27
What should we do on this. I am happy with this as a script. I use it to clean up files during an installation. I would love to see this type of tool applied to the config engine but agree that it is very low priority.
I read in a ticket that as long as the config file can be parsed it is ok. I agree but sometimes want to use this script to help me trouble shoot a config against a config that is not working. Removing the comments really helps speed this issue.
An optional addition to the script would be to backup or to use some sort of change control like a rsync hardlink directory.
By: Leif Madsen (lmadsen) 2010-05-19 09:47:20
I'd like to see this script filled out a bit, along with some backup routine and some output of what is happening. I also think you should be able to specify a particular file (and not all *.conf files) to run this against. You also shouldn't assume that the configuration files are stored in /etc/asterisk as well (so I'd just remove that line and presume you're going to execute in the `pwd`)
If you make some of those changes then I think we'll be a lot closer to getting this into the contrib/scripts/ section, but as it stands now I think it's a bit too raw.
By: Paul Belanger (pabelanger) 2010-06-25 09:07:23
Suspending for now. Once your patch has been update as requested we can re-open the issue.
Suspended due to lack of activity. Please request a bug marshal in #asterisk-bugs on the IRC network irc.freenode.net to reopen the issue should you have the additional information requested.
Further information can be found at http://www.asterisk.org/developers/bug-guidelines