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

'puppet resource node_group' generates code that violates PE 2021 schema #63

Open
kreeuwijk opened this issue Mar 8, 2021 · 6 comments

Comments

@kreeuwijk
Copy link

When using puppet resource node_group to generate Puppet code for existing node groups, creating node groups on PE 2021 from this code fails due to 2 schema violations:

  • override_environment is represented as a string ('true' or 'false') instead of a boolean (true or false)
  • rule is represented as [''] if the node group has no rules and no pinned members

Either issue causes the Puppet run to fail with:
node_manager failed with error type 'schema-violation': The object(s) in your submitted request did not conform to the schema. The problem is: ([:rule "The rule is malformed. Please consult the group documentation for details on the rule grammar."])

Manual modification is currently needed to convert the string values to booleans, and to remove any occurrence of rule => [''].

Desired behavior:

  • The output of puppet resource node_group should print booleans for override_environment
  • The output of puppet resource node_group should omit the rule property entirely if its value would be [''].
@vchepkov
Copy link
Contributor

I experience similar issue in PE2019, environmental group is not idempotent:

node_group { 'All Environments':
  ensure               => 'present',
  description          => 'Environment group parent and default',
  environment          => 'default_production',
  override_environment => 'true',
  parent               => 'All Nodes',
  rule                 => ['and',['~', 'name', '.*']],
}

# puppet apply env.pp 
Notice: Compiled catalog for primary.localdomain in environment production in 0.02 seconds
Notice: /Stage[main]/Main/Node_group[All Environments]/override_environment: override_environment changed 'true' to true
Notice: Applied catalog in 0.43 seconds

@tyler-francis-nih
Copy link

tyler-francis-nih commented Jul 15, 2021

Using Node Manager with PE 2021 usually works, but creating a not rule with != or with !~ causes a schema error. For example: ["!=", ["fact", "key"], "value"]
causes:

Error: node_manager failed with error type 'schema-violation': The object(s) in your submitted request did not conform to the schema. The problem is: ([:rule [nil nil (not (some-matching-condition? a-clojure.lang.PersistentVector))]])

@WhatsARanjit
Copy link
Contributor

My understanding was the RAL always prints Booleans as Strings?

# puppet resource service puppet
service { 'puppet':
  ensure   => 'stopped',
  enable   => 'false',
  provider => 'launchd',
}

If there's a way to enforce a Boolean, I'd be happy to look at an example. I have marked this property as a Boolean here:
https://github.com/WhatsARanjit/puppet-node_manager/blob/master/lib/puppet/type/node_group.rb#L21

@TJM
Copy link

TJM commented Aug 25, 2022

I almost feel like that may be the problem. No matter whether we put 'true' or true as the value, we get a corrective change like:

/Stage[main]/Profile::Puppet::Classifier/Node_group[Agent-Specified Environment]/override_environment: override_environment changed 'true' to true (corrective)

I would prefer it was treated as a boolean, but apparently whatever is returning the current value is thinking it is a string?

@vchepkov
Copy link
Contributor

vchepkov commented Feb 4, 2023

this was probably fixed by #67, any chance for a new release, @WhatsARanjit ? thanks

@rwaffen
Copy link

rwaffen commented Mar 10, 2023

@WhatsARanjit may we have a new forge release pls? 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants