antoineco / aco-tomcat

Puppet module for Tomcat
https://forge.puppet.com/aco/tomcat
Other
9 stars 26 forks source link

$::tomcat::package_name must be a String not Array #73

Closed zfredrickson closed 7 years ago

zfredrickson commented 7 years ago

Error message: Error: Failed to apply catalog: Parameter name failed on Package[tomcat server]: Name must be a String not Array at /etc/puppetlabs/code/environments/vagrant/modules/tomcat/manifests/install/package.pp:12

System information: DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS" Puppet version: 4.9.2

Replacing the package_name param in manifests/install/package.pp line 14 with the string 'tomcat8' allows it to run as expected.

Original (fails with error):

 11   # install packages
 12   package { 'tomcat server':
 13     ensure => $::tomcat::package_ensure_real,
 14     name   => $::tomcat::package_name
 15   }

Test (runs without issue):

 11   # install packages
 12   package { 'tomcat server':
 13     ensure => $::tomcat::package_ensure_real,
 14     name   => 'tomcat8'
 15   }
antoineco commented 7 years ago

Thanks for reporting @zfredrickson

Can you post more detail about how you call the tomcat class? The output of hiera -d tomcat::package_name on your master would also help.

antoineco commented 7 years ago

My own attempt at reproducing the problem:

root@890eb7228e6b:/# facter os.distro
{
  codename => "xenial",
  description => "Ubuntu 16.04.1 LTS",
  id => "Ubuntu",
  release => {
    full => "16.04",
    major => "16.04"
  }
}
root@890eb7228e6b:/# puppet -V
4.9.2
root@890eb7228e6b:/# puppet module install aco-tomcat
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Notice: Installing -- do not interrupt ...
/etc/puppetlabs/code/environments/production/modules
└─┬ aco-tomcat (v1.7.0)
  ├── puppet-archive (v1.3.0)
  ├─┬ puppetlabs-concat (v2.2.0)
  │ └── puppetlabs-stdlib (v4.15.0)
  └── puppetlabs-firewall (v1.8.2)
root@890eb7228e6b:/# puppet apply -e 'class { "tomcat": version => "8.0.32-1ubuntu1.3"}'
(...)
Notice: /Stage[main]/Tomcat::Service::Package/Service[tomcat8]: Triggered 'refresh' from 7 events
Notice: Applied catalog in 53.00 seconds
root@890eb7228e6b:/# curl -I localhost:8080
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
(...)
zfredrickson commented 7 years ago

Class is being called like so:

class role::tomcat (
  # $logfiles
){
  include my_corp::common
  class { 'java': }
  class { 'tomcat': }
  class { 'my_corp_api': }

  sensu::subscription { 'tomcat': }
  # create_resources('rsyslog::imfile', $logfiles )
}

Also tried using class { "tomcat": version => "8.0.32-1ubuntu1.3"} as per your example above with the same result.

Seems like it's possible it's a bad configuration somewhere on my end. I'll investigate more and get back to you. Thanks for the response.

antoineco commented 7 years ago

Alright thanks, I hope you'll manage to narrow it down.

In my previous example I set the version parameter to "8.0.32-1ubuntu1.3" because the package in Ubuntu's repo is newer than what the module expects. But the real issue here shouldn't be the version. Both the default package name and version come from tomcat::params.

One workaround before you find the issue on your end would be to set the package name when calling the class:

  class { "tomcat":
    package_name => "tomcat8",
    version      => "8.0.32-1ubuntu1.3"
  }'
zfredrickson commented 7 years ago

I found the problem and it was on my end. It centered around the way I had installed the module. Thanks for the replies. They pointed me in the right direction. Apologies for the erroneous issue report.

antoineco commented 7 years ago

No problem, happy to help :+1: