pdk icon indicating copy to clipboard operation
pdk copied to clipboard

Impossible to update from version 3.3.0

Open philippeganz opened this issue 1 year ago • 3 comments

Describe the bug I'm using a module running on pdk version 3.3.0. I tried to update to version 3.4.0 but it failed with following stack trace :

$ pdk update
/opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template/template_dir.rb:39:in `initialize': Could not find a compatible template renderer for /opt/puppetlabs/pdk/share/cache/pdk-templates.git (RuntimeError)
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template/template_dir.rb:12:in `new'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template/template_dir.rb:12:in `instance'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template.rb:44:in `block in with'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template/fetcher.rb:45:in `with'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/template.rb:43:in `with'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/module/convert.rb:137:in `stage_changes!'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/module/update.rb:11:in `run'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/cli/update.rb:45:in `block (2 levels) in <module:CLI>'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:362:in `run_this'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:298:in `run'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/cri-2.15.12/lib/cri/command.rb:316:in `run'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/lib/pdk/cli.rb:58:in `run'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/lib/ruby/gems/3.2.0/gems/pdk-3.4.0/exe/pdk:6:in `<top (required)>'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/bin/pdk:25:in `load'
	from /opt/puppetlabs/pdk/private/ruby/3.2.5/bin/pdk:25:in `<main>'

To Reproduce Run pdk update on a pdk version 3.3.0 enabled module.

Expected behavior The usual list of files that will be modified by pdk update.

Additional context

  • Your PDK installation method (native packages or via Rubygems) Installed with brew. Package ref https://downloads.puppet.com/mac/puppet-tools/13/x86_64/pdk-3.4.0.1-1.osx13.dmg
    • (If via Rubygems, please include your Ruby version ruby -v)
  • Your PDK version (pdk --version) 3.4.0
  • Your operating system / platform MacOS Sequoia version 15.1.1

Also seen on Windows with MSI installer, same Ruby stack trace.

philippeganz avatar Dec 04 '24 16:12 philippeganz

There is a known issue with this release where the bundled templates are inaccessible, which we are currently working on. However it was decided to go ahead with the release regardless due to a severe CVE with one of the bundled gems. It is listed in the known issues document, with a workaround of manually pointing the PDK at a copy of the templates, either the main branch or a tag on Github or a downloaded local copy.

https://www.puppet.com/docs/pdk/3.x/pdk_known_issues

david22swan avatar Dec 05 '24 15:12 david22swan

The known issue recommends using --template-url with pdk update; unfortunately, pdk update does not recognize that option.

% pdk update --template-url=file:///Users/username/github/pdk-templates --template-ref=3.4.0
update: unrecognised option -- template-url

pdk update --help lists only --force, --noop, --template-ref

yorokobi avatar Dec 05 '24 15:12 yorokobi

@yorokobi Thanks for pointing that out, the correct option in this case would be to either run pdk convert with the added options in order to point the module at the new templates, or to manually change them within the metadata. Will update the known issues

david22swan avatar Dec 05 '24 15:12 david22swan