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

[BUG] x509.private_key_managed states do not honor all file.managed arguments #58263

Open
TeddyAndrieux opened this issue Aug 21, 2020 · 2 comments
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@TeddyAndrieux
Copy link
Contributor

TeddyAndrieux commented Aug 21, 2020

Description

In the documentation, it's said for x509.private_key_managed salt states:

Any kwargs supported by file.managed are supported.

But it's wrong it only honors part of it

salt/states/x509.py:225:def _get_file_args(name, **kwargs):
salt/states/x509.py-226-    valid_file_args = [
salt/states/x509.py-227-        "user",
salt/states/x509.py-228-        "group",
salt/states/x509.py-229-        "mode",
salt/states/x509.py-230-        "makedirs",
salt/states/x509.py-231-        "dir_mode",
salt/states/x509.py-232-        "backup",
salt/states/x509.py-233-        "create",
salt/states/x509.py-234-        "follow_symlinks",
salt/states/x509.py-235-        "check_cmd",
salt/states/x509.py-236-    ]
salt/states/x509.py-237-    file_args = {}
salt/states/x509.py-238-    extra_args = {}
salt/states/x509.py-239-    for k, v in kwargs.items():
salt/states/x509.py-240-        if k in valid_file_args:
salt/states/x509.py-241-            file_args[k] = v
salt/states/x509.py-242-        else:
salt/states/x509.py-243-            extra_args[k] = v
salt/states/x509.py-244-    file_args["name"] = name
salt/states/x509.py-245-    return file_args, extra_args

Not sure every kwargs of file.managed are needed here but to me at least replace could be helpful if we do not want to replace the key when it already exists

(Right now as a workaround I use an unless: test -f "my_key_path" on my x509.private_key_managed state)

@dwoz
Copy link
Contributor

dwoz commented Sep 3, 2020

We need to look at this and try to make the state honor what the documentation says.

@dwoz dwoz added this to the Approved milestone Sep 3, 2020
@dwoz dwoz removed their assignment Sep 3, 2020
@sagetherage sagetherage added the severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around label Sep 17, 2020
@OrangeDog
Copy link
Contributor

try to make the state honor what the documentation says.

Or fix the documentation so it describes what the state actually does

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

4 participants