puppetlabs / pdk

The shortest path to better modules: Puppet Development Kit; Download:
https://puppet.com/download-puppet-development-kit
Apache License 2.0
225 stars 105 forks source link

pdk does not contain the rake it wants #908

Closed squarebracket closed 2 years ago

squarebracket commented 4 years ago

Describe the bug This is probably the wrong repo to report this on, but since you're packing tools into packed tools, I am simply filing this here.

PDK is unable to run:

pdk bundle exec rake 'litmus:provision[vagrant, centos/7]'

It errors out with a stack trace-ish that complains about a lack of rake-12.3.3:

pdk (INFO): Using Ruby 2.5.8
pdk (INFO): Using Puppet 6.17.0
Provisioning centos/7 using vagrant provisioner.[|]rake aborted!
provisioning of centos/7 failed.
Results:
  localhost: {"_error"=>{"kind"=>"facter_task/failure", "msg"=>"Attempted to run\ncommand:'vagrant up --provider libvirt'\nstdout:\nstderr:/opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:91:in `block in materialize': Could not find rake-12.3.3 in any of the sources (Bundler::GemNotFound)\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in `map!'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/spec_set.rb:85:in `materialize'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:170:in `specs'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:237:in `specs_for'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/definition.rb:226:in `requested_specs'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:108:in `block in definition_method'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/runtime.rb:20:in `setup'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler.rb:107:in `setup'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/bundler/setup.rb:20:in `<top (required)>'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'\n\tfrom /opt/puppetlabs/pdk/private/ruby/2.5.8/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:54:in `require'\n"}}}
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_helper.rb:389:in `raise_bolt_errors'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_helper.rb:129:in `block in provision'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/honeycomb-beeline-2.1.1/lib/honeycomb/client.rb:65:in `start_span'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_helper.rb:121:in `provision'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_tasks.rb:51:in `block (3 levels) in <top (required)>'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_tasks.rb:38:in `each'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet_litmus-0.18.4/lib/puppet_litmus/rake_tasks.rb:38:in `block (2 levels) in <top (required)>'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/honeycomb-beeline-2.1.1/lib/honeycomb/integrations/rake.rb:21:in `block in execute'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/honeycomb-beeline-2.1.1/lib/honeycomb/client.rb:65:in `start_span'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/honeycomb-beeline-2.1.1/lib/honeycomb/integrations/rake.rb:16:in `execute'
/opt/puppetlabs/pdk/private/ruby/2.5.8/bin/bundle:23:in `load'
/opt/puppetlabs/pdk/private/ruby/2.5.8/bin/bundle:23:in `<main>'
Tasks: TOP => litmus:provision_list
(See full trace by running task with --trace)

To Reproduce

  1. Install pdk (in my case, from the fedora 31 repo).
  2. Clone puppetlabs-motd
  3. Try to run pdk bundle exec rake 'litmus:provision[vagrant, centos/7]'

Expected behavior It works.

Additional context

mmarod commented 4 years ago

This looks like the same issue as the one I filed here https://github.com/puppetlabs/bolt/issues/2117

scotje commented 4 years ago

@squarebracket The pdk bundle commands don't automatically run a bundle install, can you try running pdk bundle install (or pdk validate which will do it automatically if needed) before running the rake task?

@mmarod I think it's a slightly different issue actually, it looks like the Bolt team has fixed that logging issue now.

squarebracket commented 4 years ago

@scotje I did run pdk bundle install before this. I ran pdk validate just now to be safe:

$ pdk validate
pdk (INFO): Using Ruby 2.5.8
pdk (INFO): Using Puppet 6.17.0
pdk (INFO): Running all available validators...
[✔] Installing missing Gemfile dependencies.
┌ [✔] Running metadata validators ...
├── [✔] Checking metadata syntax (metadata.json tasks/*.json).
└── [✔] Checking module metadata style (metadata.json).
┌ [✔] Running puppet validators ...
├── [✔] Checking Puppet manifest syntax (**/*.pp).
├── [✔] Checking Puppet manifest style (**/*.pp).
└── [✔] Checking Puppet EPP syntax (**/*.epp).
┌ [✔] Running ruby validators ...
└── [✔] Checking Ruby code style (**/**.rb).
┌ [✔] Running tasks validators ...
├── [✔] Checking task names (tasks/**/*).
└── [✔] Checking task metadata style (tasks/*.json).
┌ [✔] Running yaml validators ...
└── [✔] Checking YAML syntax (**/*.yaml **/*.yml).
info: task-name: ./: Target does not contain any files to validate (["tasks/**/*"]).
info: task-metadata-lint: ./: Target does not contain any files to validate (["tasks/*.json"]).

But I still get the same Could not find rake-12.3.3 in any of the sources error when running pdk bundle exec rake 'litmus:provision[vagrant, centos/7]'.

I should point out, other pdk commands work fine. For instance, provisioning docker-based litmus nodes works fine:

$ pdk bundle exec rake 'litmus:provision[docker, litmusimage/centos:7]'
pdk bundle exec rake 'litmus:provision[docker, litmusimage/centos:7]'                                      
pdk (INFO): Using Ruby 2.5.8
pdk (INFO): Using Puppet 6.17.0
Provisioning litmusimage/centos:7 using docker provisioner.[✔]
localhost:2222, litmusimage/centos:7

Is this the right place to ask if vagrant is bundled with pdk and friends? Does it override PATH? I have vagrant installed / in my path, so if whatever is running things (bolt?) is just running vagrant up without overriding the environment, maybe that's causing conflicts?

squarebracket commented 4 years ago

I tried removing my distro packages and using upstream vagrant. pdk was able to provision a machine in virtualbox, but unfortunately we're a libvirt shop, and building the vagrant-libvirt plugin against upstream has several issues in Fedora that I've been unable to resolve to date.

To be clear, the distro-provided packages work fine on their own -- I can vagrant init centos/7 && vagrant up --provider=libvirt without issues -- it's only when run via pdk that I have problems. It would be nice if pdk could be changed to support the distro-provided packages.

If you can point me in the right direction, I can take a stab at fixing it, but from what I pasted above I don't really know what part/program in the call chain is causing issues or who might be requiring that version of rake.

github-actions[bot] commented 3 years ago

This issue has been marked stale because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.

github-actions[bot] commented 2 years ago

This issue was closed because it is open with no recent activity. The PDK Team is actively prioritizing existing bugs and new features, if this issue is still important to you please comment and we will add this to our backlog to complete.