0

I'm at whits end now, can someone please help me to understand what it is I'm doing wrong here:

my nodes.pp (nothing else in this file except this definition)

node test {
    net::addr { 'routing':
        routes = {
            route1 => {
                address => '192.168.23.14',
                netmask => '255.255.255.0',
                gateway => '192.168.23.1',
                dev     => 'eth0',
            },
            route2 => {
                address => '192.168.1.3',
                netmask => '255.255.255.0',
                gateway => '192.168.1.1',
                dev     => 'eth2',
            },
        }
    }
}

No matter what I change I keep getting this on every run on the test server, the run just terminates straight away:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not parse for environment production: Syntax error at '='; expected '}' at /etc/puppet/manifests/nodes/nodes.pp:3 on node test

On line 3 this is what I have from the above:

net::addr { 'routing':

What am I missing here? Please help as its driving me to despair!

Thanks Dan

2
  • 2
    Are you sur that shouldn't be routes =>?
    – Zoredache
    Feb 15, 2013 at 16:22
  • Show us the definition of the net::addr type, because without that the question is not complete.
    – golja
    Feb 15, 2013 at 23:16

3 Answers 3

3

From where I sit, line three is:

routes = {

You need the right angle bracket here.

1

As has been mentioned you need to change your '=' to the '=>' resource operator.

Something that will be helpful when debugging is this command:

puppet parser validate test.pp

That will help you find your syntax errors.

0

You need a => operator to define a resource parameter:

net::addr { 'routing':
  routes => {
    ...

Specifying parameters this way is a bit confusing and hard to read. I'd recommend to first save this complex hash in a variable:

$route_hash = {
    route1 => {
        address => '192.168.23.14',
        netmask => '255.255.255.0',
        gateway => '192.168.23.1',
        dev     => 'eth0',
    },
    route2 => {
        address => '192.168.1.3',
        netmask => '255.255.255.0',
        gateway => '192.168.1.1',
        dev     => 'eth2',
    },
}

net::addr { 'routing':
    routes => $route_hash,
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .