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

Change the name_property to be the identity property by default, and to have desired_state: false by default #9581

Merged
merged 4 commits into from
Apr 3, 2020

Conversation

lamont-granquist
Copy link
Contributor

@lamont-granquist lamont-granquist commented Apr 2, 2020

Setting name_property: true is now roughly equivalent to name_property: true, identity: true, desired_state: false.

If there is any other property which is marked as an identity though the name_property will no longer be considered an identity property. A subtle detail of this is that the name_property itself is not marked as being identity: true, it is implemented via the chef/mixin/properties.rb mixin because the identity-ness of the name_property will be affected by other properties being marked as identity or not. That means you have to inspect the whole property collection -- hence implemented in the properties mixin. Consumers should check the identity_properties array on the resource class, and not inspect individual properties for being an identity themselves.

It makes no sense to have the name_property be set to being desired_state either since the name should not change before or after the resource converges.

closes #4282

name_property implies identity if there is no other identity property

this has been the behavior for a very long time, dunno why #4282 was
never closed.

closes #4282

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
@lamont-granquist lamont-granquist requested review from a team as code owners April 2, 2020 20:16
@tas50 tas50 changed the title remove redundant identity Remove redundant identity: true from resources Apr 2, 2020
@tas50
Copy link
Contributor

tas50 commented Apr 2, 2020

The resource specs seem to believe otherwise. That's the issue I ran into as I converted things to use the property DSL and why I had to add all these identity: true statements.

@lamont-granquist
Copy link
Contributor Author

oic, the "name" is the default identity property, not the "name_property"

If no other property is an identity property then the name_property is
the default identity property.  The name_property is also marked as not
being desired state by default (the 'name' should never change).

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
@lamont-granquist lamont-granquist changed the title Remove redundant identity: true from resources Change the name_property to be the identity property by default, and to have desired_state: false by default Apr 3, 2020
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
lib/chef/resource/mount.rb Outdated Show resolved Hide resolved
the name_property-identity patch was made backcompatible so that
this was never necessary

Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
@tas50 tas50 merged commit 05ad318 into master Apr 3, 2020
@chef-expeditor chef-expeditor bot deleted the lcg/redundant-identity branch April 3, 2020 17:00
@lock
Copy link

lock bot commented Apr 18, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make name_property imply identity
2 participants