(trivial) Give notice about invalid modules#3261
(trivial) Give notice about invalid modules#3261joshcooper merged 2 commits intopuppetlabs:masterfrom
Conversation
|
Waiting for CLA signature by @radford @radford - We require a Contributor License Agreement (CLA) for people who contribute to Puppet, but we have an easy click-through license with instructions, which is available at https://cla.puppetlabs.com/ Note: if your contribution is trivial and you think it may be exempt from the CLA, please post a short reply to this comment with details. http://docs.puppetlabs.com/community/trivial_patch_exemption.html |
|
CLA signed by all contributors. |
|
@andersonmills please take a look. Thanks! |
lib/puppet/node/environment.rb
Outdated
There was a problem hiding this comment.
Puppet.log_exception(e) is preferred so that if puppet is running with --trace it will show the backtrace leading up to the exception.
f1eb86f to
4430b90
Compare
|
@radford thanks for the contribution! This makes a lot of sense. Can you add a ticket at tickets.puppetlabs.com and reference it in the commit message? (This doesn't meet our criteria for "trivial" since it does change behavior (in a good way) so it'll be nice to have it tracked as a ticket.) Thanks!! |
|
From triage:
|
|
I'd be grateful if the commit message could give some more insight on how this end is achieved. |
|
Hi @ffrank and @kylog, I think I can address the triviality and the how at the same time. The patch adds a logging message, which is explicitly covered in TPE Policy and then filters "." and ".." which would otherwise lead to superfluous warnings but were ignored anyway beforehand. There is no practical change other than the addition of a useful warning. |
|
I'll admit that I'm a little edgy on the control flow change and I feel it warrants at least some explanation. While you're at it, could you change the (trivial) tag to (maint)? |
Give notice when a module on the modulepath is invalid, explaining why. To do this cleanly, we stop trying to add "." and ".." as modules since these are always invalid.
module_references contains Hashes so there is no need to look for strings within it, especially when the next line does what this one was supposed to do.
4430b90 to
33c0571
Compare
|
@ffrank, along with changing the tag, I split the patch into three to provide separate motivations for each change. |
|
Awesome, thanks! |
|
👍 |
|
@radford thanks for updating the PR. I have a few comments:
|
33c0571 to
4430b90
Compare
|
@joshcooper, 1,2) I removed the |
4430b90 to
96a82f3
Compare
|
@radford I don't follow your logic about, "to check that the exception is logged would be to decide that catching this error and continuing is a good idea to begin with and I don't think it is." We write tests to verify that the system behaves as expected, not whether or not we agree with the behavior. |
|
I think there is a misunderstanding here. "Adding a test" refers to test cases in |
|
@ffrank, I understand what you were asking for in a test, but to me tests should check that something is happening the way that it should. @joshcooper, the question is what should happen in this code? What I haven't gleaned from any of your responses is what was this code trying to do? And what should it do?
So, @joshcooper, what I'm saying is that I will not enshrine the current behavior in a test because I don't think it is doing the correct thing. I don't know what the correct thing is, but what I am certain about is that hiding the exception is wrong. To that effect this patch is a Band Aid that should be applied while someone thinks about the higher level questions. |
|
So you are saying that there is a higher level issue that this change will not solve? Is there a ticket for that? If no, would you open one? |
|
@radford I agree we should not be hiding the exception. Ensuring we log the exception sounds like a good first step, so I am 👍 for this change. That said, this PR changes the behavior of puppet. Whenever there is a behavior change, we write tests to verify that puppet behaves the way we expect at that point in time. Writing a test doesn't "enshrine" the behavior -- it documents it, and we are free to change the behavior in the future. We simply update the code and the tests to match the new behavior. Meanwhile, we should discuss what the new behavior should be on puppet-dev, or if you have ideas about what it should be, please file a ticket as @ffrank suggested, and write up how you think it should work. The module loading code is invoked in many different contexts, especially with the new environments work going on between 3.5-3.7. I have not made any suggestions about how this should work, because I am not current on how environments interact with modules. |
|
Triage Notes:
|
|
Btw, there is already a ticket filed about puppet's lack of debugging when a module has invalid metadata, https://tickets.puppetlabs.com/browse/PUP-3664 |
Give notice when a module on the modulepath is invalid, explaining why.
To do this cleanly, we stop trying to add "." and ".." as modules since
these are always invalid.