abrader-gms icon indicating copy to clipboard operation
abrader-gms copied to clipboard

Compile error - no such file to load puppet_x/gms/type

Open rjhornsby opened this issue 8 years ago • 21 comments

Having a difficult time compiling a catalog on puppetserver 2.4.0 (FOSS). I'm sure that gms 1.0.3 worked previously, because I upgraded to fix the minor permissions issue in 1.0.2.

A puppet run throws an error compiling the catalog containing gms:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/git_deploy_key: no such file to load -- puppet_x/gms/type at /etc/puppetlabs/code/environments/qa/site/profile/manifests/puppetmaster.pp:29:5 on node <puppetmaster>

The reference to line 29 is this block in the puppetmaster profile:

    git_deploy_key { 'add_deploy_key_to_puppet_control':
      provider      => 'gitlab',
      ensure        => present,
      name          => "r10k-$::fqdn",
      path          => '/etc/puppetlabs/puppet/r10k-id_rsa.pub',
      token         => hiera('gitlab_api_token'),
      project_name  => 'puppet/control-repo',
      server_url    => 'http://gitlab.mycorp.com',
    }

From looking at the puppetserver logs, it looks like the issue is the require line in gms/lib/puppet/type/git_deploy_key.rb

The top of the stacktrace points here

2016-07-07 10:27:26,907 ERROR [qtp803704776-67] [puppetserver] Puppet Could not autoload puppet/type/git_deploy_key: no such file to load -- puppet_x/gms/type
org/jruby/RubyKernel.java:1072:in `require'
/opt/puppetlabs/server/apps/puppetserver/puppet-server-release.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:54:in `require'
/etc/puppetlabs/code/environments/lab/modules/gms/lib/puppet/type/git_deploy_key.rb:1:in `(root)'
...

Just in case I messed something up, I wiped gms from the modules directory and wiped r10k's cache (and redeploying the env), and also tried unpacking the module from a github-downloaded zip file into the modules directory. Same result.

It seems as if maybe there's a ruby search path issue here, but I'm not advanced enough yet to understand how to fix it.

rjhornsby avatar Jul 07 '16 18:07 rjhornsby

@rjhornsby the required file is here: https://github.com/abrader/abrader-gms/blob/master/lib/puppet_x/gms/type.rb

You sure it's on your master in the correct location? If so, please provide the full stack trace. Also, keep in mind I've only ever said this module would work on Puppet 3.2 or later. I'll do the best I can to help.

abrader avatar Jul 07 '16 21:07 abrader

Sorry I should have been more clear, we are running puppet 4.5.1 (seeing same issue on 4.4.1 if it matters). "2.4.0" referred to what puppetserver --version reports.

Attaching the stacktrace as requested.

The file is definitely present (tree below). It's weird, like ruby just isn't able to find it. The permissions on the file look fine as well.

-rw-r--r--. 1 root root 1570 Jun 7 21:45 lib/puppet_x/gms/type.rb

$ pwd; tree lib
/etc/puppetlabs/code/environments/lab/modules/gms
lib
├── puppet
│   ├── provider
│   │   ├── git_deploy_key
│   │   │   ├── github.rb
│   │   │   ├── gitlab.rb
│   │   │   └── stash.rb
│   │   ├── git_groupteam
│   │   │   └── gitlab.rb
│   │   ├── git_groupteam_member
│   │   │   └── gitlab.rb
│   │   ├── git_webhook
│   │   │   ├── github.rb
│   │   │   ├── gitlab.rb
│   │   │   └── stash.rb
│   │   └── gms_webhook
│   │       └── github.rb
│   └── type
│       ├── git_deploy_key.rb
│       ├── git_groupteam_member.rb
│       ├── git_groupteam.rb
│       ├── git_webhook.rb
│       └── gms_webhook.rb
└── puppet_x
    ├── gms
    │   ├── provider.rb
    │   └── type.rb
    └── puppetlabs
        ├── gms.rb
        └── property
            └── read_only.rb

12 directories, 18 files

puppetserver.txt

rjhornsby avatar Jul 07 '16 22:07 rjhornsby

I'm seeing the same issue on puppet 4.7.0:

$ sudo /opt/puppetlabs/bin/puppet agent -t
Info: Using configured environment 'staging'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/git_deploy_key: no such file to load -- puppet_x/gms/type at /etc/puppetlabs/code/environments/staging/site/profiles/manifests/app/rack/puma.pp:19:7 on node [nodename]
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

simmerz avatar Oct 13 '16 09:10 simmerz

Same here, FOSS 4.7.0 on CentOS7, gms deployed by r10k to the correct path:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_deploy_key]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_deploy_key/github.rb]/ensure: defined content as '{md5}cb4a7d101fb5af2343200292df03a9d0'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_deploy_key/gitlab.rb]/ensure: defined content as '{md5}6ee580603d12ad71d2ab224bf2258766'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_deploy_key/stash.rb]/ensure: defined content as '{md5}5de0fc621678ca56b5a39d8f69a09fc6'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_groupteam]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_groupteam/gitlab.rb]/ensure: defined content as '{md5}1f07a22bf05d16fdb8c7f3e99aa51ac1'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_groupteam_member]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_groupteam_member/gitlab.rb]/ensure: defined content as '{md5}a1e10b358cce53b093594b74453c9147'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_webhook]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_webhook/github.rb]/ensure: defined content as '{md5}b3a2444b479414c72a95659a71597e41'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_webhook/gitlab.rb]/ensure: defined content as '{md5}02819a1ead5087388dfeb22cc9fb02f3'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/git_webhook/stash.rb]/ensure: defined content as '{md5}c9d22dee734bb8f3477e54c00b6663c5'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/gms_webhook]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/provider/gms_webhook/github.rb]/ensure: defined content as '{md5}946565b2996fffb0fef84e359499fa7d'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/type/git_deploy_key.rb]/ensure: defined content as '{md5}6f0193238129cc86f7083a9117e143a9'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/type/git_groupteam.rb]/ensure: defined content as '{md5}4f1cb732dd205d53b7ce3b180440c024'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/type/git_groupteam_member.rb]/ensure: defined content as '{md5}a4b94d446b8ee652bee21ffb55592d12'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/type/git_webhook.rb]/ensure: defined content as '{md5}5a2e03e4676e39112512f0e3151d79ca'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet/type/gms_webhook.rb]/ensure: defined content as '{md5}5c42f49bda9d1928aad96c93972e576a'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet_x/gms]/ensure: created
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet_x/gms/provider.rb]/ensure: defined content as '{md5}8101c6778b645100896df28ffa8d4251'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet_x/gms/type.rb]/ensure: defined content as '{md5}f731c0c8cfe36ef8a1243396857fb626'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet_x/puppetlabs/gms.rb]/ensure: defined content as '{md5}176f9b91411d221e8173d261ceb572fe'
Notice: /File[/opt/puppetlabs/puppet/cache/lib/puppet_x/puppetlabs/property/read_only.rb]/ensure: defined content as '{md5}f5f31fa514fa035c886088b025020425'
Info: Loading facts
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/git_deploy_key: no such file to load -- puppet_x/gms/type at /etc/puppetlabs/code/environments/production/site/profile/manifests/temp/git.pp:54:3 on node puppet
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

seefood avatar Oct 13 '16 13:10 seefood

Well, I ended up implementing a gitlab custom_hooks/post-recieve triggering r10k via sudo. ugly but works. still, I'd love to get this working if I can. seems like the more elegant solution.

seefood avatar Oct 16 '16 09:10 seefood

@seefood @simmerz @rjhornsby All FOSS? What version of Ruby? Back from Puppetconf so I can take a look.

abrader avatar Oct 25 '16 16:10 abrader

Yes, FOSS Puppet. I can only assume the version of Ruby is whatever ships/embeds with Puppet 4.5.1 but I don't recall what Ruby version that is. Sorry I can't be more help, I recently switched to the dark side (chef) at a new gig.

rjhornsby avatar Oct 25 '16 18:10 rjhornsby

All FOSS and bundled ruby with puppetlabs puppet debs

simmerz avatar Oct 25 '16 18:10 simmerz

@simmerz I am not seeing the issue in the multiple versions of PE I've tested thus far today. Which PE version(s) can you confirm you've seen the issue arise?

abrader avatar Oct 25 '16 19:10 abrader

@abrader

simmerz@puppet:~$ /opt/puppetlabs/puppet/bin/puppet --version
4.7.0
simmerz@puppet:~$ /opt/puppetlabs/puppet/bin/ruby --version
ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]

It's not PE, it's FOSS.

simmerz avatar Oct 25 '16 19:10 simmerz

I'm not using PE, I'm using FOSS. Latest stable for Ubuntu Xenial.

On Tue, 25 Oct 2016, 20:06 Andrew Brader, [email protected] wrote:

@simmerz https://github.com/simmerz I am not seeing the issue in the multiple versions of PE I've tested thus far today. Which PE version(s) can you confirm you've seen the issue arise?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/abrader/abrader-gms/issues/33#issuecomment-256144499, or mute the thread https://github.com/notifications/unsubscribe-auth/AABfBwApvZEWGZXfZBywKesc8M3los1iks5q3lNFgaJpZM4JHXhO .

Tomislav Simnett Managing Director - Initforthe T: 0161 441 4877 M: 07786 441 844 W: https://initforthe.com

simmerz avatar Oct 25 '16 21:10 simmerz

@simmerz @seefood I fixed this recently in the gms_webhook type thus resolving this and another matter. I will release the update as soon as possible. I reply here when it is complete.

abrader avatar Nov 10 '16 13:11 abrader

@rjhornsby

Any chance you remember what you implemented as a workaround? It seems I've re-introduced this issue recently after running some OS and puppet agent updates.

andrewcoots avatar Dec 05 '16 21:12 andrewcoots

I'm seeing the same on Puppet 4.8.2 / Puppetserver 2.7.2. Using the FOSS AIO packages.

tun0 avatar Feb 14 '17 15:02 tun0

I fixed this recently in the gms_webhook type thus resolving this and another matter. I will release the update as soon as possible. I reply here when it is complete.

@abrader, any update on this?

tun0 avatar Feb 17 '17 09:02 tun0

@abrader Is there a work around for this while we wait for the fix to be released or can you point me to a commit that this has been addressed in?

bmarshallbri avatar Mar 30 '17 02:03 bmarshallbri

@bmarshallbri I am working on code now which will fix this matter. I have some testing to complete as well. Could be a couple weeks. Best answer I can give you unfortunately.

abrader avatar Mar 30 '17 12:03 abrader

I ended up resolving this by appending an additional ruby path in the file below (the second entry is what I added).

puppetserver.conf: ruby-load-path: [/opt/puppetlabs/puppet/lib/ruby/vendor_ruby,/opt/puppetlabs/puppet/modules/gms/lib]

bmarshallbri avatar Apr 05 '17 14:04 bmarshallbri

Also running into this error, version FOSS 4.10.1. Sounds like the official fix might be a bit backlogged, anyone have a fork/tweak they could recommend in the meantime?

Justin-DynamicD avatar Jun 05 '17 16:06 Justin-DynamicD

any news on this issue, I am using puppet 4.10 on Debian 8 and still has this problem, using bmarshallbri workaround solved my problem.

c4m4 avatar Aug 11 '17 17:08 c4m4

FYI. Running puppet generate types for the environment has fixed this issue for me. I am adding this command to my r10k deploy webhook. Running puppet 4.10 https://puppet.com/docs/puppet/5.3/environment_isolation.html#enable-environment-isolation-with-puppet

greend139 avatar Feb 13 '18 13:02 greend139