Clearly not understanding import

32 views
Skip to first unread message

steve koppelman

unread,
Jun 24, 2008, 1:40:52 PM6/24/08
to Puppet Users
I'm new at this. I've pored over the Quickstart and Best Practices.
I've searched, looked through this list's archives, and here I am.

When I run "puppet -d --parseonly site.pp on the following I get this:

debug: importing 'base.pp'
debug: importing 'httpserver.pp'
err: Could not parse for environment development: Could not match
'class' at httpserver.pp:2

When I take the contents of httpserver.pp and paste them into the end
of site.pp instead, I get no errors.

What am I doing wrong?

Thanks.

------------------------------------------------------------

#site.pp

filebucket { main: server => puppet }

File { backup => main }
Exec { path => "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin/:/
bin:/sbin" }

Package {
provider => $operatingsystem ? {
centos => yum,
redhat => up2date
}
}

schedule { everyfive:
period => hourly,
repeat => 12,
}

import "base"
import "httpserver"

-----

# base.pp

class base {
file { "/etc/passwd":
owner => root,
group => root,
mode => 644,
}

host { "puppet":
ip => "172.16.2.12",
ensure => present,
}

host { "svn":
alias => ["svn.online", "svn.online.amexpub.com"],
ip => "172.16.2.12",
ensure => present,
}

}

---

# httpserver.pp

class httpserver {
package { "httpd":
ensure => installed,
ensure => running,
schedule => everyfive,
}
service { "httpd":
subscribe => File["/etc/httpd/conf/httpd.conf"],
}
}

Evan Hisey

unread,
Jun 24, 2008, 3:32:48 PM6/24/08
to puppet...@googlegroups.com
What does your puppet.conf look like and what is the node definition?

Evan

steve koppelman

unread,
Jun 24, 2008, 3:46:50 PM6/24/08
to Puppet Users
When I posted those files, nodes.pp was empty. Still is. Now I have
some nodes in site.pp as follows, at the end of the site.pp manifest.

node default {
include base
}

node "foo.bar.com" inherits default {
exec { "/usr/bin/svn up":
cwd => "/var/spool/puppet-conf-aep/configs",
schedule => everyfive
}

# I AM THE PUPPETMASTER
service { "puppetmaster":
ensure => running,
enable => true,
}
file { "/var/spool/puppet-conf-aep":
ensure => directory,
}
}



#puppet.conf (default, as installed by DAG/rpmforge package)

[main]
# Where Puppet stores dynamic and growing data.
# The default value is '/var/puppet'.
vardir = /var/lib/puppet

# The Puppet log directory.
# The default value is '$vardir/log'.
logdir = /var/log/puppet

# Where Puppet PID files are kept.
# The default value is '$vardir/run'.
rundir = /var/run/puppet

# Where SSL certificates are kept.
# The default value is '$confdir/ssl'.
ssldir = $vardir/ssl

[puppetd]
# The file in which puppetd stores a list of the classes
# associated with the retrieved configuratiion. Can be loaded in
# the separate ``puppet`` executable using the ``--loadclasses``
# option.
# The default value is '$confdir/classes.txt'.
classfile = $vardir/classes.txt

# Where puppetd caches the local configuration. An
# extension indicating the cache format is added automatically.
# The default value is '$confdir/localconfig'.
localconfig = $vardir/localconfig


On Jun 24, 3:32 pm, "Evan Hisey" <ehi...@gmail.com> wrote:
> On Tue, Jun 24, 2008 at 12:40 PM, steve koppelman
>

Evan Hisey

unread,
Jun 24, 2008, 3:59:20 PM6/24/08
to puppet...@googlegroups.com
This will likely give the same error but try running puppetd --test
--noop adn see what teh messages are.

Evan

steve koppelman

unread,
Jun 24, 2008, 4:20:36 PM6/24/08
to Puppet Users
1. Pasted the node declarations above into an empty manifests/
nodes.pp.
2. Added 'import "nodes"' after 'import "base"' in site.pp.
3. Ran --parseonly and then --noop (output below). Broke both ways.
4. For fun, put the node declarations back in site.pp and commented
out the nodes import.
5. -d --parseonly ran without error messages, but --noop showed an
identical stack trace, so the problem may not have anything to do with
the importing.

That helped a bit, though I'm still baffled as to what I'm doing
wrong.

$ puppet -d --parseonly conf/manifests/site.pp
debug: importing 'conf/manifests/base.pp'
debug: importing 'conf/manifests/nodes.pp'
err: Could not parse for environment development: Could not match
'node' at conf/manifests/nodes.pp:2

$ puppet -d --noop conf/manifests/site.pp
/usr/lib/ruby/1.8/resolv.rb:299:in `open': can't convert nil into
String (TypeError)
from /usr/lib/ruby/1.8/resolv.rb:299:in `lazy_initialize'
from /usr/lib/ruby/1.8/resolv.rb:295:in `synchronize'
from /usr/lib/ruby/1.8/resolv.rb:295:in `lazy_initialize'
from /usr/lib/ruby/1.8/resolv.rb:337:in `each_address'
from /usr/lib/ruby/1.8/resolv.rb:244:in `each_address'
from /usr/lib/ruby/1.8/resolv.rb:243:in `each'
from /usr/lib/ruby/1.8/resolv.rb:243:in `each_address'
from /usr/lib/ruby/1.8/resolv.rb:227:in `getaddress'
... 14 levels...
from /usr/lib/ruby/gems/1.8/gems/puppet-0.24.4/lib/puppet/
indirector.rb:
42:in `find'
from /usr/lib/ruby/gems/1.8/gems/puppet-0.24.4/bin/puppet:185
from /usr/bin/puppet:19:in `load'
from /usr/bin/puppet:19



On Jun 24, 3:59 pm, "Evan Hisey" <ehi...@gmail.com> wrote:
> On Tue, Jun 24, 2008 at 2:46 PM, steve koppelman
>

Brendan Beveridge

unread,
Jun 25, 2008, 9:53:08 PM6/25/08
to puppet...@googlegroups.com
that looks like you had syntax errors in httpserver.pp

or you dont have manifestdir set


Cheers
Brendan(mrproper_)

Reply all
Reply to author
Forward
0 new messages