puppetlabs / puppetlabs-node_manager

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

resource node_group parent not determined properly #52

Open vchepkov opened 4 years ago

vchepkov commented 4 years ago

Noticed this on PE2019.2.2. Attribute _overrideenvironment seems been renamed to _environmenttrumps, but more importantly, parents are not determined properly.

Here is partial diff between node_group and pe_node_group output:

--- nodes.txt   2020-01-25 18:45:21.705108222 +0000
+++ pe_nodes.txt        2020-01-25 18:45:32.762794571 +0000
@@ -1,41 +1,41 @@
-node_group { 'All Environments':
+pe_node_group { 'All Environments':
   ensure               => 'present',
   description          => 'Environment group parent and default',
   environment          => 'production',
+  environment_trumps => true,
   id                   => 'fcb5ce16-ef2b-41d8-adab-c80f67d1d76c',
-  override_environment => 'true',
   parent               => 'All Nodes',
   rule                 => ['and',
   ['~', 'name', '.*']],
 }
-node_group { 'All Nodes':
+pe_node_group { 'All Nodes':
   ensure               => 'present',
   environment          => 'production',
+  environment_trumps => false,
   id                   => '00000000-0000-4000-8000-000000000000',
-  override_environment => 'false',
   parent               => 'All Nodes',
   rule                 => ['and',
   ['~', 'name', '.*']],
 }
-node_group { 'Development environment':
+pe_node_group { 'Development environment':
   ensure               => 'present',
   description          => 'Development nodes',
   environment          => 'development',
+  environment_trumps => true,
   id                   => '456b842d-742a-49d4-8261-395fd5cee8db',
-  override_environment => 'true',
-  parent               => 'All Environments',
+  parent             => 'All Nodes',
   rule                 => ['and',
   ['=',
     ['trusted', 'extensions', 'pp_environment'],
     'development']],
 }
WhatsARanjit commented 4 years ago

So node_group is my code and pe_node_group is Puppet's opinionated implementation of my module. I intentionally replaced environment_trumps with override_environment because the PE Console at the time read "Override Environment" so to fall inline with that, I decidedly replaced that. https://github.com/WhatsARanjit/puppet-node_manager/blob/master/lib/puppet/provider/node_group/https.rb#L30

It seems there are some ramifications present from that now that usage is increased. What is your particular usecase @vchepkov ? Thanks.

vchepkov commented 4 years ago

I use it to create classification groups in the console. for example:

  node_group { 'PE Primary Master Agent':
    ensure  => 'present',
    classes => {
      'puppet_enterprise::profile::agent' => {
        'server_list' => ['primary.localdomain:8140']
      }
    },
    parent  => 'PE Infrastructure Agent',
    rule    => ['or', ['=', 'name', 'primary.localdomain']],
  }

As a workaround for bug in PE, since if puppetserver is down on HA master and agent fails over to replica - "bad things happen"

I suppose to I can use pe_node_group instead, but then I would have to somehow supply PE code to my validation tool and I'd rather not do it. If these resources won't conflict with each other, I am fine with the way it is now, it was more of an FYI ticket.