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

Error when running puppet-lint #862

Closed
llamadog123 opened this issue Jun 13, 2019 · 1 comment
Closed

Error when running puppet-lint #862

llamadog123 opened this issue Jun 13, 2019 · 1 comment

Comments

@llamadog123
Copy link

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
Copy link
Collaborator

Files must pass the puppet parser validate check before puppet-lint will work on them:

Error: Could not parse for environment production: Syntax error at '}' (file: /home/rnelson0/test.pp, line: 101, column: 5)

Near that line is subscribe => [Package['bugzilla'], which is missing the closing brace. The same issue repeats a few lines below. Once that's fixed, puppet-lint works normally:

ERROR: trailing whitespace found on line 34
ERROR: trailing whitespace found on line 43
ERROR: bugzilla not in autoload module layout on line 1
ERROR: single quoted string containing a variable found on line 41
WARNING: class not documented on line 1

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

No branches or pull requests

2 participants