puppetlabs / puppetlabs-node_manager

Create and manage PE node groups as resources.
Apache License 2.0
10 stars 21 forks source link

New Feature: Add ability to toggle inclusive/exclusive management of classes #36

Closed natemccurdy closed 4 years ago

natemccurdy commented 6 years ago

I would like to be able to add classes to a Node Group without affecting the current classes in it.

As of now, the node_group type will treat the classes attribute as an exclusive list of classes. Which means it will remove any classes that aren't in the classes hash.

That's fine behavior, but sometimes it's not desirable. There should be a new attribute of the node_group type that toggles the exclusivity of the classes attribute.

Current Workaround

Without this new feature, I've been getting around the problem by doing something like this:

$current_pe_master_classes = node_groups()['PE Master']['classes']

$classes_to_add = {
  'pe_repo::platform::el_6_x86_64' => {},
  'pe_repo::platform::windows_x86_64' => {},
}

node_group { 'PE Master':
  classes => merge($current_pe_master_classes, $classes_to_add)
}

Ideal Solution

Here I'm making up a new attribute called remove_classes. I don't really like that name, but I can't think of anything better at the moment.

node_group { 'PE Master':
  classes => {
    'pe_repo::platform::el_6_x86_64' => {},
    'pe_repo::platform::windows_x86_64' => {},
  }
  remove_classes => false,
}
WhatsARanjit commented 4 years ago

No update on this ticket. Please re-open if feature is still necessary.