0

So I've started to try and use puppet, and I thought i had configured correctly as the node will successfully connect to the master:

C:\Windows\system32>puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for node.mydomain.com
Info: Applying configuration version '1502092203'
Notice: Applied catalog in 0.06 seconds

However, i have made changes to the master via the site.pp by simply adding the helloworld module:

node default {
class { 'helloworld': }
}

with this code:

class helloworld {
     notify { 'hello, world!':}
 }

this works if i call the site.pp explicitly on the master:

puppetmaster3@192:~$ sudo puppet apply 
/etc/puppetlabs/code/environments/production/manifests/site.pp 
[sudo] password for puppetmaster3: 
Notice: Compiled catalog for 192.168.1.23 in environment production in 0.15 seconds
Notice: hello, world!
Notice: /Stage[main]/Helloworld/Notify[hello, world!]/message: defined 'message' as 'hello, world!'
Notice: Applied catalog in 0.05 seconds

however when i try to verify it it cannot be found as it "doesn't exist":

puppetmaster3@192:~$ puppet parser validate site.pp
Error: One or more file(s) specified did not exist:
["   site.pp\n"]
Error: Try 'puppet help parser validate' for usage

When i run puppet agent on the node, it doesn't pick up the helloworld as shown orignally

I haven't edited the puppet.conf to or environment.conf to specify a manifest as I've used the default locations, do i need to declare them in puppet.conf? because if i try and print the manifest it comes up with this:

puppetmaster3@192:~$ puppet config print manifest
no_manifest
Junko142
  • 1
  • 3

1 Answers1

0

The puppet parser validate command could be a little more helpful in its responses, but usage is:

$ puppet parser validate --help

USAGE: puppet parser validate [<manifest>] [<manifest> ...]

This action validates Puppet DSL syntax without compiling a catalog or
syncing any resources. If no manifest files are provided, it will
validate the default site manifest.

RETURNS: Nothing, or the first syntax error encountered.

OPTIONS:
  --render-as FORMAT             - The rendering format to use.
  --verbose                      - Whether to log verbosely.
  --debug                        - Whether to log debug information.

See 'puppet man parser' or 'man puppet-parser' for full help.

So you can do this:

$ bundle exec puppet parser validate /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests/site.pp 
$

(No response at all means all-OK.)

Or you can do this:

$ puppet parser validate 
Notice: No manifest specified. Validating the default manifest /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests

It just validated /Users/alexharvey/.puppetlabs/etc/code/environments/production/manifests/site.pp. That's because I'm running as a non-privileged user and my modulepath is:

$ puppet config print modulepath
/Users/alexharvey/.puppetlabs/etc/code/environments/production/modules:/Users/alexharvey/.puppetlabs/etc/code/modules:/opt/puppetlabs/puppet/modules

You are getting that failure because you didn't specify a full path, and there is no such file site.pp in the current directory.

Alex Harvey
  • 14,494
  • 5
  • 61
  • 97
  • That did solve that problem and it returned no response, so I'm sure there must be no syntax errors, thankyou. But I'm still unsure why the agent is not getting helloworld's notice? – Junko142 Aug 07 '17 at 10:34
  • I didn't see that bit. What specifically do you see when you run `puppet agent -t` ? – Alex Harvey Aug 07 '17 at 10:36
  • `C:\Windows\system32>puppet agent -t` `Info: Using configured environment 'production'` `Info: Retrieving pluginfacts` `Info: Retrieving plugin` `Info: Loading facts` `Info: Caching catalog for ie11win10.4sightimaging.com` `Info: Applying configuration version '1502102532'` `Notice: Applied catalog in 0.08 seconds` and the environment i specified is simply the default location, i just specified it in the puppet.conf now – Junko142 Aug 07 '17 at 10:45
  • You can try adding `--debug` for further clues. Note that the `default` node definition you are using will only be picked up if you have no other more node-specific node definition. Are you certain that is the case? – Alex Harvey Aug 07 '17 at 12:53