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

Provider pcs for cs_location type does not set resource_discovery when using rules #448

Open
qcfabrizio opened this issue Sep 11, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@qcfabrizio
Copy link

qcfabrizio commented Sep 11, 2018

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.2
  • Ruby: ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-linux]
  • Distribution: Ubuntu 18.04
  • Module version: 6.0.1

How to reproduce (e.g Puppet code you use)

Create a cs_location which does not set node_name but does set rules.

cs_location { "location_${primitive_name}":
  primitive          => "${primitive_name}",
  resource_discovery => 'never',
  rules              => [
    # Avoid hosts which do not have the required attribute
    {
      "${primitive_name}_require-foo" => {
        'score'      => '-INFINITY',
        'boolean-op' => 'or',
        'expression' => [
          {
            'attribute' => 'foo',
            'operation' => 'not_defined',
          },
          {
            'attribute' => 'foo',
            'operation' => 'ne',
            'value'     => 'true', # lint:ignore:quoted_booleans
          },
        ],
      },
    },
  ],
  cib                => 'test',
}

What are you seeing

The constraint is created without the resource-discovery attribute being set.

What behaviour did you expect instead

The resource-discovery attribute to be set.

Any additional information you'd like to impart

Looking at the source, resource discovery is only set when a node is specified:

cmd << "resource-discovery=#{@property_hash[:resource_discovery]}" unless @property_hash[:resource_discovery].nil?

Adding params << "resource-discovery=#{@property_hash[:resource_discovery]}" if count.zero? unless @property_hash[:resource_discovery].nil? to the following block should fix the issue but I haven't tested this yet:

params << "id=#{name}"
params << "constraint-id=#{@resource[:name]}" if count.zero?
params << "role=#{rule['role']}" unless rule['role'].nil?
params << score
params += expression

Currently I am unable to use the crm provider because of #447 and the pcs provider because of this issue.

@qcfabrizio qcfabrizio changed the title Can't set resource_discovery when using rules in the cs_location pcs provider Provider pcs for cs_location type does not set resource_discovery when using rules Sep 11, 2018
@btravouillon
Copy link
Member

Hi @qcfabrizio - You are right. Can you submit a PR with your proposal?

@btravouillon btravouillon self-assigned this Sep 18, 2018
@towo towo added the bug Something isn't working label Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants