Showing with 253 additions and 219 deletions.
  1. +10 −2 CHANGELOG.md
  2. +6 −0 REFERENCE.md
  3. +6 −10 lib/puppet/provider/sensu_ad_auth/sensuctl.rb
  4. +1 −9 lib/puppet/provider/sensu_asset/sensuctl.rb
  5. +1 −8 lib/puppet/provider/sensu_check/sensuctl.rb
  6. +7 −1 lib/puppet/provider/sensu_cluster_member/sensuctl.rb
  7. +1 −8 lib/puppet/provider/sensu_cluster_role/sensuctl.rb
  8. +1 −8 lib/puppet/provider/sensu_cluster_role_binding/sensuctl.rb
  9. +1 −8 lib/puppet/provider/sensu_entity/sensuctl.rb
  10. +1 −8 lib/puppet/provider/sensu_event/sensuctl.rb
  11. +1 −8 lib/puppet/provider/sensu_filter/sensuctl.rb
  12. +1 −8 lib/puppet/provider/sensu_handler/sensuctl.rb
  13. +1 −8 lib/puppet/provider/sensu_hook/sensuctl.rb
  14. +6 −10 lib/puppet/provider/sensu_ldap_auth/sensuctl.rb
  15. +1 −8 lib/puppet/provider/sensu_mutator/sensuctl.rb
  16. +1 −8 lib/puppet/provider/sensu_namespace/sensuctl.rb
  17. +1 −8 lib/puppet/provider/sensu_role/sensuctl.rb
  18. +1 −8 lib/puppet/provider/sensu_role_binding/sensuctl.rb
  19. +1 −8 lib/puppet/provider/sensu_silenced/sensuctl.rb
  20. +1 −8 lib/puppet/provider/sensu_user/sensuctl.rb
  21. +11 −1 lib/puppet/provider/sensuctl.rb
  22. +14 −8 lib/puppet/type/sensu_ad_auth.rb
  23. +14 −8 lib/puppet/type/sensu_ldap_auth.rb
  24. +1 −1 metadata.json
  25. +4 −4 spec/acceptance/02_backend_cluster_spec.rb
  26. +7 −1 spec/acceptance/sensu_check_spec.rb
  27. +9 −0 spec/fixtures/unit/provider/sensu_ad_auth/sensuctl/list.json
  28. +9 −0 spec/fixtures/unit/provider/sensu_ldap_auth/sensuctl/list.json
  29. +36 −2 spec/unit/provider/sensu_ad_auth/sensuctl_spec.rb
  30. +2 −2 spec/unit/provider/sensu_asset/sensuctl_spec.rb
  31. +2 −2 spec/unit/provider/sensu_check/sensuctl_spec.rb
  32. +2 −2 spec/unit/provider/sensu_cluster_role/sensuctl_spec.rb
  33. +2 −2 spec/unit/provider/sensu_cluster_role_binding/sensuctl_spec.rb
  34. +2 −2 spec/unit/provider/sensu_entity/sensuctl_spec.rb
  35. +2 −2 spec/unit/provider/sensu_event/sensuctl_spec.rb
  36. +2 −2 spec/unit/provider/sensu_filter/sensuctl_spec.rb
  37. +2 −2 spec/unit/provider/sensu_handler/sensuctl_spec.rb
  38. +2 −2 spec/unit/provider/sensu_hook/sensuctl_spec.rb
  39. +36 −2 spec/unit/provider/sensu_ldap_auth/sensuctl_spec.rb
  40. +2 −2 spec/unit/provider/sensu_mutator/sensuctl_spec.rb
  41. +2 −2 spec/unit/provider/sensu_namespace/sensuctl_spec.rb
  42. +2 −2 spec/unit/provider/sensu_role/sensuctl_spec.rb
  43. +2 −2 spec/unit/provider/sensu_role_binding/sensuctl_spec.rb
  44. +2 −2 spec/unit/provider/sensu_silenced/sensuctl_spec.rb
  45. +2 −2 spec/unit/provider/sensu_user/sensuctl_spec.rb
  46. +8 −2 spec/unit/provider/sensuctl_spec.rb
  47. +12 −8 spec/unit/sensu_ad_auth_spec.rb
  48. +12 −8 spec/unit/sensu_ldap_auth_spec.rb
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Change Log

## [v3.1.0](https://github.com/sensu/sensu-puppet/tree/v3.1.0) (2019-04-18)
[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v0.0.1...v3.1.0)
## [v3.2.0](https://github.com/sensu/sensu-puppet/tree/v3.2.0) (2019-05-06)
[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v3.1.0...v3.2.0)

**Merged pull requests:**

- Support Sensu Go 5.6 [\#1105](https://github.com/sensu/sensu-puppet/pull/1105) ([treydock](https://github.com/treydock))

## [v3.1.0](https://github.com/sensu/sensu-puppet/tree/v3.1.0) (2019-04-19)
[Full Changelog](https://github.com/sensu/sensu-puppet/compare/v3.0.0...v3.1.0)

**Merged pull requests:**

- Prep 3.1.0 release [\#1103](https://github.com/sensu/sensu-puppet/pull/1103) ([treydock](https://github.com/treydock))
- Support opting out of tessen phone home [\#1101](https://github.com/sensu/sensu-puppet/pull/1101) ([treydock](https://github.com/treydock))
- Do not raise errors if custom puppet facts are undefined [\#1100](https://github.com/sensu/sensu-puppet/pull/1100) ([treydock](https://github.com/treydock))
- Hiera resources [\#1097](https://github.com/sensu/sensu-puppet/pull/1097) ([treydock](https://github.com/treydock))
Expand Down
6 changes: 6 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ AD servers
Defaults:
* insecure: false
* security: tls
* trusted_ca_file: ""
* client_cert_file: ""
* client_key_file: ""

##### `server_binding`

Expand Down Expand Up @@ -1828,6 +1831,9 @@ LDAP servers
Defaults:
* insecure: false
* security: tls
* trusted_ca_file: ""
* client_cert_file: ""
* client_key_file: ""

##### `server_binding`

Expand Down
16 changes: 6 additions & 10 deletions lib/puppet/provider/sensu_ad_auth/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
auths = []

output = sensuctl_list('auth', false)
Puppet.debug("sensu auth: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl auth list')
data = []
end
data = sensuctl_list('auth', false)

auth_types = sensuctl_auth_types()
data.each do |d|
Expand All @@ -37,6 +30,9 @@ def self.instances
s['port'] = server['port']
s['insecure'] = server['insecure']
s['security'] = server['security']
s['trusted_ca_file'] = server['trusted_ca_file']
s['client_cert_file'] = server['client_cert_file']
s['client_key_file'] = server['client_key_file']
binding[s['host']] = server['binding']
group_search[s['host']] = server['group_search']
user_search[s['host']] = server['user_search']
Expand Down Expand Up @@ -82,7 +78,7 @@ def create
spec[:servers] = []
resource[:servers].each do |server|
host = server['host']
server['binding'] = resource[:server_binding][host]
server['binding'] = resource[:server_binding][host] if resource[:server_binding]
server['group_search'] = resource[:server_group_search][host]
server['user_search'] = resource[:server_user_search][host]
spec[:servers] << server
Expand All @@ -108,7 +104,7 @@ def flush
if @property_flush[:server_binding]
server['binding'] = @property_flush[:server_binding][host]
else
server['binding'] = resource[:server_binding][host]
server['binding'] = resource[:server_binding][host] if resource[:server_binding]
end
if @property_flush[:server_group_search]
server['group_search'] = @property_flush[:server_group_search][host]
Expand Down
10 changes: 1 addition & 9 deletions lib/puppet/provider/sensu_asset/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@
def self.instances
assets = []

output = sensuctl_list('asset')
Puppet.debug("sensu assets: #{output}")
begin
data = JSON.parse(output)
return [] if data.nil?
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl asset list')
data = []
end
data = sensuctl_list('asset')

data.each do |d|
asset = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_check/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
checks = []

output = sensuctl_list('check')
Puppet.debug("sensu checks: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl check list')
data = []
end
data = sensuctl_list('check')

data.each do |d|
check = {}
Expand Down
8 changes: 7 additions & 1 deletion lib/puppet/provider/sensu_cluster_member/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ def self.instances
output = sensuctl('cluster', 'member-list', '--format', 'json')
Puppet.debug("sensu cluster members: #{output}")
begin
data = JSON.parse(output)
j = output.split(/\n\n/)
if j.size >= 2
_json = j[1]
else
_json = j[0]
end
data = JSON.parse(_json)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl cluster member-list')
data = {'members' => []}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_cluster_role/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
cluster_roles = []

output = sensuctl_list('cluster-role', false)
Puppet.debug("sensu cluster_roles: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl cluster_role list')
data = []
end
data = sensuctl_list('cluster-role', false)

data.each do |d|
cluster_role = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_cluster_role_binding/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
bindings = []

output = sensuctl_list('cluster-role-binding', false)
Puppet.debug("sensu cluster_role_bindings: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl cluster_role list')
data = []
end
data = sensuctl_list('cluster-role-binding', false)

data.each do |d|
binding = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_entity/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
entities = []

output = sensuctl_list('entity')
Puppet.debug("sensu entities: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl entity list')
data = []
end
data = sensuctl_list('entity')

data.each do |d|
entity = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_event/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
events = []

output = sensuctl_list('event')
Puppet.debug("sensu event: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl event list')
data = []
end
data = sensuctl_list('event')

data.each do |d|
event = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_filter/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
filters = []

output = sensuctl_list('filter')
Puppet.debug("sensu filters: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl filter list')
data = []
end
data = sensuctl_list('filter')

data.each do |d|
filter = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_handler/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
handlers = []

output = sensuctl_list('handler')
Puppet.debug("sensu handlers: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl handler list')
data = []
end
data = sensuctl_list('handler')

data.each do |d|
handler = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_hook/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
hooks = []

output = sensuctl_list('hook')
Puppet.debug("sensu hooks: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl hook list')
data = []
end
data = sensuctl_list('hook')

data.each do |d|
hook = {}
Expand Down
16 changes: 6 additions & 10 deletions lib/puppet/provider/sensu_ldap_auth/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
auths = []

output = sensuctl_list('auth', false)
Puppet.debug("sensu auth: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl auth list')
data = []
end
data = sensuctl_list('auth', false)

auth_types = sensuctl_auth_types()
data.each do |d|
Expand All @@ -37,6 +30,9 @@ def self.instances
s['port'] = server['port']
s['insecure'] = server['insecure']
s['security'] = server['security']
s['trusted_ca_file'] = server['trusted_ca_file']
s['client_cert_file'] = server['client_cert_file']
s['client_key_file'] = server['client_key_file']
binding[s['host']] = server['binding']
group_search[s['host']] = server['group_search']
user_search[s['host']] = server['user_search']
Expand Down Expand Up @@ -82,7 +78,7 @@ def create
spec[:servers] = []
resource[:servers].each do |server|
host = server['host']
server['binding'] = resource[:server_binding][host]
server['binding'] = resource[:server_binding][host] if resource[:server_binding]
server['group_search'] = resource[:server_group_search][host]
server['user_search'] = resource[:server_user_search][host]
spec[:servers] << server
Expand All @@ -108,7 +104,7 @@ def flush
if @property_flush[:server_binding]
server['binding'] = @property_flush[:server_binding][host]
else
server['binding'] = resource[:server_binding][host]
server['binding'] = resource[:server_binding][host] if resource[:server_binding]
end
if @property_flush[:server_group_search]
server['group_search'] = @property_flush[:server_group_search][host]
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_mutator/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
mutators = []

output = sensuctl_list('mutator')
Puppet.debug("sensu mutators: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl mutator list')
data = []
end
data = sensuctl_list('mutator')

data.each do |d|
mutator = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_namespace/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
namespaces = []

output = sensuctl_list('namespace', false)
Puppet.debug("sensu namespaces: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl namespace list')
data = []
end
data = sensuctl_list('namespace', false)

data.each do |d|
namespace = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_role/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
roles = []

output = sensuctl_list('role')
Puppet.debug("sensu roles: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl role list')
data = []
end
data = sensuctl_list('role')

data.each do |d|
role = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_role_binding/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
bindings = []

output = sensuctl_list('role-binding')
Puppet.debug("sensu role_bindings: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl role list')
data = []
end
data = sensuctl_list('role-binding')

data.each do |d|
binding = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_silenced/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
silencings = []

output = sensuctl_list('silenced')
Puppet.debug("sensu silencings: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl silenced list')
data = []
end
data = sensuctl_list('silenced')

data.each do |d|
silenced = {}
Expand Down
9 changes: 1 addition & 8 deletions lib/puppet/provider/sensu_user/sensuctl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@
def self.instances
users = []

output = sensuctl_list('user', false)
Puppet.debug("sensu users: #{output}")
begin
data = JSON.parse(output)
rescue JSON::ParserError => e
Puppet.debug('Unable to parse output from sensuctl user list')
data = []
end
data = sensuctl_list('user', false)

data.each do |d|
user = {}
Expand Down
Loading