-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Option for create nfs exported directory #186
base: master
Are you sure you want to change the base?
Option for create nfs exported directory #186
Conversation
5eb710c
to
4916df4
Compare
@bschonec Can you please rebase your branch? |
b2e91e8
to
a164ebe
Compare
@Tux, sure thing. I'm not sure where I should put the tests for the directory (not) creation. There are a lot of places in the tests where it does "ensure directory." I only need to test for "not ensure directory." Should I just create a simple nfsv4/nfsv3 section and do a "not ensure directory" and not test for anything else? |
manifests/functions/create_export.pp
Outdated
mode => $mode, | ||
selinux_ignore_defaults => true, | ||
if $create_dir { | ||
filepath { $name: |
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.
Why the switch of file
into filepath
? That's not relevant when it comes to creating the folder or not and there is another PR for this change.
I would argue that this module almost never should create this folder as that normally is the responsibility of another module. I think it would be even worse to let it create an entire path ...
It would be a breaking change, but I would consider setting $create_dir default to false.
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.
Please stay with file for now. Besides this: there are two implementations for creating recursive directories: filepath and dirtrtee. We should have this change in a separate PR so we can check and review which module is the better one to use.
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.
And the module it self has this https://github.com/voxpupuli/puppet-nfs/blob/master/manifests/functions/mkdir.pp :)
1a9fa3c
to
79e32d1
Compare
manifests/server/export.pp
Outdated
@@ -57,7 +57,9 @@ | |||
# @param v4_export_name | |||
# @param nfsv4_bindmount_enable | |||
# | |||
# @examples |
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.
please re-add the @examples
strings tag.
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.
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 think it should be @example
, and it's is a tag used by puppet strings to render an example in REFERENCE.md
See https://www.puppet.com/docs/puppet/8/puppet_strings.html
It should be moved below the last @param
at line 65
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.
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.
No need to have another PR. please fix it here and please keep in mind that the code example must be indented by 2 spaces.
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've fixed it here but I have no idea what you're referring to when you say, "...code example must be indented by 2 spaces."
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.
@bschonec the example should have a description, then the example code. The code should be indented two spaces, so there should be three spaces after the hash mark #
. Examples: https://github.com/search?q=repo%3Avoxpupuli%2Fpuppet-systemd%20%40example&type=code
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.
Tag was readded. This is OK for me. We can solve this conversation.
6e9b743
to
bcf5d29
Compare
9582efa
to
a77b94a
Compare
I'm having trouble figuring out where to put the "if create_dir = true" tests. Should the test be in defines/server_export_spec.rb or in classes/nfs_spec.rb? |
manifests/functions/create_export.pp
Outdated
if $create_dir { | ||
file { $name: | ||
ensure => directory, | ||
owner => $owner, | ||
group => $group, | ||
mode => $mode, | ||
} |
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.
Given it will not manage the resource, I suggest to name the new param manage
rather than create
(i.e. the file resource create a non-existing directory but also ensure owner, group, permissions, etc).
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 $create_dir is true (which is the default) then the directory is managed. Or am misunderstanding your comment? My use case here is that I have a 3rd party application that expects the directory to be absent. The application install will fail if the directory is created but I still have to export the directory via NFS. This solves the problem of exporting the directory but not being required to create the directory/export.
My pull request doesn't change the default behavior of creating the directory.
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.
Sorry to be unclear, I am suggesting naming the parameter manage_dir
rather than create_dir
.
Or manage_directory
as bytes are cheap nowadays 😄
Because if you set manage_directory => false
and you put the wrong owner / group on the directory you created by hand, puppet will not fix this because it does not manage that directory.
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.
Changed per your recommendations. Thanks.
a16a483
to
1ca9169
Compare
manifests/functions/create_export.pp
Outdated
@@ -15,13 +15,18 @@ | |||
# @param mode | |||
# Sets the permissions of the exported directory. | |||
# | |||
# @param create_dir | |||
# Boolean. Create the directory to be exported. |
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.
nit, but the type and default get added when you build Reference.md
using puppet-strings, so both should be omitted here. You might want to reword it to something along the lines of:
# Boolean. Create the directory to be exported. | |
# Whether or not to create the directory to be exported. |
(and then remove line 20 entirely).
manifests/server/export.pp
Outdated
@@ -47,6 +47,10 @@ | |||
# @param v4_export_name | |||
# @param nfsv4_bindmount_enable | |||
# | |||
# @param create_dir | |||
# Boolean. Create the directory to be exported. | |||
# Defaults to true. |
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.
same feedback as the other parameter with generated docs.
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.
Changed per your recommendations. Thanks.
c7b2fdb
to
7499141
Compare
7499141
to
e057306
Compare
I have a case where an application I'm installing expects that the folders to be exported via NFS do NOT exist at application install time.
This PR allows for the edge case where you don't want to create the directories but you do want to manage the NFS export file(s).