[Home]

Summary:ASTERISK-02858: [patch] "make samples" always overwrites current configuration
Reporter:Edwin Groothuis (mavetju)Labels:
Date Opened:2004-11-19 03:20:18.000-0600Date Closed:2004-11-25 13:22:36.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) patch-Makefile
( 1) patch-Makefile
Description:"make samples" in the asterisk directory always overwrites the current configuration. Not happy, but thanks to CVS we can restore this :-)



****** ADDITIONAL INFORMATION ******

It would be nicer if "make samples" would install the configs as .sample, for example: /etc/asterisk/iax.conf.sample.

That way it's safe to do "make samples" (which is always a good thing) and it's easy to add changes because all you have to do is add these *.sample files to CVS and do a "cvs diff -u" after you've installed a new version. That way new lines and changes in defaults are spotted and can be put in the live configuration files.

Patch attached fixes the samples and adsi targets to install the configs as .sample and only to create the real .conf file when it doesn't exist yet.
Comments:By: Mark Spencer (markster) 2004-11-19 09:06:59.000-0600

That's the way it's *supposed* to work (that way you can "start over" easily) but I've added a new "OVERWRITE" option to give you the ability to make it work the way you want it to.  Feel free to reopen if that's not what you were looking for:

make OVERWRITE=n samples

Mark

By: Russell Bryant (russell) 2004-11-19 11:06:24.000-0600

I like Mark's idea.

not included in 1.0

By: Edwin Groothuis (mavetju) 2004-11-19 18:35:27.000-0600

Thanks for this adjustment in the samples target, but it doesn't resolve the initial issues:

- The default behaviour is to overwrite. Be conservative, don't overwrite live configuration files unless the user asks for it.[1]

- There is no way to find out about changes in the default configuration files, so new default settings will not be picked up and brought back into the live configuration files.[2]

[1] Running "make samples" twice in a row (for whatever reason) will currently erase the current configuration files.

[2] If this was done, I would have found out about lsswitch in extensions.conf and timezone in iax2.conf and updated my live configuration files with the right values for it.

By: Mark Spencer (markster) 2004-11-20 01:47:26.000-0600

> - The default behaviour is to overwrite. Be conservative, don't overwrite live > configuration files unless the user asks for it.[1]

I will stick with the existing behavior for compatibility in this regard.

> - There is no way to find out about changes in the default configuration
> files, so new default settings will not be picked up and brought back into the
> live configuration files.[2]

Not so, actually you can do:
cvs -q diff -u -D "1 week ago" configs

We would not want, obviously, in the general case for default settings to be picked up and brought into the live configuration.

> [1] Running "make samples" twice in a row (for whatever reason) will currently > erase the current configuration files.

I don't think this is a problem that needs to be addressed, but just in case, I made it so it won't overwrite a file with the same thing.

> [2] If this was done, I would have found out about lsswitch in extensions.conf
> and timezone in iax2.conf and updated my live configuration files with the
> right values for it.

Let me suggest that you sign up for the cvs commit mailing list.

By: Edwin Groothuis (mavetju) 2004-11-20 05:59:51.000-0600

If you don't want to change the current behaviour (no matter what I think about it), please allow then this solution: instead of modifying the samples-target, add a new target (safe-samples in this patch) which does do the same as the previous patch I submitted but without messing up backwards compatibility.

The samples-target is split in two parts: the part which installs the conf-files and a new target which installs the sound files. The safe-samples-target installs the conf-files and calls the target for the sound files. So no unnecessary duplication of code.

By: Mark Spencer (markster) 2004-11-22 14:07:27.000-0600

I don't think I understand what you want.  The only difference is you're copying them in with the .sample extension remaining?  What purpose does that serve?

By: Anthony Minessale (anthm) 2004-11-22 16:02:07.000-0600

I don't think it's the make process's job to merge in examples either.
but how bout make barebones-config to install just what it takes to
get asterisk to start (modest extensions.conf and some of the basic configs)

some other interesting semi-related possibilities would be

auto-reload => app_module.so
auto-reload => all

so you can map what modules to automaticly reload when reload is issued in modules.conf


And for that matter a make.modules file that lists all the
modules you want to build with a modest default for basic operation
(so many apps these days no need to compile them all)


Just brainstorming ...

edited on: 11-22-04 16:02

edited on: 11-22-04 16:03

By: Edwin Groothuis (mavetju) 2004-11-23 21:29:51.000-0600

<i>The only difference is you're copying them in with the .sample extension remaining? What purpose does that serve?</i>

When I install Asterisk version 1.0, I get virgin version 1.0 *.conf configuration files in /etc/asterisk. I made changes to them (configure them so to say), extend extensions.conf and fix zapata.conf to suit my needs.

Now I install Asterisk version 1.1 over it, and I get virgin version 1.1 *.conf configuration files in /etc/asterisk. All the changes I have made are gone.

With the first patch I submitted, "make samples" would by an upgrade only create the *.conf files if they didn't exist yet and install the virgin *.conf files as *.conf.sample. The advantages are that "make samples" doesn't overwrite the current configuration files; it automatically installs new configuration files; and it keeps a copy of the virgin configuration file as *.conf.sample files so you can always see what the default settings are (if you're like me somebody who wants to keep their live configurations files clean) and you can, if you use CVS, always diff between the sample configuration files installed newly and installed before and adjust your live configuration files when new features are introduced or when default values are changed.

So to summarize the actions:
- Current configuration files are not overwritten
- New configuration files are added automatically
- Virgin configuration files are installed as .sample

And the advantages:
- Default behaviour is conservative, no accidents from the users side
- New configuration files are added automatically
- You can see what is changed in the history of the virgin configuration files

By: Mark Spencer (markster) 2004-11-23 22:59:50.000-0600

+ If you would like to install the sample   +
+ configuration files (overwriting any      +
+ existing config files), run:              +
+                                           +
+               make samples                +

I think that language is pretty clear.  Your changes aren't gone anyway, they're there in the .old versions of those files, just in case, and now even doing it twice will not remove the older version.  Unless your config files are in CVS (including sample files) you can't see the differences.  And if you wanted to see the differences you could use CVS to do it anyway based on the CVS tree you have checked out.

You haven't convinced me yet, but I'll give you one more shot before I close this out with a "won't fix".

By: Edwin Groothuis (mavetju) 2004-11-24 00:37:29.000-0600

<i>before I close this out with a "won't fix".</i>

Go ahead, if you're still not seeing what I try to explain then there is no hope for this case.

By: Mark Spencer (markster) 2004-11-24 21:22:40.000-0600

Okay well hopefully thc changes I've already made will be helpful enough.