Error installing ElasticSearch instance using systemd `scan' for :absent:Symbol


(ScottTy) #1

Hi this is our initial deployment creating an elastic search instance and installing via Puppet we are seeing this error.

2019-01-1415:26 -06:00 err Could not evaluate: undefined method `scan' for :absent:Symbol
Source: /Stage[main]/xxxx_elastic_stack::Search/Elasticsearch::Instance[es-01]/Elasticsearch::Service[es-01]/Elasticsearch::Service::Systemd[es-01]/Elasticsearch_service_file[/lib/systemd/system/elasticsearch-es-01.service]
File:/etc/puppetlabs/code/environments/sandbox/modules/elasticsearch/manifests/service/systemd.pp
Line: 163

2019-01-1415:26 -06:00 warning Skipping because of failed dependencies
Source: /Stage[main]/xxxx_elastic_stack::Search/Elasticsearch::Instance[es-01]/Elasticsearch::Service[es-01]/Elasticsearch::Service::Systemd[es-01]/File[/lib/systemd/system/elasticsearch-es-01.service]
File:/etc/puppetlabs/code/environments/sandbox/modules/elasticsearch/manifests/service/systemd.pp
Line: 178

Current versions:
Puppet Forge Elastic Search - Tagged Version 6.3.3
Puppet Version - 5.3.3
OS - RedHat 7.6
Elastic Search RMP Package - 6.5.4
puppet-elastic-stack.git - 6.2.4
puppet-datacat.git - tag 0.6.2

Code:

class xxxx_elastic_stack::search (
  String  $version                    = '6.5.4',
  String  $instance_name              = 'es-instance1',
  String  $cluster_name               = 'elastic-git',
  String  $network_host               = '127.0.0.1',
  Array[String] $jvm_heap_memory      = ['-xms8g','-Xmx8g'],
  Enum['absent', 'present']  $ensure  = 'present',
  String $pkg_version                 = '6.5.4',
  String $local_pkg_loc               = "/home/packages/elastic_stack/${pkg_version}",
  String $pkg_prefix                  = 'elasticsearch',
  String $download_tool_insecure      = 'curl --insecure --output',
  Boolean $download_tool_verify_certificates = false,
  ) {
    $rpm_pkg_name = "${pkg_prefix}-${pkg_version}.rpm"

    class { 'elasticsearch':
      ensure                            => $ensure,
      package_dir                       => $local_pkg_loc,
      package_name                      => $rpm_pkg_name,
      package_url                       => "https://xxxx.xxxxint.net/xxxx/xxxx-repo/elastic-stack/${pkg_version}/${rpm_pkg_name}",
      download_tool_insecure            => $download_tool_insecure,
      download_tool_verify_certificates => $download_tool_verify_certificates,
    }-> elasticsearch::instance { $instance_name :
      #ensure      => $ensure,
      #jvm_options => $jvm_heap_memory,
      #config      => {
        #'cluster.name' => $cluster_name,
        #'network.host' => $network_host,
      }
    }

(ScottTy) #2

I found out a bit more information. This appears to be an issue with major and minor versioning. I ran a puppet apply in trace mode and got this stack trace.

Could not evaluate: undefined method `scan' for :absent:Symbol /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/package.rb:4:in `versioncmp'
 /opt/puppetlabs/puppet/cache/lib/puppet_x/elastic/es_versioning.rb:46:in `min_version'
 /opt/puppetlabs/puppet/cache/lib/puppet_x/elastic/es_versioning.rb:20:in `opt_flags' 
 /opt/puppetlabs/puppet/cache/lib/puppet/provider/elasticsearch_service_file/ruby.rb:66:in `flush' 
 /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/type.rb:1006:in `flush'

(Tyler Langlois) #3

@styriver when the catalog ran (and when you actually instantiate your elastic_stack::search class, is the Elasticsearch package actually being installed/set to present? It looks like the version logic in the code is trying to compare versions with :absent at some point.


(ScottTy) #4

Hi

Thank you for the response. I figured it out this morning. When I am building this string I am appending the .rpm
$rpm_pkg_name = "${pkg_prefix}-${pkg_version}.rpm"

This was causing the versions to not be inferred correctly. The code is using regex to get the package versions. Once I removed the .rpm from that string and just addedthe .rpm to the end of the package url it worked.

Thanks for your time on this issue.


(system) closed #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.