Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-1364

pdk convert --template-ref /tmp/pdk-template fails with misleading error if not a git repository

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDK 1.15.0
    • Component/s: None
    • Template:
    • Method Found:
      Needs Assessment
    • Release Notes:
      Enhancement
    • Release Notes Summary:
      PDK Update and Convert can now use a plain template directory on disk. It no longer has to be a Git based repository.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Actual behaviour:

      david@davids:/tmp/foo$ pdk convert --template-url /tmp/pdk-templates
      #<ArgumentError: PDK::Module::TemplateDir.new must be initialized with a PDK::Util::TemplateURI, got a String>
      /home/david/git/pdk/lib/pdk/module/templatedir.rb:46:in `initialize'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:243:in `new'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:243:in `valid_template?'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:228:in `block in first_valid_uri'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:228:in `each'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:228:in `find'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:228:in `first_valid_uri'
      /home/david/git/pdk/lib/pdk/util/template_uri.rb:54:in `initialize'
      /home/david/git/pdk/lib/pdk/module/convert.rb:106:in `new'
      /home/david/git/pdk/lib/pdk/module/convert.rb:106:in `template_uri'
      /home/david/git/pdk/lib/pdk/module/convert.rb:71:in `stage_changes!'
      /home/david/git/pdk/lib/pdk/module/convert.rb:20:in `run'
      /home/david/git/pdk/lib/pdk/module/convert.rb:10:in `invoke'
      /home/david/git/pdk/lib/pdk/cli/convert.rb:41:in `block (2 levels) in <module:CLI>'
      /home/david/gems/ruby/2.5.0/gems/cri-2.15.5/lib/cri/command.rb:359:in `run_this'
      /home/david/gems/ruby/2.5.0/gems/cri-2.15.5/lib/cri/command.rb:296:in `run'
      /home/david/gems/ruby/2.5.0/gems/cri-2.15.5/lib/cri/command.rb:314:in `run'
      /home/david/git/pdk/lib/pdk/cli.rb:19:in `run'
      /home/david/git/pdk/exe/pdk:6:in `<top (required)>'
      /home/david/gems/ruby/2.5.0/bin/pdk:23:in `load'
      /home/david/gems/ruby/2.5.0/bin/pdk:23:in `<main>'
      pdk (FATAL): Unable to find a valid template at /tmp/pdk-templates#master
      david@davids:/tmp/foo$ 
      

      Additional exception output through

      david@davids:~/git/pdk$ git diff lib/pdk/util/template_uri.rb
      diff --git a/lib/pdk/util/template_uri.rb b/lib/pdk/util/template_uri.rb
      index b00bf28..5bc4c9f 100644
      --- a/lib/pdk/util/template_uri.rb
      +++ b/lib/pdk/util/template_uri.rb
      @@ -242,7 +242,9 @@ module PDK
                 begin
                   PDK::Module::TemplateDir.new(path) {}
                   return true
      -          rescue ArgumentError
      +          rescue ArgumentError => e
      +            puts e.inspect
      +            puts e.backtrace
                   nil
                 end
               end
      david@davids:~/git/pdk$ 
      

      Expected behaviour: contents of directory are used as template

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              glenn.sarti Glenn Sarti
              Reporter:
              david.schmitt David Schmitt
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support