Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable auto-naming of the /etc/auto.<mount> file. #105

Closed
bschonec opened this issue Mar 20, 2018 · 4 comments
Closed

Enable auto-naming of the /etc/auto.<mount> file. #105

bschonec opened this issue Mar 20, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@bschonec
Copy link
Contributor

It'd be nice to have the /etc/auto. file auto-named based on the name of the defined type, "mount."

autofs::mount { 'home':
mount => '/home',
mapfile => '/etc/auto.home',
mapcontents => ['* netapp.example.com//home/&'],
}

Since the name of the defined type in this instance is 'home' and the mapfile is '/etc/auto.home', it makes sense that leaving out $mapfile should imply that the $name of the defined type is also the name of the /etc/auto. file.

Leaving out $mapfile when instantiating the defined type just leaves out the file in /etc/auto.master.

@jcbollinger
Copy link
Contributor

jcbollinger commented Mar 20, 2018

Currently, autofs::mount permits $mapfile to be undefined (that is its default), which it interprets as an indication that no map file for the mount should be named in the master map, and no physical map file should be managed. And this is a bit strange, because there is $mapfile_manage to direct whether to manage a physical file, and specifying a map file in the master map is mandatory in all Autofs implementations I am familiar with. I think it is an historic quirk, possibly revolving around a now-obsolete mechanism for supporting the built-in -hosts map. On one hand, then, it would make sense to generate the map file name automatically from the autofs::mount title, as proposed.

On the other hand, however, the title already has a different, but similar use: it is the default value of the $mount parameter. It would be pretty tricky to serve both purposes at the same time, though I guess in principle it could be done by requiring that at least one of $mapfile and $mount always be given explicitly.

Personally, I would be inclined to go the other way: leave the title's significance alone, and make $mapfile mandatory. In fact, I wrote a note for myself earlier today to raise exactly that as an issue, and I still might do so.

@juniorsysadmin juniorsysadmin added the enhancement New feature or request label Mar 22, 2018
@dhollinger
Copy link
Member

@jcbollinger it's been a while. Any update to this?

@jcbollinger
Copy link
Contributor

@dhollinger, this feature request was filed against version 4 of the module, in which autofs::mount had broader responsibilities than it does now. I wrote my previous comment before working out the refactoring that went into version 5. In v5, autofs::mount manages only entries in the master map, not the corresponding map files. Its title is still used as the default for the mount parameter, and the mapfile parameter is now mandatory, per the alternative I suggested. On the other hand, map files are now managed by autofs::mapfile, which does default to using its title as the path to the file.

That does not mean that $autofs::mount::mapfile could not be made optional, prompting the map file name in the master map to be computed from the resource title. That would not take the exact form proposed here, however, because we still need to suppose that the title may be a path (to the mount point). We could trim off any leading directory part and build a map file name from the rest, but I am not inclined to do so because

  1. it would create a risk of hidden collisions,
  2. I prefer to see this particular data expressed explicitly in any case, to clearly connect autofs::mount resources with corresponding autofs::mapfile resources, and
  3. more generally, I prefer absence of a parameter to mean "this detail is unmanaged", as opposed to "Puppet will choose a value".

I make an exception to (3) for $autofs::mount::mount because that is the type's unique identifier. It would be the namevar if the type were a native one rather than a defined one, so its association with the title is natural.

Overall, then, my recommendation would be to close this request without further changes. The use of the title of autofs::mapfile can be considered a partial implementation, if you wish. I am not presently performing or planning any further work in this direction myself, and instead of the issue that I was considering filing in this area, I filed the several issues that were subsequently resolved in the v5 refactoring.

@dhollinger
Copy link
Member

@jcbollinger It's been a little over a week since your response. I'm going to follow your recommendation and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants