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

Merge carlpett/salt-vault #39212

Merged
merged 1 commit into from
Feb 9, 2017

Conversation

carlpett
Copy link
Contributor

@carlpett carlpett commented Feb 7, 2017

What does this PR do?

This merges the repo carlpett/salt-vault which contains a separate implementation of Vault integration that was developed concurrently by @techhat with the existing implementation.

The approaches taken in the two implementations are slightly different, but old configuration should still be compatible with the merged code (albeit with deprecation warnings).

Note that this PR has an implicit dependency on #39174 for the sdb module to work, so it cannot be merged before that PR.

Since this is my first larger PR to salt: have I missed something? The linting mostly passes, for instance, do I need to suppress all the things I consider false positives, or are they mainly advisory?
Have I formatted the documentation correctly?

What issues does this PR fix or reference?

#27020

New Behavior

Vault policies are enforced when reading secrets. Supports state management of policies, and an execution module for CRUD operations.

Tests written?

No

@cachedout
Copy link
Contributor

@carlpett This won't merge cleanly. Could you please rebase it?

@techhat
Copy link
Contributor

techhat commented Feb 7, 2017

@carlpett it looks like you removed some references to the master, and SDB is definitely supposed to work on the master too.

@carlpett carlpett force-pushed the feature/vault-integration branch from b87cc13 to 3a2749e Compare February 8, 2017 15:41
@carlpett
Copy link
Contributor Author

carlpett commented Feb 8, 2017

@cachedout Ah, missed that there had been an documentation update after I forked. Rebased now.

@techhat Hm, I don't understand what you mean? Did I break some use case?

@cachedout
Copy link
Contributor

@carlpett Thanks for the rebase. There are two lint errors which also need to be resolved: https://jenkins.saltstack.com/job/PR/job/salt-pr-lint-n/8371/violations/file/salt/utils/vault.py/

@carlpett carlpett force-pushed the feature/vault-integration branch from 3a2749e to e5ecd8e Compare February 8, 2017 21:02
@carlpett
Copy link
Contributor Author

carlpett commented Feb 8, 2017

@cachedout Fixed those, one with a pylint disable, though - I feel that the two empty lines make that part a bit less clear. Subjective though, I suppose. Is this sort of suppress accepted, or should I add the newlines?

@cachedout
Copy link
Contributor

If you think it's in the interest of readability, I have no objection at all to the suppress statement. Thanks!

@carlpett
Copy link
Contributor Author

carlpett commented Feb 8, 2017

Great! Ok, so as soon as I've understood and fixed @techhat's comment this is good to go, then?

Copy link
Contributor

@cachedout cachedout left a comment

Choose a reason for hiding this comment

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

I think this is very well done. I have only one comment in-line.

raise salt.exceptions.CommandExecutionError(e)


def write_secret(path, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not like to have **kwargs accepted in execution modules because we like to document the possible arguments for the user. Is it possible to use explicit keyword arguments instead or is it the number of possible keywords too broad?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The kwargs are actually used to input the key/values to store in Vault, so they aren't actually arguments to the module itself. It just bundles them up into a dict and sends them on. For example, salt-call vault.write_secret "secret/my/secret" user="foo" password="bar". If I'd use vault.read_secret on the same path, I'd get back a dict {'user':'foo', 'password':'bar'}.

This could be changed to requiring a dict directly, e.g. salt-call vault.write_secret "secret/my/secret" data='{"user":"foo", "password":"bar"}, but it makes it somewhat clunkier, IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's fair. We do have a few places where this happens as well but we try to keep them as minimal as possible. Thanks for the explanation.

@cachedout cachedout merged commit a4fcdf3 into saltstack:develop Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants