Ask Your Question
0

Error 400 on SERVER: Failed to parse template

asked 2015-06-23 04:34:06 -0500

Himanshu Dubey gravatar image

Below is my main class

PWD:: /etc/puppetlabs/puppet/environments/production/modules/testapacheconfig/manifests

[root@abcd manifests]# cat init.pp class testapacheconfig { file { 'apachevhost.conf': target => '/etc/httpd/conf/vhostsconf/apachevhost.conf', ensure => file, content => template('/modules/testapache_config/apachevhost.erb'), owner => 'root', group => 'root', mode => '0644', notify => service['httpd'], } }

Below is my erb template:: PWD:: /etc/puppetlabs/puppet/environments/production/modules/testapacheconfig/templates

[root@abcd templates]# cat apachevhost.erb < virtualHost <%= $ipaddress %>:80> < /virtualHost>

I am getting the below error: [[ Any Idea, what is wrong with my class definition ]]

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Failed to parse template /modules/testapacheconfig/apachevhost.erb: Filepath: org/jruby/RubyIO.java Line: 3783 Detail: No such file or directory - /modules/testapacheconfig/apachevhost.erb at /etc/puppetlabs/puppet/environments/production/modules/testapacheconfig/manifests/init.pp:6 on node abcd.home.com Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-06-23 04:45:18 -0500

updated 2015-06-23 04:49:18 -0500

The template path is wrong; try using:

content => template('testapacheconfig/apachevhost.erb'),

(but in general check the path is correct and relative to the module).

edit flag offensive delete link more
1

answered 2015-06-23 06:42:30 -0500

Himanshu Dubey gravatar image

Thanks for the inputs Giavac,

Had to do 2 changes in my manifest

class testapacheconfig { file { '/etc/httpd/conf/vhostsconf/apachevhost.conf': ensure => file, content => template('testapacheconfig/apachevhost.erb'), owner => 'root', group => 'root', mode => '0644', #notify => service['httpd'], } }

  1. Modify resource and add the exact path [[file { '/etc/httpd/conf/vhostsconf/apachevhost.conf': ]] and remove target attribute
  2. As you mentioned, corrected the template path. Now, it is working fine. Thanks.
edit flag offensive delete link more

Comments

Glad to help.

giavac gravatar imagegiavac ( 2015-06-23 10:33:48 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-06-23 04:34:06 -0500

Seen: 1,732 times

Last updated: Jun 23 '15