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

Syntax error #624

Open
gdelhumeau opened this issue Sep 28, 2023 · 6 comments
Open

Syntax error #624

gdelhumeau opened this issue Sep 28, 2023 · 6 comments

Comments

@gdelhumeau
Copy link

Describe the Bug

I cannot clone a repository.

Expected Behavior

It should clone the repository.

Steps to Reproduce

This is my manifest:

vcsrepo { '/etc/test/repo':
    ensure   => present,
    provider => git,
    source   => 'https://someUrl/repo.git',
    require => [ File['/etc/test'], Package['git'] ]
  }

I get the following error, when I execute /opt/puppetlabs/puppet/bin/puppet agent -t on the agent:

2023-09-28 17:02:15.134363 WARN  puppetlabs.facter - locale environment variables were bad; continuing with LANG=C LC_ALL=C
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Loading facts
Error: Could not autoload puppet/provider/vcsrepo/cvs: /opt/puppetlabs/puppet/cache/lib/puppet/provider/vcsrepo/cvs.rb:77: syntax error, unexpected ']'
        @rev = contents[1..]
                           ^
Error: Could not autoload puppet/type/vcsrepo: Could not autoload puppet/provider/vcsrepo/cvs: /opt/puppetlabs/puppet/cache/lib/puppet/provider/vcsrepo/cvs.rb:77: syntax error, unexpected ']'
        @rev = contents[1..]
                           ^
Error: Failed to apply catalog: Could not autoload puppet/type/vcsrepo: Could not autoload puppet/provider/vcsrepo/cvs: /opt/puppetlabs/puppet/cache/lib/puppet/provider/vcsrepo/cvs.rb:77: syntax error, unexpected ']'
        @rev = contents[1..]

Environment (on the agent)

  • Version: Puppet v6.28.0
  • Platform: Debian GNU/Linux 11 (bullseye)

Environment (on the server)

  • Version: Puppet v7.25.0
  • Platform: Debian GNU/Linux 11 (bullseye)
  • VCSRepo version: 6.1.0
@kenyon
Copy link

kenyon commented Sep 30, 2023

Same as #620 and #618.

@anthonysomerset
Copy link

According to #601 - Puppet 6 support is dropped, i had same issue - fixed by upgrading the agent to 7.x

@bugfood
Copy link

bugfood commented Jan 3, 2024

I'm getting a similar error on an AlmaLinux 8 host running puppetserver 7.6.

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Type-Name, Could not autoload puppet/type/vcsrepo: Could not autoload puppet/provider/vcsrepo/cvs: /etc/puppetlabs/code/modules/vcsrepo/lib/puppet/provider/vcsrepo/cvs.rb:77: syntax error, unexpected '{ arg'
        @rev = contents[1..]
                           ^ (file: /etc/puppetlabs/code/local_environments/production/modules/custom/manifests/repo.pp, line: 110, column: 60) (file: /etc/puppetlabs/code/local_environments/production/modules/<redacted>, line: 43) on node <redacted>

The strange thing is that this happens only on the first catalog compilation that uses vcsrepo after a restart. Subsequent compilations that use vcsrepo (for either the same client or for other clients) are fine. Compilations of catalogs without vcsrepo have no effect either way.

This is running puppetserver from a puppetlabs RPM, so It should be using the vendored ruby (and jruby).

$ rpm -qa puppetserver
puppetserver-7.6.0-1.el8.noarch

For what it's worth, the system ruby is new enough as well:

$ ruby --version
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]

I don't think this is the same bug as originally reported, but it's caused by the same commit:
f91d02d
Reverting that commit makes the problem go away.

I'm not currently in a position to try a newer puppetserver, but I wanted to write this issue down somewhere, for now.

@kenyon
Copy link

kenyon commented Jan 3, 2024

@bugfood that might be fixed by doing a puppet generate types or restarting puppetserver.

kenyon referenced this issue Jan 3, 2024
- Style/NumericPredicate
- Style/SlicingWithRange
@bugfood
Copy link

bugfood commented Jan 3, 2024

@bugfood that might be fixed by doing a puppet generate types or restarting puppetserver.

Thanks, but this problem manifests immediately after a restart of puppetserver--and then goes away after the first time it happens.

I don't know about puppet generate types. I've never run this before, but it seems to have something to do with environment isolation, which we don't use.

https://www.puppet.com/docs/puppet/7/environment_isolation.html#env_generate_types

@hesco
Copy link

hesco commented Apr 10, 2024

According to #601 - Puppet 6 support is dropped, i had same issue - fixed by upgrading the agent to 7.x

This was also the fix for me.

As an enhancement, I urge that this line (77) which fails with puppet6 on the agent (not the puppetserver, as suggested above, and which for my own environment had previously been upgraded to 7), be wrapped in a try...catch which links to this thread and advises an upgrade of puppet on the client.

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

6 participants