[PUP-8698] puppet module generate broken w/o stdlib Created: 2018/05/04  Updated: 2018/05/09  Resolved: 2018/05/07

Status: Closed
Project: Puppet
Component/s: PMT
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Normal
Reporter: Joaquin Menchaca Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Puppet Version: 5.5.1
OS Name/Version: Ubuntu 14.04 Trusty


Issue Links:
Relates
relates to PUP-3121 Puppet module generate - dependency p... Closed
Template:
Team: Puppet Developer Experience
Method Found: Needs Assessment
QA Risk Assessment: Needs Assessment

 Description   

SUMMARY

Generated module does not work when using templates. Seems to be dependency now to puppet-stdlib.

REPRODUCE

 

$ puppet module generate foo/bar --skip-interview
$ mkdir bar/templates
$ cat <<-EOF > bar/templates/index.html.erb
<html>
  <body>
    <h1>hello world</h1>
  </body>
</html>
EOF
$ cat <<-EOF > bar/manifests/init.pp
class bar {
  package { 'apache2':
    ensure => present,
  }
  service { 'apache2':
    ensure => running,
    enable => true,
  }
  file { '/var/www/html/index.html':
    content => template('bar/index.html.erb'),
  }
}
EOF
$ sudo puppet apply --modulepath=. -e 'include ::bar'

 

DESIRED BEHAVIOR

Expected that I would have a functional module.

ACTUAL BEHAVIOR

 

Warning: ModuleLoader: module 'bar' has unresolved dependencies - it will only see those that are resolved. Use 'puppet module list --tree' to see information about modules\n (file & line not available) 
Notice: Compiled catalog for controlrepo.test in environment production in 0.61 seconds 
Notice: /Stage[main]/Bar/File[/var/www/html/index.html]/content: content changed '{md5}c32ad802df5abca941d784abf642e7fd' to '{md5}2d60ab375367b3e2996c7c1803009d55' 
Notice: Applied catalog in 0.08 seconds

NOTES

When I run the module list command, I get this:

 

 

$ sudo puppet module list --tree --modulepath=. 
Warning: Missing dependency 'puppetlabs-stdlib': 'foo-bar' (v0.1.0) requires 'puppetlabs-stdlib' (>= 1.0.0) 
/vagrant/scratch 
└─┬ foo-bar (v0.1.0) 
  └── UNMET DEPENDENCY puppetlabs-stdlib (>= 1.0.0)

 



 Comments   
Comment by Josh Cooper [ 2018/05/07 ]

ping David Schmitt, Jesse Scott

Comment by Jesse Scott [ 2018/05/07 ]

Hi Joaquin Menchaca,

You are correct that the `puppet module generate` command, by default, generates a module with a dependency on the puppetlabs-stdlib module. That dependency is located in the modules metadata.json file and can be safely removed if desired.

However it appears that in this case, your module still applied the desired changes. The only output related to the stdlib dependency that I see is a warning (not an error). Was there other behavior you observed that suggested the module was not doing what you expected? The line below indicates that Puppet managed the content of the templated file:

Notice: /Stage[main]/Bar/File[/var/www/html/index.html]/content: content changed '{md5}c32ad802df5abca941d784abf642e7fd' to '{md5}2d60ab375367b3e2996c7c1803009d55'

You may also want to investigate using the Puppet Development Kit to create and test modules in the future. PDK incorporates the latest module development patterns and best practices from the community:

 

Comment by Lindsey Smith [ 2018/05/07 ]

puppet module generate is being replaced by PDK pdk new module

Comment by Joaquin Menchaca [ 2018/05/08 ]

Makes sense.  I hope there's a minimalist module gen mode with PDK, because a lot of stuff is overkill for a corp that wants internal module only (not on forge), but that's another ticket.

 

Comment by Joaquin Menchaca [ 2018/05/08 ]

I also noticed that templates requires stdlib, was that suppose to work this way? (this could be a sep ticket)

Comment by David Schmitt [ 2018/05/09 ]

This was added in the 3.6.0 timeframe. Since puppet module generate is now deprecated in favour of the PDK, I'm not sure that we'll ever fix this (other by removing the command entirely).

Generated at Sat Dec 07 21:26:33 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.