-
Notifications
You must be signed in to change notification settings - Fork 107
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
Fix grafana_user
and switch to using flush
#283
Conversation
Previously `save_user` was being called once per changed property and calls were also being made to update user properties, password and the admin flag regardless of whether these properties needed updating. Using `flush` is more efficient. * `full_name` is fixed (it was previously a parameter instead of a property). * When a user is created, `is_admin` is correctly set in a single Puppet run. * Properties can be managed individually. * Instead of making `password` mandatory, (when creating a user), if `password` isn't specified, a random one is used. Fixes voxpupuli#121
grafana_user
save_user
with flush
grafana_user
and switch to using flush
@@ -48,79 +51,82 @@ def name | |||
end | |||
|
|||
def name=(value) | |||
resource[:name] = value |
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.
These lines didn't actually do anything. resource[:foo]
was already value
. (The function wouldn't have been called if the property was not set)
@@ -57,7 +57,6 @@ def insync?(_is) | |||
newproperty(:is_admin) do | |||
desc 'Whether the user is a grafana admin' | |||
newvalues(:true, :false) | |||
defaultto :false |
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.
Now that update_admin_flag
is only called if the property has been set, there is no need for a default here (and defaults for properties are generally a bad thing).
Previously
save_user
was being called once per changed property andcalls were also being made to update user properties, password and the
admin flag regardless of whether these properties needed updating.
Using
flush
is more efficient.full_name
is fixed (it was previously a parameter instead of a property).is_admin
is correctly set in a single Puppet run.password
mandatory, (when creating a user), ifpassword
isn't specified, a random one is used.Fixes #121