[PDK-906] Support for deep directory structure in templates Created: 2018/04/04  Updated: 2018/07/26  Resolved: 2018/07/13

Status: Closed
Project: Puppet Development Kit
Component/s: None
Affects Version/s: None
Fix Version/s: PDK 1.6.1

Type: Bug Priority: Normal
Reporter: Bryan Jen Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: resolved-issue-added
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

From github issues: https://github.com/puppetlabs/pdk/issues/445

I tried to create a template containing moduleroot_init/spec/nodesets directory with some nodes definitions for an acceptance test wireframe. The pdk new module command ended up with being unable to create directory structures deeper than one level:

 {{}}

pdk (DEBUG): Rendering 'spec/nodesets'... pdk (FATAL): Failed to render template 'spec/nodesets' ArgumentError: '/var/folders/f2/s1z9f_qd24n417_4w8q8c2fr0000gn/T/pdk-templates20180301-3694-h8fiix/moduleroot_init/spec/nodesets' is not a readable file pdk (DEBUG): ArgumentError: '/var/folders/f2/s1z9f_qd24n417_4w8q8c2fr0000gn/T/pdk-templates20180301-3694-h8fiix/moduleroot_init/spec/nodesets' is not a readable file pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/template_file.rb:62:in `template_content' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/template_file.rb:86:in `render_plain' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/template_file.rb:43:in `render' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/module/templatedir.rb:131:in `block in render' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/module/templatedir.rb:126:in `each' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/module/templatedir.rb:126:in `render' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/generate/module.rb:58:in `block in invoke' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/module/templatedir.rb:82:in `initialize' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/generate/module.rb:57:in `new' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/generate/module.rb:57:in `invoke' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/cli/new/module.rb:37:in `block (2 levels) in <module:CLI>' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/cri-2.9.1/lib/cri/command.rb:319:in `run_this' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/cri-2.9.1/lib/cri/command.rb:264:in `run' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/cri-2.9.1/lib/cri/command.rb:282:in `run' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/cri-2.9.1/lib/cri/command.rb:282:in `run' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/lib/pdk/cli.rb:17:in `run' pdk (DEBUG): /opt/local/lib/ruby2.4/gems/2.4.0/gems/pdk-1.4.1/exe/pdk:6:in `<top (required)>' pdk (DEBUG): /opt/local/bin/pdk:23:in `load' pdk (DEBUG): /opt/local/bin/pdk:23:in `<main>' 

{{}}

Having a look on template_file.rb, it seems not to consider a directory as a valid type directory entry, and it doesn't recurse to in-depth rendering template directory structure.


Template:
Team: Puppet Developer Experience
Method Found: Needs Assessment
Release Notes: Bug Fix
Release Notes Summary: Resolves a bug in the new module template renderer that prevented users from adding files in nested subdirectories to custom module templates.
QA Risk Assessment: Needs Assessment

 Comments   
Comment by Jesse Scott [ 2018/07/13 ]

Resolved by community contribution https://github.com/puppetlabs/pdk/pull/524

Generated at Wed Oct 16 02:08:47 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.