community.general icon indicating copy to clipboard operation
community.general copied to clipboard

Add --equal equivalent to sefcontext

Open dithotxgh opened this issue 3 years ago • 13 comments

SUMMARY

Add the ability to idempotently add and remove an fcontext equivalence, mirroring the 'semanage fcontext --equal' operations.

This operation requires a bogus setype, or even a valid one for that matter, as the value is unused, and I did not want to make the conditional change to AnsibleModule(... setype=dict(type='str', required=True), ...

New tests were added to tests/integration/targets/sefcontext/tasks/sefcontext.yml.

During testing it was discovered that deletions using 'semanage fcontext' do not work for an individual equivalence deletion, only --deleteall, which blows out ALL local settings. This makes this module an improvement over the command line tools in this case.

This should address https://github.com/ansible-collections/community.general/issues/1193

Signed-off-by: Doug Maxey [email protected]

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

community.general.sefcontext

dithotxgh avatar Aug 25 '22 12:08 dithotxgh

cc @dagwieers click here for bot help

ansibullbot avatar Aug 25 '22 12:08 ansibullbot

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

plugins/modules/system/sefcontext.py:0:0: doc-default-does-not-match-spec: Argument 'equiv' in argument_spec defines default as (None) but documentation defines default as ('None')

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

plugins/modules/system/sefcontext.py:0:0: doc-default-does-not-match-spec: Argument 'equiv' in argument_spec defines default as (None) but documentation defines default as ('None')

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

plugins/modules/system/sefcontext.py:0:0: doc-default-does-not-match-spec: Argument 'equiv' in argument_spec defines default as (None) but documentation defines default as ('None')

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

plugins/modules/system/sefcontext.py:0:0: doc-default-does-not-match-spec: Argument 'equiv' in argument_spec defines default as (None) but documentation defines default as ('None')

click here for bot help

ansibullbot avatar Aug 25 '22 12:08 ansibullbot

Docs Build 📝

This PR is closed and any previously published docsite has been unpublished.

github-actions[bot] avatar Aug 25 '22 12:08 github-actions[bot]

Please hold off on moving this forward while I investigate an issue outside the testcase,

Re-ran the testcases to see if I missed it there, but all still pass.

Am getting a 'KeyError: equiv' traceback running this in production. Debugging it now.

dithotxgh avatar Aug 26 '22 04:08 dithotxgh

Please hold off on moving this forward while I investigate an issue outside the testcase,

Re-ran the testcases to see if I missed it there, but all still pass.

Am getting a 'KeyError: equiv' traceback running this in production. Debugging it now.

Aha. Due to pathing, was picking up an older modules version with the bug, fixed in the latest. So there is no error when using the correct current version.

So the hold is not needed.

dithotxgh avatar Aug 26 '22 05:08 dithotxgh

FYI: Testing environment is current ansible 2.12.2 on rhel 8 and 9.

dithotxgh avatar Aug 26 '22 06:08 dithotxgh

Other than the adjustments pointed by @felixfontein , it LGTM

russoz avatar Sep 05 '22 11:09 russoz

Please note this also requires a changelog fragment. Looks like I forgot to mention that in my first review :)

felixfontein avatar Sep 05 '22 19:09 felixfontein

I was making a contribution, that appears to have violated your idea of what makes a valid contribution.

Quibbles over style stopping the benefit of the contribution are on you.

I don't care that you make editorial changes if necessary to align with your worldview. My part is done.

dithotxgh avatar Sep 10 '22 05:09 dithotxgh

Your contribution seems to be quite valid, however this community is keen to maintain the documentation up to date and consistent, and that includes nits like formatting, punctuation and what not. Other than that, we only suggested an improvement in the code that makes it simpler and more readable. You seem to have taken the comments as personal offenses, but we make that kind of adjustments to all contributions.

You are free to let this PR die as it is. I think it would be a shame, but if that's your choice, that's how it's going to be.

russoz avatar Sep 10 '22 08:09 russoz

Nope, nothing personal, Just an observation.

If your process does not allow minor editorial changes, it's broken.

dithotxgh avatar Sep 10 '22 19:09 dithotxgh

The process allows it, of course. But this is a community: "our" community (you included), not "yours" or "mine" as your language points to. People volunteer time to this work, they don't have to do the editorial work dumped upon them, especially when it comes paired with passive-aggressive rhetoric. A different tone might have got you much further in gathering other people's help.

russoz avatar Sep 10 '22 23:09 russoz

Please update the PR according to the review comments. Otherwise we will close it eventually. Thanks.

needs_info

felixfontein avatar Oct 01 '22 20:10 felixfontein

@dithotxgh This pullrequest is waiting for your response. Please respond or the pullrequest will be closed.

click here for bot help

ansibullbot avatar Nov 02 '22 06:11 ansibullbot

Please note that in #5461 the collection repository was restructured to remove the directory tree in plugins/modules/, and the corresponding tree in tests/unit/plugins/modules/. Your PR modifies files in this directory structure, and unfortunately now has some conflicts, potentially because of this. Please rebase with the current main branch to remove the conflicts.

felixfontein avatar Nov 03 '22 05:11 felixfontein

@dithotxgh You have not responded to information requests in this pullrequest so we will assume it no longer affects you. If you are still interested in this, please create a new pullrequest with the requested information.

click here for bot help

ansibullbot avatar Dec 02 '22 19:12 ansibullbot