Search code examples
puppet

Puppet file URL leads to 'Name or service not known'


In /etc/puppetlabs/code/modules/send/manifests/init.pp

class send {

  file { '/tmp/hello.txt':
  owner  => 'root',
  group  => 'root',
  mode   => '0644',
  source => 'puppet://modules/send/hello.txt',
  }

}

In /etc/puppetlabs/code/modules/send/files/hello.txt

puppet agent -t reports

[root@consul-test-02 tmp]# puppet agent -t
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for consul-test-02
Info: Applying configuration version '1438919627'
Error: /Stage[main]/Send/File[/tmp/hello.txt]: Could not evaluate: Could not retrieve file metadata for puppet://modules/send/hello.txt: getaddrinfo: Name or service not known
Notice: Applied catalog in 0.03 seconds

Solution

  • Your URL lacks on slash. Use

    source => 'puppet:///modules/send/hello.txt',
    

    Note the triple slash. Your URL had puppet://modules/... so it had a host portion of modules, which (fortunately) does not resolve to an address in your environment.