Skip to content

Conversation

@WhatsARanjit
Copy link
Contributor

The classes and variables attributes are additive. Meaning if you have a current resource like:

node_group { 'test':
  classes   => { klass{} => {}},
  variables => { 'key' => 'value' },
}

...and we write a node_group definition like:

node_group { 'test':
  classes   => {},
  variables => {},
}

..the intended result is to remove all classes and variables. However, the actual result is to append new items to existing items. So:

{ klass{} => {}} + {}
{ 'key' => 'value' } + {}

...and so the result is nothing is actually changed. In order to remove items, you actually have to submit:

{ klass{} => {}} + { klass => null }
{ 'key' => 'value' } + { 'key' => null }

Sending a null signals the API to remove the item. This PR adds a add_nulls() method which diffs current-state/desired-state to add null values to things that should be removed.

@WhatsARanjit WhatsARanjit merged commit 2dfcf77 into master Mar 31, 2017
@WhatsARanjit WhatsARanjit deleted the empty_attribute branch March 31, 2017 20:56
@Ramesh7 Ramesh7 added the feature label Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants