rodjek / puppet-lint

Check that your Puppet manifests conform to the style guide
MIT License
819 stars 204 forks source link

Error when running puppet-lint #861

Closed llamadog123 closed 5 years ago

llamadog123 commented 5 years ago

Whoops! It looks like puppet-lint has encountered an error that it doesn't know how to handle. Please open an issue at https://github.com/rodjek/puppet-lint and paste the following output into the issue description.

puppet-lint version: 2.3.3 ruby version: 2.5.1-p57 platform: x86_64-linux-gnu file path: init.pp file contents:

## Sets the base config for the bugzilla deploy in puppet
class bugzilla {
    include settings
    include ::wget
    $basedir = '/usr/share/bugzilla'
    $altdir = '/usr/local/share/bugzilla'
    $httpconf = '/etc/httpd/conf.d'
    $filename = '/usr/share/testopia-2.5-BUGZILLA-4.2.tar.gz'

    Exec {
        path => ['/bin', '/sbin', '/usr/bin', '/usr/sbin'],
    }

    yumrepo {'osrepo':
        baseurl => 'redacted',
        enabled  => 1,
        gpgcheck => 0,
    }

    package {'httpd':
        ensure => present,
    }

    package {'mod_ssl':
        ensure => present,
    }

    package {'mod_perl':
        ensure => present,
    }

    package {'bugzilla':
        ensure  => '4.4.13-3',
        require => Yumrepo['osrepo'],

    }
    wget::fetch { 'https://ftp.mozilla.org/pub/mozilla.org/webtools/testopia/testopia-2.5-BUGZILLA-4.2.tar.gz':
        destination => '/usr/share/bugzilla',
    }
    exec  { 'Extract tar':
        refreshonly => true,
        command => 'tar --overwrite xf ${filename}',
        }

    service {'httpd':
        ensure    => running,
        enable    => true,
        require   => [Package['httpd'], Package['mod_perl']],
        alias     => apache,
        subscribe => [File['bugzilla-main.conf'],
            File['bugzilla-ssl.conf'],
            File['server.crt'],
            File['server.key'],],
    }

    file {'bugzilla-main.conf':
        ensure  => file,
        path    => "${httpconf}/bugzilla-main.conf",
        owner   => root,
        group   => root,
        mode    => '0644',
        content => template('bugzilla/bugzilla-main.conf.erb'),
        require => [Package['bugzilla'], Package['httpd'],],
    }

    file {'bugzilla-ssl.conf':
        ensure  => file,
        path    => "${httpconf}/bugzilla-ssl.conf",
        owner   => root,
        group   => root,
        mode    => '0644',
        content => template('bugzilla/bugzilla-ssl.conf.erb'),
        require => [Package['bugzilla'], Package['mod_ssl'],],
    }

    file {'server.crt':
        ensure  => file,
        path    => "${httpconf}/server.crt",
        owner   => apache,
        group   => apache,
        mode    => '0644',
        source  => 'puppet:///modules/bugzilla/server.crt',
        require => Package['mod_ssl'],
    }

    file {'server.key':
        ensure  => file,
        path    => "${httpconf}/server.key",
        owner   => apache,
        group   => apache,
        mode    => '0600',
        source  => 'puppet:///modules/bugzilla/server.key',
        require => Package['mod_ssl'],
    }

    file {$basedir:
        ensure    => directory,
        subscribe => [Package['bugzilla'],
        owner     => apache,
        group     => apache,
        recurse   => true,
    }

    file {$altdir:
        ensure    => directory,
        subscribe => [Package['bugzilla'],
        owner     => root,
        group     => apache,
        recurse   => true,
    }

    cron {'bugzillastats':
        ensure  => present,
        command => "cd ${basedir} && ${basedir}/collectstats.pl",
        user    => apache,
        hour    => '1',
        require => Package['bugzilla'],
    }

    cron {'bugzillawhine':
        ensure  => present,
        command => "cd ${basedir} && env LANG=C ${basedir}/whine.pl",
        user    => apache,
        minute  => '*/15',
        require => Package['bugzilla'],
    }

    exec {'checksetup':
        command     => "${altdir}/checksetup.sh",
        subscribe   => [Package['bugzilla'],
                        Package['testopia'],
                        File['checksetup.sh'],],
        timeout     => '-1',
        refreshonly => true,
    }

    file {'checksetupanswers':
        path    => "${altdir}/checksetupanswers",
        owner   => root,
        group   => apache,
        mode    => '0600',
        content => template('bugzilla/checksetupanswers.erb'),
        notify  => Exec['checksetup'],
        require => Package['bugzilla'],
    }

    file {'checksetup.sh':
        path    => "${altdir}/checksetup.sh",
        owner   => root,
        group   => apache,
        mode    => '0700',
        content => template('bugzilla/checksetup.sh.erb'),
        #notify => Exec["checksetup"],
        require => Package['bugzilla'],
    }
}

error:

NoMethodError: undefined method `next_token' for nil:NilClass
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:196:in `find_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:142:in `next_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:189:in `find_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:142:in `next_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:191:in `find_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/lexer/token.rb:142:in `next_token_of'
/usr/lib/ruby/vendor_ruby/puppet-lint/data.rb:176:in `block in resource_indexes'
/usr/lib/ruby/vendor_ruby/puppet-lint/data.rb:171:in `each'
/usr/lib/ruby/vendor_ruby/puppet-lint/data.rb:171:in `resource_indexes'
/usr/lib/ruby/vendor_ruby/puppet-lint/checkplugin.rb:81:in `resource_indexes'
/usr/lib/ruby/vendor_ruby/puppet-lint/plugins/check_whitespace/arrow_alignment.rb:9:in `check'
/usr/lib/ruby/vendor_ruby/puppet-lint/checkplugin.rb:21:in `run'
/usr/lib/ruby/vendor_ruby/puppet-lint/checks.rb:60:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet-lint/checks.rb:57:in `each'
/usr/lib/ruby/vendor_ruby/puppet-lint/checks.rb:57:in `run'
/usr/lib/ruby/vendor_ruby/puppet-lint.rb:196:in `run'
/usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:59:in `block in run'
/usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:56:in `each'
/usr/lib/ruby/vendor_ruby/puppet-lint/bin.rb:56:in `run'
/usr/bin/puppet-lint:7:in `<main>'

Did I done goof?

I can't seem to run puppet-lint on this one.

rnelson0 commented 5 years ago

Duplicate of #862