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

Issues on the elasticsearch_component_template.rb and elasticsearch_index_template.rb #1222

Closed
mcodenie opened this issue Apr 23, 2024 · 2 comments

Comments

@mcodenie
Copy link

mcodenie commented Apr 23, 2024

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: puppet-agent-6.28.0-1.el8.x86_64
  • Ruby: n/a
  • Distribution: RHEL 8.9
  • Module version: mod 'puppet-elasticsearch', '9.0.0'

How to reproduce (e.g Puppet code you use)

vagrant provision / puppet agent -t

with the following configurations:

    class { 'elastic_stack::repo':
      version => 5,
    }
    class { 'elasticsearch':
      version           => '5.6.16',
      manage_repo       => true,
      restart_on_change => true,
    }

What are you seeing

==> elasticsearchsrv: Error: Could not autoload puppet/type/elasticsearch_component_template: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/lib/puppet/type/elasticsearch_component_template.rb:51: syntax error, unexpected ']'
==> elasticsearchsrv: ...                   setting[6..]
==> elasticsearchsrv: ...                              ^
==> elasticsearchsrv: Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/elasticsearch_component_template: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/lib/puppet/type/elasticsearch_component_template.rb:51: syntax error, unexpected ']'
==> elasticsearchsrv: ...                   setting[6..]
==> elasticsearchsrv: ...                              ^ (file: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/manifests/init.pp, line: 654, column: 3) on node elasticsearchsrv
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

2nd Run after modifying the elasticsearch_component_template

==> elasticsearchsrv: Error: Could not autoload puppet/type/elasticsearch_index_template: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/lib/puppet/type/elasticsearch_index_template.rb:57: syntax error, unexpected ']'
==> elasticsearchsrv: ...                   setting[6..]
==> elasticsearchsrv: ...                              ^
==> elasticsearchsrv: Error: Evaluation Error: Error while evaluating a Virtual Query, Could not autoload puppet/type/elasticsearch_index_template: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/lib/puppet/type/elasticsearch_index_template.rb:57: syntax error, unexpected ']'
==> elasticsearchsrv: ...                   setting[6..]
==> elasticsearchsrv: ...                              ^ (file: /tmp/vagrant-puppet/environments/local/local-modules/elasticsearch/manifests/init.pp, line: 655, column: 6) on node elasticsearchsrv
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

What behaviour did you expect instead

Run smoothly or able to execute well the module like these:

==> elasticsearchsrv: Notice: Compiled catalog for elasticsearchsrv in environment local in 1.56 seconds
==> elasticsearchsrv: Info: Using environment 'local'
==> elasticsearchsrv: Info: Applying configuration version '1713842217'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/HdrHistogram-2.1.9.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/elasticsearch-5.6.16.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/hppc-0.7.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jackson-core-2.8.6.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jackson-dataformat-cbor-2.8.6.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jackson-dataformat-smile-2.8.6.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jackson-dataformat-yaml-2.8.6.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/java-version-checker-5.6.16.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jna-4.4.0-1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/joda-time-2.10.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jopt-simple-5.0.2.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/jts-1.13.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/log4j-1.2-api-2.11.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/log4j-api-2.11.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/log4j-core-2.11.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-analyzers-common-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-backward-codecs-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-core-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-grouping-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-highlighter-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-join-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-memory-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-misc-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-queries-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-queryparser-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-sandbox-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-spatial-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-spatial-extras-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-spatial3d-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/lucene-suggest-6.6.1.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/plugin-cli-5.6.16.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/securesm-1.2.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/snakeyaml-1.15.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/spatial4j-0.6.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Config/File[/usr/share/elasticsearch/lib/t-digest-3.0.jar]/mode: mode changed '0755' to '0644'
==> elasticsearchsrv: Info: Class[Elasticsearch::Config]: Scheduling refresh of Class[Elasticsearch::Service]
==> elasticsearchsrv: Info: Class[Elasticsearch::Service]: Scheduling refresh of Service[elasticsearch]
==> elasticsearchsrv: Notice: /Stage[main]/Elasticsearch::Service/Service[elasticsearch]/ensure: ensure changed 'stopped' to 'running'
==> elasticsearchsrv: Info: /Stage[main]/Elasticsearch::Service/Service[elasticsearch]: Unscheduling refresh on Service[elasticsearch]

Output log

Same as above

Any additional information you'd like to impart

There is no issues on the mod 'puppet-elasticsearch', '8.1.0' upon further investigation there was lately changed 2 weeks ago

@mcodenie
Copy link
Author

mcodenie commented Apr 23, 2024

The solution I got were reverted the elasticsearch_component_template.rb and elasticsearch_index_template.rb which works well, using the latest version 9.0.0.

diff --git a/lib/puppet/type/elasticsearch_component_template.rb b/lib/puppet/type/elasticsearch_component_template.rb
index ac963fe..d527e37 100644
--- a/lib/puppet/type/elasticsearch_component_template.rb
+++ b/lib/puppet/type/elasticsearch_component_template.rb
@@ -48,7 +48,7 @@ Puppet::Type.newtype(:elasticsearch_component_template) do
               val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
               (val['template']['settings'].keys - ['index']).each do |setting|
                 new_key = if setting.start_with? 'index.'
-                            setting[6..]
+                            setting[6..-1]
                           else
                             setting
                           end
diff --git a/lib/puppet/type/elasticsearch_index_template.rb b/lib/puppet/type/elasticsearch_index_template.rb
index c8b90e4..3a9f3b6 100644
--- a/lib/puppet/type/elasticsearch_index_template.rb
+++ b/lib/puppet/type/elasticsearch_index_template.rb
@@ -54,7 +54,7 @@ Puppet::Type.newtype(:elasticsearch_index_template) do
                 val['template']['settings']['index'] = {} unless val['template']['settings'].key? 'index'
                 (val['template']['settings'].keys - ['index']).each do |setting|
                   new_key = if setting.start_with? 'index.'
-                              setting[6..]
+                              setting[6..-1]
                             else
                               setting
                             end

@mcodenie mcodenie changed the title Issues on the elasticsearch_component_template.rb and Issues on the elasticsearch_component_template.rb and elasticsearch_index_template.rb Apr 23, 2024
@smortex
Copy link
Member

smortex commented May 7, 2024

* Puppet: **puppet-agent-6.28.0-1.el8.x86_64**
* Module version: **mod 'puppet-elasticsearch', '9.0.0'**

Puppet 6 has reached EOL and is not supported anymore by recent version of the module (#1191).

Either use a supported version of Puppet, or use an older version of the module that work with the legacy version of Puppet you want to stick with.

@smortex smortex closed this as not planned Won't fix, can't repro, duplicate, stale May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants