Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change license endpoint #1231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading