Skip to content

Commit

Permalink
reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
stjmt committed Jul 30, 2024
1 parent 7aaf8d3 commit b1b2dde
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions lib/puppet/provider/elasticsearch_license/ruby.rb
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
# frozen_string_literal: true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))

require 'puppet/provider/elastic_rest'

require 'puppet_x/elastic/deep_to_i'
require 'puppet_x/elastic/deep_to_s'

Puppet::Type.type(:elasticsearch_license).provide(
Puppet::Type.type(:elasticsearch_pipeline).provide(
:ruby,
parent: Puppet::Provider::ElasticREST,
api_uri: '_license?acknowledge=true',
metadata: :content,
metadata_pipeline: [
->(data) { Puppet_X::Elastic.deep_to_s data },
->(data) { Puppet_X::Elastic.deep_to_i data }
]
api_uri: '_license?acknowledge=true'
) do
desc 'A REST API based provider to manage Elasticsearch licenses.'

mk_resource_methods

def self.process_body(body)
Puppet.debug('Got to license.process_body')

JSON.parse(body).map do |object_name, api_object|
{
name: object_name,
ensure: :present,
metadata => { 'licenses' => process_metadata(api_object) },
provider: name
}.compact
end
end
end

0 comments on commit b1b2dde

Please sign in to comment.