diff --git a/lib/puppet/provider/elasticsearch_license/xpack.rb b/lib/puppet/provider/elasticsearch_license/ruby.rb similarity index 82% rename from lib/puppet/provider/elasticsearch_license/xpack.rb rename to lib/puppet/provider/elasticsearch_license/ruby.rb index 4bae734c5..7053faf8b 100644 --- a/lib/puppet/provider/elasticsearch_license/xpack.rb +++ b/lib/puppet/provider/elasticsearch_license/ruby.rb @@ -3,20 +3,19 @@ require 'puppet/provider/elastic_rest' Puppet::Type.type(:elasticsearch_license).provide( - :xpack, - api_resource_style: :bare, + :ruby, parent: Puppet::Provider::ElasticREST, metadata: :content, metadata_pipeline: [ ->(data) { Puppet_X::Elastic.deep_to_s data }, ->(data) { Puppet_X::Elastic.deep_to_i data } ], - api_uri: '_xpack/license', + api_uri: '_license', query_string: { 'acknowledge' => 'true' } ) do - desc 'A REST API based provider to manage Elasticsearch X-Pack licenses.' + desc 'A REST API based provider to manage Elasticsearch licenses.' mk_resource_methods diff --git a/manifests/license.pp b/manifests/license.pp index 866b85775..ea6025a11 100644 --- a/manifests/license.pp +++ b/manifests/license.pp @@ -72,7 +72,7 @@ port => $api_port, timeout => $api_timeout, } - -> elasticsearch_license { 'xpack': + -> elasticsearch_license { 'license': ensure => $ensure, content => $_content, protocol => $api_protocol, diff --git a/spec/classes/006_elasticsearch_license_spec.rb b/spec/classes/006_elasticsearch_license_spec.rb index 580bdadef..b8ce3d957 100644 --- a/spec/classes/006_elasticsearch_license_spec.rb +++ b/spec/classes/006_elasticsearch_license_spec.rb @@ -53,11 +53,11 @@ class { 'elasticsearch' : it do expect(subject).to contain_es_instance_conn_validator( 'license-conn-validator' - ).that_comes_before('elasticsearch_license[xpack]') + ).that_comes_before('elasticsearch_license[license]') end it do - expect(subject).to contain_elasticsearch_license('xpack').with( + expect(subject).to contain_elasticsearch_license('license').with( ensure: 'present', content: { 'license' => { diff --git a/spec/unit/provider/elasticsearch_license/xpack_spec.rb b/spec/unit/provider/elasticsearch_license/ruby_spec.rb similarity index 86% rename from spec/unit/provider/elasticsearch_license/xpack_spec.rb rename to spec/unit/provider/elasticsearch_license/ruby_spec.rb index 00691acab..4b444de50 100644 --- a/spec/unit/provider/elasticsearch_license/xpack_spec.rb +++ b/spec/unit/provider/elasticsearch_license/ruby_spec.rb @@ -2,14 +2,14 @@ require_relative '../../../helpers/unit/provider/elasticsearch_rest_shared_examples' -describe Puppet::Type.type(:elasticsearch_license).provider(:xpack) do # rubocop:disable RSpec/MultipleMemoizedHelpers - let(:name) { 'xpack' } +describe Puppet::Type.type(:elasticsearch_license).provider(:ruby) do # rubocop:disable RSpec/MultipleMemoizedHelpers + let(:name) { 'ruby' } let(:example1) do { - name: 'xpack', + name: 'ruby', ensure: :present, - provider: :xpack, + provider: :ruby, content: { 'license' => { 'status' => 'active', @@ -59,5 +59,5 @@ } end - include_examples 'REST API', 'xpack/license', nil, true + include_examples 'REST API', 'license', nil, true end