Skip to content

Commit

Permalink
Last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stjmt committed Jul 30, 2024
1 parent 543c582 commit 5cae5f2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
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
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 5cae5f2

Please sign in to comment.