err: Failed to apply catalog: Parameter source failed on File[...]: Cannot use URLs of type 's001ap38-test' as source for fileserving at /etc/puppet/modules/httpd/manifests/init.pp:12

350 views
Skip to first unread message

Wei Chen

unread,
Oct 6, 2015, 9:02:23 AM10/6/15
to Puppet Users
Hi all,

As I run following command:

puppet agent --server s001ap38-test --no-daemonize --verbose --onetime

I got error as follow:
...
err: Failed to apply catalog: Parameter source failed on File[/etc/httpd/conf.d/s001is35-test.conf]: Cannot use URLs of type 's001ap38-test' as source for fileserving at /etc/puppet/modules/httpd/manifests/init.pp:12
...

My init.pp looks as follow:

class httpd {
package { httpd:
        ensure => present,
        }

file { "/etc/httpd/conf.d/s001is35-test.conf":
        owner => "root",
        group => "root",
        mode => 0440,
        source => "s001ap38-test://$puppetmaster/modules/httpd/files/s001is35-test.conf",
        require => Package["httpd"],
        }
}

Note: the $puppetmaster is defined in "site.pp" as follow:
import 'nodes.pp'
$puppetmaster = 's001ap38-test'


I want to know what is the reason to the error? I guess the sentence "source => "s001ap38-test://$puppetmaster/modules/httpd/files/s001is35-test.conf"," in the init.pp could be the reason. But I have no idea how to fix it. Could someone help?

Regards


jcbollinger

unread,
Oct 7, 2015, 3:17:34 PM10/7/15
to Puppet Users
You guess correctly.  The value of the 'source' attribute should be a URI identifying a resource (HTTP sense) whose content should be used as the file content, or else it should be a path on the local file system to another file from which the content should be copied.  Not only is 's001ap38-test' not a known URI scheme, but Puppet anyway supports only the 'file' and 'puppet' schemes.  It looks like you want

  source => "puppet:///modules/httpd/s001is35-test.conf"

John

Wei Chen

unread,
Oct 8, 2015, 1:31:45 AM10/8/15
to Puppet Users
Hi John,

Thanks very much. It works now with your code. But even though I can't understand, why I have to take out the 'files' ? The file to be copied, the "s001is35-test.conf", locates under "/etc/puppet/modules/httpd/files/" on the server.

Wei

Rich Burroughs

unread,
Oct 8, 2015, 1:44:39 AM10/8/15
to puppet...@googlegroups.com
Puppet knows to look in the files directory in your module.

There's a bit of an explanation here:


https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html


Rich

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/23dab341-b962-432a-97c4-8136459a4a9f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wei Chen

unread,
Oct 8, 2015, 1:52:23 AM10/8/15
to Puppet Users
Hi Rich,

Many thanks!
Reply all
Reply to author
Forward
0 new messages