-
Notifications
You must be signed in to change notification settings - Fork 68
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
(MODULES-3430) Do not set default location to resource title #41
(MODULES-3430) Do not set default location to resource title #41
Conversation
8c284bb
to
f86e9e9
Compare
|
@puppetlabs/windows take a look. |
f86e9e9
to
8eebf24
Compare
|
And now we are good. |
| @@ -120,6 +111,10 @@ def insync?(is) | |||
| if provider.respond_to?(:validate) | |||
| provider.validate | |||
| end | |||
|
|
|||
| if (self[:ensure].to_sym == :present && (self[:location].nil? || self[:location] == '')) | |||
| raise ArgumentError, "A non-empty location must be specified when not disabling/removing a source." | |||
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.
This error message is very confusing as it includes a double negative. Would prefer;
A location must be specified when setting a source
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.
Not exactly a double negative.
non-empty is an adjective describing location.
The second part is about when it must be specified, as in when it is ensure => present (or the default of that when it is not specified). It was becoming a lot of words to express the same thing more succinctly.
8eebf24
to
0a1538c
Compare
When ensuring a chocolateysource is present, location is a required value
and should be explicitly set. Previously, location would just take on the
default value of the resource title. This could be alarming to some users
who may set a resource like:
~~~puppet
chocolateysource {'chocolatey':}
~~~
And be later surprised to find that it replaces the location value with
`chocolatey` instead of whatever it was originally, in this case that
value was `https://chocolatey.org/api/v2/`. Due to this, which could be
both alarming and upsetting, the resource should instead explicitly
require a location when `ensure => present`. When disabling or
removing a chocolateysource, it should be fine to simply name the
source to disable/remove.
To see when someone sets the value of user => ' ' and validate that it is not allowed, ensure to remove any extra spaces for validation. We don't want to do the same for password, as it may be possible the password is empty.
0a1538c
to
53f409e
Compare
When ensuring a chocolateysource is present, location is a required value
and should be explicitly set. Previously, location would just take on the
default value of the resource title. This could be alarming to some users
who may set a resource like:
And be later surprised to find that it replaces the location value with
chocolateyinstead of whatever it was originally, in this case thatvalue was
https://chocolatey.org/api/v2/. Due to this, which could beboth alarming and upsetting, the resource should instead explicitly
require a location when
ensure => present. When disabling orremoving a chocolateysource, it should be fine to simply name the
source to disable/remove.