-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Wide refactoring of master map and map file management #119
Wide refactoring of master map and map file management #119
Conversation
Performed a wide-reaching refactoring to relieve autofs::mount of the responsibility of managing map files. It now manages only entries in the master map. Created a new autofs::mapfile resource specific to managing map files, as autofs::map has the wrong structure for this. Created a new autofs::mapping resource to allow map file management to be performed collaboratively via multiple resources, as autofs::map is wrong for this, too. To look at it a different way, this refactoring takes the space covered by autofs::mount and autofs::map, and spreads it among a more targeted autofs::mount, and new autofs::mapfile and autofs::mapping. Autofs::map is deprecated, but not removed.
Added a notation to the main README file, describing the deprecation and planned future removal of the autofs::map resource type.
Implemented a variety of corrections to comply with the project's Puppet and Ruby style rules.
Fixed some issues that were revealed by failing CI tests and by the process of fixing those. Primarily, ensured that the Concat resource for the master map is always declared if any autofs::mount is declared, directly or indirectly. This is the original behavior, which had inadvertently been changed. Also tweaked the format of some tests that used the 'match' matcher, and changed the formats of a couple of resource titles.
A few of the previous style changes yielded new violations of project style rules. These violations are now fixed, too.
Fixed another newly-introduced style validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see any README.md updates that would be needed added.
Also, see my comments about the deprecation notices.
Otherwise, it looks great to me.
if $autofs::reload_command { | ||
Concat { | ||
before => Service[$autofs::service_name], | ||
notify => Exec['automount-reload'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not against using the Exec
resource for the time being to ensure the automount-reload is done correctly, I do think that if we need to rely on an Exec
resource, then it might be a good idea to investigate the potential need for a dedicated type/provider for the autofs
module relating to maps.
Especially now that the Resource API has been released and the Exec
resource is a hack that was put in place because the pre-Resource API types/providers code is not easy to implement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to replacing use of an Exec with an appropriate application of the resource API. In fact, I'm right with you in preferring to avoid Exec
s. This particular use is is just drawn straight from the approach taken by the previous version, however, and if you want to change that then I suggest making it a separate issue.
manifests/mount.pp
Outdated
Optional[Boolean] $execute = undef, # deprecated, no effect | ||
Optional[Boolean] $mapfile_manage = undef, # deprecated, no effect | ||
Optional[Variant[Array, String]] $mapcontents = undef, # deprecated, no effect | ||
Optional[Boolean] $replace = undef # deprecated, no effect |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the parameter has no effect, is it truly deprecated
or has it in reality already been removed?
I think it would be better in this case to just remove anything that no longer has an effect. As per SemVer standards, much of the work in this PR is backwards incompatible, so a major version release would be required anyway implying breaking changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working on that. As a related question, then, I suggest considering whether you want to retain autofs::map
. This PR retains it unchanged (but now undocumented). If you have in mind to make a clean break in the next major version, however, then it would perhaps be appropriate to remove it altogether.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I have pushed an update that removes the deprecated / ineffective parameters from autofs::mount
, fixes a couple of resulting test failures, and documents those removals in README.md
.
manifests/mount.pp
Outdated
if $mapfile.is_a(Autofs::Mapentry) and $mapfile_manage { | ||
fail("Parameter 'mapfile_manage' must be false for complicated 'mapfile' ${mapfile}") | ||
if $direct =~ NotUndef { | ||
deprecation('autofs::mount::direct', 'Parameter $autofs::mount::direct is deprecated and has no effect. Whether a map is direct is determined (by Autofs itself) by the mount point: specify $mount as \'/-\' for a direct map.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Line 84
manifests/mount.pp
Outdated
} else { | ||
$contents = "${mount} ${options}\n" | ||
if $execute =~ NotUndef { | ||
deprecation('autofs::mount::execute', 'Parameter $autofs::mount::execute is deprecated and has no effect. For a map implemented as an executable program, manage the map file via a File or similar resource.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Line 84
manifests/mount.pp
Outdated
$mapperms = '0755' | ||
$maptempl = 'autofs/auto.map.exec.erb' | ||
if $mapfile_manage =~ NotUndef { | ||
deprecation('autofs::mount::mapfile_manage', 'Parameter $autofs::mount::mapfile_manage is deprecated and has no effect. autofs::mount resources now manage only the master map, not map files') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Line 84
manifests/mount.pp
Outdated
$maptempl = 'autofs/auto.map.erb' | ||
|
||
if $mapcontents =~ NotUndef { | ||
deprecation('autofs::mount::mapcontents', 'Parameter $autofs::mount::mapcontents is deprecated and has no effect. Manage map contents via autofs::mapfile and autofs::mapping resources.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Line 84
manifests/mount.pp
Outdated
} | ||
|
||
if $replace =~ NotUndef { | ||
deprecation('autofs::mount::replace', 'Parameter $autofs::mount::replace is deprecated and has no effect. Use autofs::mapfile and autofs::mapping resources, or other resources of your choice, to manage map files') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment on Line 84
The README.md updates are already in there (for the other PR, too). Does it appear otherwise to you?
John
From: David Hollinger III [mailto:notifications@github.com]
Sent: Sunday, April 15, 2018 12:33 AM
To: voxpupuli/puppet-autofs <puppet-autofs@noreply.github.com>
Cc: Bollinger, John C <John.Bollinger@STJUDE.ORG>; Author <author@noreply.github.com>
Subject: Re: [voxpupuli/puppet-autofs] Wide refactoring of master map and map file management (#119)
@dhollinger requested changes on this pull request.
I would like to see any README.md updates that would be needed added.
Also, see my comments about the deprecation notices.
Otherwise, it looks great to me.
________________________________
In manifests/mapfile.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570632&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=ebEB%2FKPrN4oYBVW3Y3lcwSynB3vZyEl7QfBT%2BieYVy4%3D&reserved=0>:
+# @param replace Whether to replace the contents of any an existing file
+# at the specified path
+#
+define autofs::mapfile (
+ Enum['present', 'absent'] $ensure = 'present',
+ Stdlib::Absolutepath $path = $title,
+ Array[Autofs::Fs_mapping] $mappings = [],
+ Boolean $replace = true,
+) {
+ include '::autofs'
+
+ unless $::autofs::package_ensure == 'absent' {
+ if $autofs::reload_command {
+ Concat {
+ before => Service[$autofs::service_name],
+ notify => Exec['automount-reload'],
I'm not against using the Exec resource for the time being to ensure the automount-reload is done correctly, I do think that if we need to rely on an Exec resource, then it might be a good idea to investigate the potential need for a dedicated type/provider for the autofs module relating to maps.
Especially now that the Resource API has been released and the Exec resource is a hack that was put in place because the pre-Resource API types/providers code is not easy to implement.
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570669&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=oW%2B9FTeCTkLWlXzWpFHALlKXAyYusR8u7zO3GgDnG38%3D&reserved=0>:
Stdlib::Absolutepath $master = $autofs::auto_master_map,
Stdlib::Absolutepath $map_dir = '/etc/auto.master.d',
Boolean $use_dir = false,
- Boolean $direct = true,
- Boolean $execute = false,
- Boolean $mapfile_manage = true,
- Variant[Array, String] $mapcontents = [],
- Boolean $replace = true
+ Optional[Boolean] $direct = undef, # deprecated, no effect
+ Optional[Boolean] $execute = undef, # deprecated, no effect
+ Optional[Boolean] $mapfile_manage = undef, # deprecated, no effect
+ Optional[Variant[Array, String]] $mapcontents = undef, # deprecated, no effect
+ Optional[Boolean] $replace = undef # deprecated, no effect
If the parameter has no effect, is it truly deprecated or has it in reality already been removed?
I think it would be better in this case to just remove anything that no longer has an effect. As per SemVer standards, much of the work in this PR is backwards incompatible, so a major version release would be required anyway implying breaking changes.
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570681&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=YEbWYT0Qlor9cb9ob43tswiDDBD1sKov%2BDOiuCkjMo8%3D&reserved=0>:
) {
include '::autofs'
- if $mapfile.is_a(Autofs::Mapentry) and $mapfile_manage {
- fail("Parameter 'mapfile_manage' must be false for complicated 'mapfile' ${mapfile}")
+ if $direct =~ NotUndef {
+ deprecation('autofs::mount::direct', 'Parameter $autofs::mount::direct is deprecated and has no effect. Whether a map is direct is determined (by Autofs itself) by the mount point: specify $mount as \'/-\' for a direct map.')
See comment on Line 84<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%2Ffiles%23diff-efcf3c9d761cfe69cdad70eea09a8062R84&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=SBdOgRqO8PF5ylV6OSXeLv3ofygCdf2zeG2xZoeZDa8%3D&reserved=0>
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570684&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=1vGvWSynVe5BxWmPXU0HbfL9dhqLBIN4D5jqgwatkFQ%3D&reserved=0>:
}
- if $mapfile {
- $contents = "${mount} ${mapfile} ${options}\n"
- } else {
- $contents = "${mount} ${options}\n"
+ if $execute =~ NotUndef {
+ deprecation('autofs::mount::execute', 'Parameter $autofs::mount::execute is deprecated and has no effect. For a map implemented as an executable program, manage the map file via a File or similar resource.')
See comment on Line 84<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%2Ffiles%23diff-efcf3c9d761cfe69cdad70eea09a8062R84&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=SBdOgRqO8PF5ylV6OSXeLv3ofygCdf2zeG2xZoeZDa8%3D&reserved=0>
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570686&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=uN8YxIUDFiOkI9PvPhJ0N7jIaEqBVksarOV3l3Umybs%3D&reserved=0>:
}
- if $execute {
- $mapperms = '0755'
- $maptempl = 'autofs/auto.map.exec.erb'
+ if $mapfile_manage =~ NotUndef {
+ deprecation('autofs::mount::mapfile_manage', 'Parameter $autofs::mount::mapfile_manage is deprecated and has no effect. autofs::mount resources now manage only the master map, not map files')
See comment on Line 84<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%2Ffiles%23diff-efcf3c9d761cfe69cdad70eea09a8062R84&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=SBdOgRqO8PF5ylV6OSXeLv3ofygCdf2zeG2xZoeZDa8%3D&reserved=0>
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570688&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=%2BPa2NyMfiV70dbZuXjLKLL5BIlyLOLiw4Osl8cPa%2FGU%3D&reserved=0>:
}
- else {
- $mapperms = '0644'
- $maptempl = 'autofs/auto.map.erb'
+
+ if $mapcontents =~ NotUndef {
+ deprecation('autofs::mount::mapcontents', 'Parameter $autofs::mount::mapcontents is deprecated and has no effect. Manage map contents via autofs::mapfile and autofs::mapping resources.')
See comment on Line 84<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%2Ffiles%23diff-efcf3c9d761cfe69cdad70eea09a8062R84&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=SBdOgRqO8PF5ylV6OSXeLv3ofygCdf2zeG2xZoeZDa8%3D&reserved=0>
________________________________
In manifests/mount.pp<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23discussion_r181570692&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=EDBaEVWdZpn7QEQhm3fk5SenJ3npg7dQVoPDkZBKr4o%3D&reserved=0>:
}
- else {
- $mapperms = '0644'
- $maptempl = 'autofs/auto.map.erb'
+
+ if $mapcontents =~ NotUndef {
+ deprecation('autofs::mount::mapcontents', 'Parameter $autofs::mount::mapcontents is deprecated and has no effect. Manage map contents via autofs::mapfile and autofs::mapping resources.')
+ }
+
+ if $replace =~ NotUndef {
+ deprecation('autofs::mount::replace', 'Parameter $autofs::mount::replace is deprecated and has no effect. Use autofs::mapfile and autofs::mapping resources, or other resources of your choice, to manage map files')
See comment on Line 84<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%2Ffiles%23diff-efcf3c9d761cfe69cdad70eea09a8062R84&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=SBdOgRqO8PF5ylV6OSXeLv3ofygCdf2zeG2xZoeZDa8%3D&reserved=0>
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvoxpupuli%2Fpuppet-autofs%2Fpull%2F119%23pullrequestreview-112226298&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=UFrn8sPoiuDpRbsADiAhY8kLCMJDUgDo3hSHs0sK518%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADgP0Xchi8cbLEPAOcUuTPPJ8Uk99lb2ks5tottxgaJpZM4TOkjo&data=01%7C01%7CJohn.Bollinger%40StJude.org%7C290f49c22e734d77f7f508d5a2924ad0%7C22340fa892264871b677d3b3e377af72%7C0&sdata=Anbs5NON6w%2BMwAdR8FP14BDkyiK8VKtzh7TNYPlIGB4%3D&reserved=0>.
…________________________________
Email Disclaimer: www.stjude.org/emaildisclaimer
Consultation Disclaimer: www.stjude.org/consultationdisclaimer
|
I somehow missed the README changes |
@jcbollinger Did you take a look at the other changes I requested? |
The several parameters of autofs::mount that had been made ineffective and and flagged with deprecation warnings are now removed altogether. Most of these were related to map file management, which autofs::mount no longer does. The removals are documented in README.md, and they required a few adjustments to test code and data. Took the opportunity to clean some unused cruft out of the test data.
I thought I had already commented to this effect, but maybe I mistakenly attached that to the other PR. Apologies, then, if you get this twice, but I have committed changes that remove the deprecated The |
Pull Request (PR) description
A broadly-scoped refactoring of the features for managing the master map and individual map files. There are two key thrusts to this refactoring:
To reduce -- but not eliminate! -- the backward incompatibilities produced by this refactoring, several parameters of autofs::mount are retained but deprecated and made ineffective, and the whole autofs::map defined type is deprecated, though it still works as much as it ever did. The new map file manage approach relies on two new defined types:
autofs::mapfile
andautofs::fs_mapping
. The former is responsible for managing the overall properties and optionally some or all of the content of one map file. whereas the latter manages additional mappings in a map file. Thus,autofs::mapfile
takes on responsibilities that used to belong some toautofs::mount
and some toautofs::map
; the rest of the responsibilities of those types stay withautofs::mount
on one hand and are taken on byautofs::fs_mapping
on the other.This refactoring also takes the opportunity to implement more detailed map file structure, assuming the Sun map file format that was the only one for which the old version was willing to manage mapfile content anyway. This is done in a manner that handles typical cases cleanly, but does not foreclose the more complex and esoteric alternatives supported by that format.
It should be noted that this refactoring "fixes" issue #104 by removing support for directly managing executable maps. This is no big change, however, because it appears that the module never did handle executable maps correctly, issue 104 notwithstanding. It would set executable map file modes, but it would not configure the corresponding master map entries to treat such files as programs, so (as far as I can determine) the file mode was irrelevant.
This Pull Request (PR) fixes the following issues
Fixes #103
Fixes #104
Fixes #107