Skip to content

Commit

Permalink
squash all modification license endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
stjmt committed Jul 30, 2024
1 parent 7768e97 commit df1a9ac
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
7 changes: 3 additions & 4 deletions lib/puppet/provider/elasticsearch_license/xpack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion manifests/license.pp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
port => $api_port,
timeout => $api_timeout,
}
-> elasticsearch_license { 'xpack':
-> elasticsearch_license { 'license':
ensure => $ensure,
content => $_content,
protocol => $api_protocol,
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/006_elasticsearch_license_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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' => {
Expand Down
10 changes: 5 additions & 5 deletions spec/unit/provider/elasticsearch_license/xpack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -59,5 +59,5 @@
}
end

include_examples 'REST API', 'xpack/license', nil, true
include_examples 'REST API', 'license', nil, true
end

0 comments on commit df1a9ac

Please sign in to comment.