If/else issues.

0 views
Skip to first unread message

Evan Hisey

unread,
Apr 24, 2008, 5:40:08 PM4/24/08
to puppet...@googlegroups.com
Can some one point out to me what I am missing? I suspect I have
messed up the if/else some how. I am getting a '
Syntax error at '{'; expected '}' at
/srv/puppet/production/manifests/modules/apache/init.pp: 19'.
According to the Language tutorial this should be correct. I am
testing for an existence of a variable. If it exists chagne the config
files to use it, if not set it to the apache default.

My init.pp:

class apache{
if $docroot{
# Set Document Root to the new directory.
line{"$docroot":
file => "/etc/http/conf/httpd.conf",
line => 'DocumentRoot "/var/www/html"',
ensure => comment,
}
file{"$docroot.conf":
path => "/etc/http/conf.d/DocumentRoot.conf",
content =>'# This file sets the webserver Document Root
# dir for Apache.
DocumentRoot "$docroot"',
require => Line["$docroot"],
}
}
else {
$docroot = "/var/www/html"
} #<<< This Line 19.

$packages = {"httpd","mod_ssl","webalizer"}

package{$packages:
ensure => present,
}

file{$docroot:
ensure => directory,
mode => 755,
}
}


Evan

Luke Kanies

unread,
Apr 24, 2008, 6:56:29 PM4/24/08
to puppet...@googlegroups.com
On Apr 24, 2008, at 4:40 PM, Evan Hisey wrote:

> file{"$docroot.conf":
> path => "/etc/http/conf.d/DocumentRoot.conf",
> content =>'# This file sets the webserver
> Document Root
> # dir for Apache.
> DocumentRoot "$docroot"',

There's currently a filed bug about carriage returns in strings not
counting against the line count. This string is messing up your line
count.

>
> require => Line["$docroot"],
> }
> }
> else {
> $docroot = "/var/www/html"
> } #<<< This
> Line 19.
>
> $packages = {"httpd","mod_ssl","webalizer"}


This is not how you specify an array; use [].

--
Work is not always required. There is such a thing as sacred idleness.
-- George MacDonald
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com

Evan Hisey

unread,
Apr 24, 2008, 8:56:56 PM4/24/08
to puppet...@googlegroups.com
On Thu, Apr 24, 2008 at 5:56 PM, Luke Kanies <lu...@madstop.com> wrote:
>
> On Apr 24, 2008, at 4:40 PM, Evan Hisey wrote:
>
> > file{"$docroot.conf":
> > path => "/etc/http/conf.d/DocumentRoot.conf",
> > content =>'# This file sets the webserver
> > Document Root
> > # dir for Apache.
> > DocumentRoot "$docroot"',
>
> There's currently a filed bug about carriage returns in strings not
> counting against the line count. This string is messing up your line
> count.
>
>
> >
> > require => Line["$docroot"],
> > }
> > }
> > else {
> > $docroot = "/var/www/html"
> > } #<<< This
> > Line 19.
> >
> > $packages = {"httpd","mod_ssl","webalizer"}
>
>
> This is not how you specify an array; use [].
>
> --
Yup, Missed that one, I was trying to busy trying to figure out the other issue.

Evan

DerekW

unread,
Apr 25, 2008, 5:41:50 AM4/25/08
to Puppet Users
Where's this line type coming from that looks so useful :) ?

Derek

On Apr 25, 1:56 am, "Evan Hisey" <ehi...@gmail.com> wrote:

David Schmitt

unread,
Apr 25, 2008, 5:54:07 AM4/25/08
to puppet...@googlegroups.com
DerekW schrieb:

> Where's this line type coming from that looks so useful :) ?

http://reductivelabs.com/trac/puppet/wiki/CompleteConfiguration

-> common
->
http://git.black.co.at/?p=module-common;a=blob;f=manifests/defines/line.pp


Regards, DavidS

Reply all
Reply to author
Forward
0 new messages