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

Document that client custom property will filter out keys for other properties #8

Closed
treydock opened this issue Mar 21, 2019 · 4 comments · Fixed by #10
Closed

Document that client custom property will filter out keys for other properties #8

treydock opened this issue Mar 21, 2019 · 4 comments · Fixed by #10

Comments

@treydock
Copy link
Collaborator

Migrating issue from sensu/sensu-puppet#1093

Supplying a key for sensu::client_custom that matches a key used by a property will cause Puppet to think changes are needed as the key is filtered as since it belongs to a property.

@cdenneen If you feel this is more than a documentation issue let us know.

@cdenneen
Copy link
Contributor

@treydock I think docs will help but what’s the exact purpose of these parameters? Are the eventually going to populate metadata?

@treydock
Copy link
Collaborator Author

They populate /etc/sensu/conf.d/client.json, is there something else they should be doing? The values are passed to sensu_client_config type which just manages the client.json file.

The vagrant tests in this module use this:

$client_ec2 = {
    'instance-id' => 'i-2102113',
  }
  $client_puppet = {
    'nodename' => $::fqdn,
  }
  $client_chef = {
    'nodename' => $::fqdn,
  }
  $client_servicenow = {
    'configuration_item' => {
      'name' => 'ServiceNow test',
      'os_version' => '16.04',
    },
  }
  class { 'sensuclassic':
    rabbitmq_password => 'correct-horse-battery-staple',
    rabbitmq_host     => '192.168.156.10',
    rabbitmq_vhost    => '/sensu',
    subscriptions     => 'all',
    client_address    => $ip,
    client_ec2        => $client_ec2,
    client_chef       => $client_chef,
    client_puppet     => $client_puppet,
    client_servicenow => $client_servicenow,
    filters           => $filters,
    filter_defaults   => $filter_defaults,
    version           => 'latest',
  }

And generates this:

{
  "client": {
    "address": "192.168.156.11",
    "chef": {
      "nodename": "el7-client.example.com"
    },
    "ec2": {
      "instance-id": "i-2102113"
    },
    "http_socket": {
    },
    "keepalive": {
    },
    "name": "el7-client.example.com",
    "puppet": {
      "nodename": "el7-client.example.com"
    },
    "safe_mode": false,
    "servicenow": {
      "configuration_item": {
        "name": "ServiceNow test",
        "os_version": "16.04"
      }
    },
    "socket": {
      "bind": "127.0.0.1",
      "port": 3030
    },
    "subscriptions": [
      "all"
    ]
  }
}

Per the docs this seems to be the behavior that should be happening:

https://docs.sensu.io/sensu-core/1.7/reference/clients/#ec2-attributes

Are you seeing something different?

@cdenneen
Copy link
Contributor

cdenneen commented Mar 22, 2019

That is the exact behavior I’m seeing but it’s the same behavior I saw before with

$client_custom = {
  ‘ec2’ => {
    'instance-id' => 'i-2102113',
  },
  ‘puppet’ => {
    'nodename' => $::fqdn,
  },
  ‘chef’ => {
    'nodename' => $::fqdn,
  },
  ‘servicenow’ => {
    'configuration_item' => {
      'name' => 'ServiceNow test',
      'os_version' => '16.04',
    },
  },
}

Producing the same client.json

@treydock
Copy link
Collaborator Author

Then what you're seeing exactly what I'd expect given the design of the Puppet code. Your ec2 in client_custom should behave the same before as using client_ec2 after the change to Puppet module. Because client_custom is a "catch all" for anything not defined as a valid property, it has to exclude keys that map to valid properties otherwise custom would end up being populated with data that would conflict with properties.

If you'd expect to see something different let me know. So far I think the only change to this module I am seeing being needed is to update documentation to reflect the behavior of client_custom with regard to filtering out keys.

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