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

"undefined method `map' for nil:NilClass" when running check_whitespace #681

Closed
domcleal opened this issue Mar 29, 2017 · 9 comments
Closed

"undefined method `map' for nil:NilClass" when running check_whitespace #681

domcleal opened this issue Mar 29, 2017 · 9 comments

Comments

@domcleal
Copy link
Contributor

@domcleal domcleal commented Mar 29, 2017

When running puppet-lint 2.2.0 against puppetlabs-postgresql's params.pp, it fails with:

NoMethodError: undefined method `map' for nil:NilClass
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:181:in `block (2 levels) in check'

The whole file is also available here.

puppet-lint version: 2.2.0
ruby version: 2.3.1-p112
platform: x86_64-linux
file path: manifests/params.pp
file contents:

# PRIVATE CLASS: do not use directly
class postgresql::params inherits postgresql::globals {
  $version                    = $postgresql::globals::globals_version
  $postgis_version            = $postgresql::globals::globals_postgis_version
  $listen_addresses           = 'localhost'
  $port                       = 5432
  $log_line_prefix            = '%t '
  $ip_mask_deny_postgres_user = '0.0.0.0/0'
  $ip_mask_allow_all_users    = '127.0.0.1/32'
  $ipv4acls                   = []
  $ipv6acls                   = []
  $encoding                   = $postgresql::globals::encoding
  $locale                     = $postgresql::globals::locale
  $timezone                   = $postgresql::globals::timezone
  $service_ensure             = 'running'
  $service_enable             = true
  $service_manage             = true
  $service_restart_on_change  = true
  $service_provider           = $postgresql::globals::service_provider
  $manage_pg_hba_conf         = pick($manage_pg_hba_conf, true)
  $manage_pg_ident_conf       = pick($manage_pg_ident_conf, true)
  $manage_recovery_conf       = pick($manage_recovery_conf, false)
  $package_ensure             = 'present'
  $module_workdir             = pick($module_workdir,'/tmp')
  # Amazon Linux's OS Family is 'Linux', operating system 'Amazon'.
  case $::osfamily {
    'RedHat', 'Linux': {
      $link_pg_config     = true
      $user               = pick($user, 'postgres')
      $group              = pick($group, 'postgres')
      $needs_initdb       = pick($needs_initdb, true)
      $version_parts      = split($version, '[.]')
      $package_version    = "${version_parts[0]}${version_parts[1]}"
      if $version == $postgresql::globals::default_version and $::operatingsystem != 'Amazon' {
        $client_package_name    = pick($client_package_name, 'postgresql')
        $server_package_name    = pick($server_package_name, 'postgresql-server')
        $contrib_package_name   = pick($contrib_package_name,'postgresql-contrib')
        $devel_package_name     = pick($devel_package_name, 'postgresql-devel')
        $java_package_name      = pick($java_package_name, 'postgresql-jdbc')
        $docs_package_name      = pick($docs_package_name, 'postgresql-docs')
        $plperl_package_name    = pick($plperl_package_name, 'postgresql-plperl')
        $plpython_package_name  = pick($plpython_package_name, 'postgresql-plpython')
        $service_name           = pick($service_name, 'postgresql')
        $bindir                 = pick($bindir, '/usr/bin')
        $datadir                = $::operatingsystem ? {
          'Amazon' => pick($datadir, "/var/lib/pgsql${package_version}/data"),
          default  => pick($datadir, '/var/lib/pgsql/data'),
        }
        $confdir                = pick($confdir, $datadir)
      } else {
        $client_package_name    = pick($client_package_name, "postgresql${package_version}")
        $server_package_name    = pick($server_package_name, "postgresql${package_version}-server")
        $contrib_package_name   = pick($contrib_package_name,"postgresql${package_version}-contrib")
        $devel_package_name     = pick($devel_package_name, "postgresql${package_version}-devel")
        $java_package_name      = pick($java_package_name, "postgresql${package_version}-jdbc")
        $docs_package_name      = pick($docs_package_name, "postgresql${package_version}-docs")
        $plperl_package_name    = pick($plperl_package_name, "postgresql${package_version}-plperl")
        $plpython_package_name  = pick($plpython_package_name, "postgresql${package_version}-plpython")
        $service_name           = $::operatingsystem ? {
          'Amazon' => pick($service_name, "postgresql${version_parts[0]}${version_parts[1]}"),
          default  => pick($service_name, "postgresql-${version}"),
        }
        $bindir                 = $::operatingsystem ? {
          'Amazon' => pick($bindir, '/usr/bin'),
          default  => pick($bindir, "/usr/pgsql-${version}/bin"),
        }
        $datadir                = $::operatingsystem ? {
          'Amazon' => pick($datadir, "/var/lib/pgsql${package_version}/data"),
          default  => pick($datadir, "/var/lib/pgsql/${version}/data"),
        }
        $confdir                = pick($confdir, $datadir)
      }
      $psql_path           = pick($psql_path, "${bindir}/psql")
      $service_status      = $service_status
      $service_reload      = "service ${service_name} reload"
      $perl_package_name   = pick($perl_package_name, 'perl-DBD-Pg')
      $python_package_name = pick($python_package_name, 'python-psycopg2')
      if $postgresql::globals::postgis_package_name {
        $postgis_package_name = $postgresql::globals::postgis_package_name
      } elsif $::operatingsystemrelease =~ /^5\./ {
        $postgis_package_name = 'postgis'
      } elsif $postgis_version and versioncmp($postgis_version, '2') < 0 {
        $postgis_package_name = "postgis${package_version}"
      } else {
        $postgis_package_name = "postgis2_${package_version}"
      }
    }
    'Archlinux': {
      $link_pg_config     = true
      $needs_initdb       = pick($needs_initdb, true)
      $user               = pick($user, 'postgres')
      $group              = pick($group, 'postgres')
      # Archlinux doesn't have a client-package but has a libs package which
      # pulls in postgresql server
      $client_package_name    = pick($client_package_name, 'postgresql')
      $server_package_name    = pick($server_package_name, 'postgresql-libs')
      $java_package_name      = pick($java_package_name, 'postgresql-jdbc')
      # Archlinux doesn't have develop packages
      $devel_package_name     = pick($devel_package_name, 'postgresql-devel')
      # Archlinux does have postgresql-contrib but it isn't maintained
      $contrib_package_name   = pick($contrib_package_name,'undef')
      # Archlinux postgresql package provides plperl
      $plperl_package_name    = pick($plperl_package_name, 'undef')
      $plpython_package_name  = pick($plpython_package_name, 'undef')
      $service_name           = pick($service_name, 'postgresql')
      $bindir                 = pick($bindir, '/usr/bin')
      $datadir                = pick($datadir, '/var/lib/postgres/data')
      $confdir                = pick($confdir, $datadir)
      $psql_path              = pick($psql_path, "${bindir}/psql")
      $service_status         = $service_status
      $service_reload         = "systemctl reload ${service_name}"
      $python_package_name    = pick($python_package_name, 'python-psycopg2')
      # Archlinux does not have a perl::DBD::Pg package
      $perl_package_name      = pick($perl_package_name, 'undef')
    }
    'Debian': {
      $link_pg_config     = false
      $user               = pick($user, 'postgres')
      $group              = pick($group, 'postgres')
      if $postgresql::globals::manage_package_repo == true {
        $needs_initdb = pick($needs_initdb, true)
        $service_name = pick($service_name, 'postgresql')
      } else {
        $needs_initdb = pick($needs_initdb, false)
        $service_name = $::operatingsystem ? {
          'Debian' => pick($service_name, 'postgresql'),
          'Ubuntu' => $::lsbmajdistrelease ? {
            /^10/ => pick($service_name, "postgresql-${version}"),
            default => pick($service_name, 'postgresql'),
          },
          default => undef
        }
      }
      $client_package_name    = pick($client_package_name, "postgresql-client-${version}")
      $server_package_name    = pick($server_package_name, "postgresql-${version}")
      $contrib_package_name   = pick($contrib_package_name, "postgresql-contrib-${version}")
      if $postgis_version and versioncmp($postgis_version, '2') < 0 {
        $postgis_package_name = pick($postgis_package_name, "postgresql-${version}-postgis")
      } else {
        $postgis_package_name = pick($postgis_package_name, "postgresql-${version}-postgis-${postgis_version}")
      }
      $devel_package_name     = pick($devel_package_name, 'libpq-dev')
      $java_package_name = $::operatingsystem ? {
        'Debian' => $::operatingsystemrelease ? {
          /^6/    => pick($java_package_name, 'libpg-java'),
          default => pick($java_package_name, 'libpostgresql-jdbc-java'),
        },
      default  => pick($java_package_name, 'libpostgresql-jdbc-java'),
      }
      $perl_package_name      = pick($perl_package_name, 'libdbd-pg-perl')
      $plperl_package_name    = pick($plperl_package_name, "postgresql-plperl-${version}")
      $plpython_package_name  = pick($plpython_package_name, "postgresql-plpython-${version}")
      $python_package_name    = pick($python_package_name, 'python-psycopg2')
      $bindir                 = pick($bindir, "/usr/lib/postgresql/${version}/bin")
      $datadir                = pick($datadir, "/var/lib/postgresql/${version}/main")
      $confdir                = pick($confdir, "/etc/postgresql/${version}/main")
      if $::operatingsystem == 'Debian' and versioncmp($::operatingsystemrelease, '8.0') >= 0 {
        # Jessie uses systemd
        $service_status = pick($service_status, "/usr/sbin/service ${service_name}@*-main status")
      } elsif $::operatingsystem == 'Ubuntu' and versioncmp($::operatingsystemrelease, '15.04') >= 0 {
        # Ubuntu releases since vivid use systemd
        $service_status = pick($service_status, "/usr/sbin/service ${service_name} status")
      } else {
        $service_status = pick($service_status, "/etc/init.d/${service_name} status | /bin/egrep -q 'Running clusters: .+|online'")
      }
      $service_reload         = "service ${service_name} reload"
      $psql_path              = pick($psql_path, '/usr/bin/psql')
    }
    'Gentoo': {
      $user                = pick($user, 'postgres')
      $group               = pick($group, 'postgres')
      $client_package_name  = pick($client_package_name, 'UNSET')
      $server_package_name  = pick($server_package_name, 'postgresql')
      $contrib_package_name = pick_default($contrib_package_name, undef)
      $devel_package_name   = pick_default($devel_package_name, undef)
      $java_package_name    = pick($java_package_name, 'jdbc-postgresql')
      $perl_package_name    = pick($perl_package_name, 'DBD-Pg')
      $plperl_package_name  = undef
      $python_package_name  = pick($python_package_name, 'psycopg')
      $service_name         = pick($service_name, "postgresql-${version}")
      $bindir               = pick($bindir, "/usr/lib/postgresql-${version}/bin")
      $datadir              = pick($datadir, "/var/lib/postgresql/${version}_data")
      $confdir              = pick($confdir, "/etc/postgresql-${version}")
      $service_status       = pick($service_status, "systemctl status ${service_name}")
      $service_reload       = "systemctl reload ${service_name}"
      $psql_path            = pick($psql_path, "${bindir}/psql")
      $needs_initdb         = pick($needs_initdb, true)
    }
    'FreeBSD': {
      case $version {
        '96': {
          $user                 = pick($user, 'postgres')
          $group                = pick($group, 'postgres')
          $datadir              = pick($datadir, "/var/db/postgres/data${version}")
        }
        default: {
          $user                 = pick($user, 'pgsql')
          $group                = pick($group, 'pgsql')
          $datadir              = pick($datadir, '/usr/local/pgsql/data')
        }
      }
      $link_pg_config       = true
      $client_package_name  = pick($client_package_name, "databases/postgresql${version}-client")
      $server_package_name  = pick($server_package_name, "databases/postgresql${version}-server")
      $contrib_package_name = pick($contrib_package_name, "databases/postgresql${version}-contrib")
      $devel_package_name   = pick($devel_package_name, 'databases/postgresql-libpqxx3')
      $java_package_name    = pick($java_package_name, 'databases/postgresql-jdbc')
      $perl_package_name    = pick($plperl_package_name, 'databases/p5-DBD-Pg')
      $plperl_package_name  = pick($plperl_package_name, "databases/postgresql${version}-plperl")
      $python_package_name  = pick($python_package_name, 'databases/py-psycopg2')
      $service_name         = pick($service_name, 'postgresql')
      $bindir               = pick($bindir, '/usr/local/bin')
      $confdir              = pick($confdir, $datadir)
      $service_status       = pick($service_status, "/usr/local/etc/rc.d/${service_name} onestatus")
      $service_reload       = "service ${service_name} reload"
      $psql_path            = pick($psql_path, "${bindir}/psql")
      $needs_initdb         = pick($needs_initdb, true)
    }
    'OpenBSD': {
      $user                = pick($user, '_postgresql')
      $group               = pick($group, '_postgresql')
      $client_package_name  = pick($client_package_name, 'postgresql-client')
      $server_package_name  = pick($server_package_name, 'postgresql-server')
      $contrib_package_name = pick($contrib_package_name, 'postgresql-contrib')
      $devel_package_name   = pick($devel_package_name, 'postgresql-client')
      $java_package_name    = pick($java_package_name, 'postgresql-jdbc')
      $perl_package_name    = pick($perl_package_name, 'databases/p5-DBD-Pg')
      $plperl_package_name  = undef
      $python_package_name  = pick($python_package_name, 'py-psycopg2')
      $service_name         = pick($service_name, 'postgresql')
      $bindir               = pick($bindir, '/usr/local/bin')
      $datadir              = pick($datadir, '/var/postgresql/data')
      $confdir              = pick($confdir, $datadir)
      $service_status       = pick($service_status, "/etc/rc.d/${service_name} check")
      $service_reload       = "/etc/rc.d/${service_name} reload"
      $psql_path            = pick($psql_path, "${bindir}/psql")
      $needs_initdb         = pick($needs_initdb, true)
    }
    'Suse': {
      $link_pg_config       = true
      $user                 = pick($user, 'postgres')
      $group                = pick($group, 'postgres')
      $client_package_name  = pick($client_package_name, "postgresql${version}")
      $server_package_name  = pick($server_package_name, "postgresql${version}-server")
      $contrib_package_name = pick($contrib_package_name, "postgresql${version}-contrib")
      $devel_package_name   = pick($devel_package_name, "postgresql${version}-devel")
      $java_package_name    = pick($java_package_name, "postgresql${version}-jdbc")
      $perl_package_name    = pick($plperl_package_name, 'perl-DBD-Pg')
      $plperl_package_name  = pick($plperl_package_name, "postgresql${version}-plperl")
      $python_package_name  = pick($python_package_name, 'python-psycopg2')
      $service_name         = pick($service_name, 'postgresql')
      $bindir               = pick($bindir, "/usr/lib/postgresql${version}/bin")
      $datadir              = pick($datadir, '/var/lib/pgsql/data')
      $confdir              = pick($confdir, $datadir)
      $service_status       = pick($service_status, "/etc/init.d/${service_name} status")
      $service_reload       = "/etc/init.d/${service_name} reload"
      $psql_path            = pick($psql_path, "${bindir}/psql")
      $needs_initdb         = pick($needs_initdb, true)
    }
    default: {
      $link_pg_config       = true
      $psql_path            = pick($psql_path, "${bindir}/psql")
      # Since we can't determine defaults on our own, we rely on users setting
      # parameters with the postgresql::globals class. Here we are checking
      # that the mandatory minimum is set for the module to operate.
      $err_prefix = "Module ${module_name} does not provide defaults for osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}; please specify a value for ${module_name}::globals::"
      if ($needs_initdb == undef) { fail("${err_prefix}needs_initdb") }
      if ($service_name == undef) { fail("${err_prefix}service_name") }
      if ($client_package_name == undef) { fail("${err_prefix}client_package_name") }
      if ($server_package_name == undef) { fail("${err_prefix}server_package_name") }
      if ($bindir == undef) { fail("${err_prefix}bindir") }
      if ($datadir == undef) { fail("${err_prefix}datadir") }
      if ($confdir == undef) { fail("${err_prefix}confdir") }
    }
  }
  $validcon_script_path = pick($validcon_script_path, '/usr/local/bin/validate_postgresql_connection.sh')
  $initdb_path          = pick($initdb_path, "${bindir}/initdb")
  $pg_hba_conf_path     = pick($pg_hba_conf_path, "${confdir}/pg_hba.conf")
  $pg_hba_conf_defaults = pick($pg_hba_conf_defaults, true)
  $pg_ident_conf_path   = pick($pg_ident_conf_path, "${confdir}/pg_ident.conf")
  $postgresql_conf_path = pick($postgresql_conf_path, "${confdir}/postgresql.conf")
  $recovery_conf_path   = pick($recovery_conf_path, "${datadir}/recovery.conf")
  $default_database     = pick($default_database, 'postgres')
}

error:

NoMethodError: undefined method `map' for nil:NilClass
Did you mean?  tap
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:181:in `block (2 levels) in check'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:144:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:144:in `each_with_index'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:144:in `block in check'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:127:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/plugins/check_whitespace.rb:127:in `check'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/checkplugin.rb:21:in `run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/checks.rb:58:in `block in run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/checks.rb:56:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/checks.rb:56:in `run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint.rb:191:in `run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/tasks/puppet-lint.rb:79:in `block (3 levels) in define'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/tasks/puppet-lint.rb:77:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/tasks/puppet-lint.rb:77:in `block (2 levels) in define'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/file_utils_ext.rb:58:in `verbose'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppet-lint-2.2.0/lib/puppet-lint/tasks/puppet-lint.rb:71:in `block in define'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/puppetlabs_spec_helper-2.1.0/lib/puppetlabs_spec_helper/rake_tasks.rb:516:in `block in <top (required)>'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/travis/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/bin/rake:23:in `load'
/home/travis/build/puppet-testing/puppetlabs-postgresql/vendor/bundle/ruby/2.3.0/bin/rake:23:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `load'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:74:in `kernel_load'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli/exec.rb:27:in `run'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli.rb:335:in `exec'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor.rb:359:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli.rb:20:in `dispatch'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/vendor/thor/lib/thor/base.rb:440:in `start'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/cli.rb:11:in `start'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/exe/bundle:32:in `block in <top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/home/travis/.rvm/gems/ruby-2.3.1@global/gems/bundler-1.14.6/exe/bundle:24:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `load'
/home/travis/.rvm/gems/ruby-2.3.1/bin/bundle:23:in `<main>'
/home/travis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
@domcleal
Copy link
Contributor Author

@domcleal domcleal commented Mar 29, 2017

A more minimal reproducer:

case $::osfamily {
  'RedHat': {
    $datadir = $::operatingsystem ? {
      'Amazon' => pick($datadir, "/var/lib/pgsql${package_version}/data"),
      default  => pick($datadir, '/var/lib/pgsql/data'),
    }
  }
}
@davidhrbac
Copy link

@davidhrbac davidhrbac commented Mar 29, 2017

We are also affected by this bug. We are not able to use puppet-lint after upgrade to 2.2.0.

/cc @lukastopiarz

@rodjek
Copy link
Owner

@rodjek rodjek commented Mar 29, 2017

Thanks for the report, I'll take a look and push out a new release with a bugfix shortly

@davidhrbac
Copy link

@davidhrbac davidhrbac commented Mar 29, 2017

/cc @lpgsk

@davidhrbac
Copy link

@davidhrbac davidhrbac commented Mar 29, 2017

@rodjek thanks, probably the issues is on our side, we run Puppet 3.8.x. The README.md reads Release 2.1.0 of puppet-lint is the last planned version with support for Puppet 3 and Ruby 1.8.7. Future versions will drop support for these versions. Downgraded to 2.1.1 and lint runs smoothly again.

@domcleal
Copy link
Contributor Author

@domcleal domcleal commented Mar 29, 2017

For the record, this also causes the puppet-lint-trailing_comma-check plugin to log warnings against case statements in manifests.

67123e4 seems to be the cause, as resource_indexes now returns case statements as being resources.

@rodjek
Copy link
Owner

@rodjek rodjek commented Mar 29, 2017

Thanks for the investigation @domcleal. I've fixed the problem with resource_indexes will push out a 2.2.1 bugfix release shortly, once #680 has been resolved.

@domcleal
Copy link
Contributor Author

@domcleal domcleal commented Mar 29, 2017

Thanks for the quick fix, my tests are indeed passing now with master.

@davidhrbac
Copy link

@davidhrbac davidhrbac commented Mar 29, 2017

@rodjek thanks, 2.2.1 is OK. I guess the README.md should be modified...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

3 participants