-
Notifications
You must be signed in to change notification settings - Fork 29
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 #33687 - Add warning not to directly edit settings.py #223
Conversation
There was a problem hiding this 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 a very long header and I generally dislike those. In puppet-foreman we have https://github.com/theforeman/puppet-foreman/blob/master/templates/_header.erb and IMHO that's plenty long.
templates/settings.py.erb
Outdated
# !!! WARNING: DO NOT EDIT THIS FILE !!! # | ||
################################################################################ | ||
# File managed by Puppet. # | ||
# Module: pulpcore # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Module: pulpcore # | |
# Module: <%= scope['module_name'] %> # |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would $module_name
ever take on another value? If not, then why not simply hard code it?
Note in the generic version I intend to build, it would be dynamic so that it could be used by other modules. That would also have an overrideable $installer_name
so that it can say, e.g. File managed by foreman-installer
one line above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah, I think it will always be the module name based on the metadata and thus no worry that it might change for right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, if you do want to go to a generic header it makes sense to think about it. For example, the closing #
that you add now becomes a lot harder. That's why I'd advise to leave that part out. I should have mentioned that in my initial review.
My reasoning is that a change now will lead to a service restart. Restarting all services just for a new comment in a config file is a bit of a waste. So I'd prefer to get it right the first time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I see what you are saying... the trailing #
is harder to calculate than if there was none. So if that part was dropped, when the generic solution is implemented it matches this closer and is easier to implement. We do not necessarily need the aesthetic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. With that said, I already solved that issue in my proof of concept for the more general case:
templates/settings.py.erb
Outdated
# Not only are your edits likely to be overwritten, there is also a strong # | ||
# possibility of breaking your system if you change configuration here without # | ||
# making required changes elsewhere. Refer to the documentation you used to # | ||
# install Pulpcore to determine the safe and persistent way to modify the # | ||
# configuration. # | ||
################################################################################ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part really needed? The user may not have explicitly thought about it so how are they going to link it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's important to provide some explanation to the user so that they understand why they are asked to not make edits.
If there is a warning not to make edits, but no explanation, a confident user might say "oh, I already understand it won't be persistent, so this warning doesn't apply to me. I just want to try out that other tasking system..."
I agree it's difficult to phrase it in such a way that is equally applicable to users of puppet, foreman-installer, satellite-installer, orcharhino, etc. Necessarily, the explanation will be vague, and this is the problem that I intend to solve by allowing custom strings in hiera.
But in the meantime, with the upcoming release introducing several new config file entries that can easily be broken in unexpected ways, I argue that a vague explanation is still better than no explanation at all.
9e4156e
to
f36e59f
Compare
There was a problem hiding this 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 a fair start, and the systematic change being worked on will be a better long term solution. For now this achieves the primary objective of helping users understand they should not be editing. I suppose we will learn over time if it actually works.
Thanks. I think that static module name should be fine for this PR since it will never change. As I understood the suggestion from @ekohl it was a recommendation to think about the future where this type of logic could be used by any module. I have done that, and it is solved in #210 So I would propose that we:
OR
The upside of the 2nd approach would be the additional customization it allows, which solves the problem of documenting/commenting for pure puppet deployments vs. foreman installer vs. downstream; the downside would be that a future breaking change becomes more likely if the customizable form is merged now, then goes through additional reviews and changes during externalization |
f36e59f
to
2912cf1
Compare
After further thought and discussion, I pushed an update with the following changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still feel this is quite a heavy text. Some inline comments to make it a bit smaller.
I do like the reference to the documentation.
2912cf1
to
a247929
Compare
@ekohl This is updated with your requested changes. Longer term, I still prefer a solution using custom strings that can be overwritten in hiera, so that foreman-installer, satellite-installer, orcharhino, or any other tool using this module can provide warnings that are tailored to their use case. For example, satellite-installer could link directly to an article on access.redhat.com describing how to (re-)configure Pulpcore using satellite-installer. |
If that's your goal, why not copy what we have in dhcp? There's a parameter for the header: satellite-installer can then ship another hiera file (https://github.com/theforeman/foreman-installer/blob/bef5bd620a5b1494d3b5779030bc6b29e861645c/config/foreman-hiera.yaml#L11-L12) and override this again. |
Thanks, that is neat. Quite a bit simpler, if not as robust, as what I had in #210 |
Short term static alternative to #210