Skip to content
This repository has been archived by the owner on Mar 6, 2020. It is now read-only.

Commit

Permalink
make it clear that each element must be a non empty string
Browse files Browse the repository at this point in the history
The message indicates that it will accept any string but after inspecting the code and the clients subscriptions it does not support a subscription with an ampty string.

Code: https://github.com/sensu/sensu-settings/blob/v10.14.0/lib/sensu/settings/rules.rb#L113-L123

Example Error:
```
Mixlib::ShellOut::ShellCommandFailed
    ------------------------------------
    Expected process to exit with [0], but received '2'
    ---- Begin output of /etc/init.d/sensu-client restart ----
    STDOUT: configuration is invalid
    {
      "errors":[
        {
          "object":{
            "name":"dokken",
            "address":"172.18.0.13",
            "subscriptions":[
              "",
              "base",
              "kitchen",
              "rails_app_testing",
              "rails_app_testing_kitchen",
              "roundrobin:rails_app_testing_kitchen",
              "client:dokken"
            ],
            "keepalive":{
              "thresholds":{
                "warning":200,
                "critical":240
              },
              "handlers":[
                "default"
              ],
              "refresh":1800
            },
            "redact":[
              "password",
              "passwd",
              "pass",
              "api_key",
              "api_token",
              "access_key",
              "secret_key",
              "private_key",
              "secret"
            ],
            "environment":"kitchen"
          },
          "message":"client subscriptions must each be a string"
        }
      ]
    }
    STDERR:
    ---- End output of /etc/init.d/sensu-client restart ----
    Ran /etc/init.d/sensu-client restart returned 2
```

Signed-off-by: Ben Abrams <[email protected]>
  • Loading branch information
majormoses authored and portertech committed Sep 24, 2018
1 parent 6609d54 commit dcde465
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/sensu/settings/validators/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Client
def validate_client_subscriptions(client)
if is_an_array?(client[:subscriptions])
items_must_be_strings(client[:subscriptions]) ||
invalid(client, "client subscriptions must each be a string")
invalid(client, "client subscriptions must each be a non empty string")
else
invalid(client, "client subscriptions must be an array")
end
Expand Down

0 comments on commit dcde465

Please sign in to comment.