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

Fixes #14514: Add a generic method to add ACLs on a given file #939

Conversation

Fdall
Copy link
Contributor

@Fdall Fdall commented Mar 21, 2019

@@ -0,0 +1,192 @@
#####################################################################################
# Copyright 2013 Normation SAS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2019


}

body acl add_posix_acl(user_acls, group_acls, other_acls)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should got into the library.

# @parameter_constraint group "regex" : "^$|^(([A-z0-9._-]+|\\*):[+-=]r?w?x?,? *)+$"
# @parameter_constraint other "regex" : "^$|^[+-=^]r?w?x?$"
#
# @class_prefix permissions_add_acl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to chose between set and add (name vs. class/bundle name).

Will there be another method to overwrite ACLs?

# @description Verify that an ace is present on a file or directory.
# This method will append the given aces to the current POSIX ACLs of
# the target.
# @documentation The `permissions_*acl|ace_*` manage the POSIX ACL on files and directorieS.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add an example section with the resulting getfacl output?

# It can also be left blank to let the `Other` ACE unchanged.
#
# @parameter path Path of the file or directory
# @parameter recursive Recursive Should ACLs cleanup be recursive, "true" or "false" (defaults to "false")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should have

# @parameter_constraint recursive "select" : [ "", "true", "false" ]

@Fdall
Copy link
Contributor Author

Fdall commented Mar 22, 2019

Commit modified

@Fdall
Copy link
Contributor Author

Fdall commented Mar 22, 2019

Fixed to match the review, also found a bug when there were no report when no files at all could be determined from the entry path

Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome, but it is missing a test

"report" usebundle => _log_v3("No files could be found matching ${path}, add POSIX acl user:${user}, group:${group} and other:${other}", "${path}", "${old_class_prefix}", "${class_prefix}", @{args});

empty_acls.files_found::
"failure_${file_list}" usebundle => _classes_success("${inner_class_prefix[${file_list}]}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm quite confused there - should it be success or failure ? (the left hand side says failure, the right one says success)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the doc, it should be success (nothing to append), but i'd like it to be clear there

#
# ~~~~
#
# This method can not remove a given ACE, see here how the vagrant ACE is handled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vagrant ?

# * * matches any filename or directory at one level, e.g. *.cf will match all files in one directory that end in .cf but it won't search across directories. */*.cf on the other hand will look two levels deep.
# * ? matches a single letter
# * [a-z] matches any letter from a to z
# * {x,y,anything} will match x or y or anything.
Copy link
Member

@amousset amousset Mar 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`{x,y,anything}` (and also for others, it will be easier to read

@Fdall
Copy link
Contributor Author

Fdall commented Apr 5, 2019

Commit modified

4 similar comments
@Fdall
Copy link
Contributor Author

Fdall commented Apr 5, 2019

Commit modified

@Fdall
Copy link
Contributor Author

Fdall commented Apr 5, 2019

Commit modified

@Fdall
Copy link
Contributor Author

Fdall commented Apr 8, 2019

Commit modified

@Fdall
Copy link
Contributor Author

Fdall commented May 22, 2019

Commit modified

Copy link
Member

@ncharles ncharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for the test of PR

@Fdall Fdall force-pushed the ust_14514/add_a_generic_method_to_add_aces_on_a_given_file branch from 750b372 to 129c8b7 Compare May 22, 2019 08:12
@Fdall
Copy link
Contributor Author

Fdall commented May 22, 2019

PR rebased

@Fdall
Copy link
Contributor Author

Fdall commented May 22, 2019

Commit modified

@Normation-Quality-Assistant
Copy link
Contributor

This PR is not mergeable to upper versions.
Since it is "Ready for merge" you must merge it by yourself using the following command:
rudder-dev merge https://github.com/Normation/ncf/pull/939
-- Your faithful QA
Kant merge: "All our knowledge begins with the senses, proceeds then to the understanding, and ends with reason. There is nothing higher than reason."
(https://ci.normation.com/jenkins/job/merge-accepted-pr/10437/console)

@Fdall
Copy link
Contributor Author

Fdall commented May 23, 2019

OK, squash merging this PR

@Fdall Fdall force-pushed the ust_14514/add_a_generic_method_to_add_aces_on_a_given_file branch from 92ebf25 to ab30440 Compare May 23, 2019 13:30
@Fdall Fdall merged commit ab30440 into Normation:branches/rudder/5.0 May 23, 2019
@Fdall
Copy link
Contributor Author

Fdall commented May 23, 2019

OK, merging this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants