6

as a puppet newbie, I have a problem including the stdlib plugin

I would like to use stdlib's file_line, thus I try to include stdlib and call it

class service_mon
{
  include stdlib
  file_line 
  {
    "${name}_services": path=> ...
  }
}

However, I get an error message, that stdlib cannot been found

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class stdlib for my.node.name at /etc/puppet/workspace/dev/src/modules/mymanifest/manifests/deploy.pp:87 on node my.node.name

which makes me wonder since stdlib should be installed(?) ...or?

puppet module install puppetlabs-stdli

puppet module list
/etc/puppet/modules
└── puppetlabs-stdlib (v4.2.2)
/usr/share/puppet/modules (no modules installed)

puppet config print modulepath
/etc/puppet/modules:/usr/share/puppet/modules

So, I guess in principle all necessary files are 'there' but how can I convince Puppet to include stdlib as well?

Deduplicator
  • 44,692
  • 7
  • 66
  • 118
THX
  • 553
  • 2
  • 8
  • 18
  • chown -R puppet:puppet /etc/puppet/ – mr_tron Jun 26 '14 at 13:12
  • 1
    Did you ever solve this? I seem to be running into the exact same issue. :-/ – Christopher Nov 14 '14 at 23:32
  • Hi Christopher - unfortunately I have not yet managed to get it running satisfactorily -- and 'postponed' it by using a small shell script to do the work I hoped I could solve with stdlib :-/ – THX Jan 07 '15 at 10:19
  • I had to explicitly provide the modules path using modulePath option in my puppet file apply command in terminal: ```bash puppet apply 0-the_sky_is_the_limit_not.pp --modulepath /etc/puppet/code/modules ``` – MosesSoftEng Nov 11 '22 at 06:17

1 Answers1

4

Puppet modules do not work like java modules - include stdlib would only make sense if there actually was a class stdlib in the module which did something useful, which is not the case.

Note: Many Puppet modules do have such a class that serves as the central entry point, but stdlib is a notable exception.

You can use the parser functions from stdlib by just calling them. As for the types, those just become available to Puppet if

  • the module is installed inside your $modulepath and
  • you have pluginsync enabled on your agents

You can use file_line without any ado.

Felix Frank
  • 8,125
  • 1
  • 23
  • 30