[augeas-devel] Re: Augeas save does not create directory when needed

David Lutterkort lutter at redhat.com
Thu Nov 20 08:15:13 UTC 2008


On Wed, 2008-11-19 at 13:00 +0100, Free Ekanayaka wrote:
> Hi David,
> 
> |--==> On Wed, 19 Nov 2008 12:48:52 +0100, David Lutterkort <lutter at redhat.com> said:
> 
>   DL> On Wed, 2008-11-19 at 12:22 +0100, Dominique Dumont wrote:
>   >>Hello
>   >>
>   >>When saving a file (in this case /etc/ssh/sshd_config), augeas is able
>   >>to create the sshd_file file, but not the ssh directory.
>   >>
>   >>Is that a feature or a bug ?
> 
>   DL> It's definitely a bug - what has kept me from fixing this is that I am
>   DL> not sure what ownership/mode to set on such newly created directories. 
> 
>   DL> The simplest would be to use teh current user/group and some default
>   DL> permission like 0755, though that might be way too open. The issue is
>   DL> logged as ticket #3 [1] - if you have any other suggestions, please add
>   DL> them to the ticket.
> 
> I would suggest creating the directory using the default umask values
> of the augeas process being executed, making no decision about
> ownership or permissions at all. Such choices would be entirely up to
> the user, which can get the desired effect by setting the proper umask
> and/or running augeas under a certain uid/gid.

In that case, wouldn't it be just as good to have users create needed
directories first, with the proper permissions/ownership ? It's much
less of a surprise than relying on defaults from the environment.

One relatively easy middle ground I can see is leaving the default
behavior as it is right now, and giving users the option to set defaults
for permissions/ownership ... by writing into special places
underneath /augeas. For example, look for entries @owner, @group, @mode,
and @secon in the tree undereath /augeas/save/mkdir; if any of these
exist, we'll create directories using whatever is in those entries or
reasonable defaults for those entries that are missing.

It's far from perfect, but more easily implementable than carrying
attributes for each dir in the tree.

Anybody want to work up a patch for that ?

David




More information about the augeas-devel mailing list