Ask Your Question
0

Cannot use relative URLs [ SOLVED ]

asked 2016-12-01 04:09:47 -0500

craymore gravatar image

updated 2017-02-08 06:54:13 -0500

Hi all,

I have the following code in a manifest ( config.pp ):

  file { 'logback':
        ensure  => file,
        path    => '/etc/app/logback.xml',
        source  => file('app/logback.xml'),
        require => File['/etc/app'],
        notify  => Service['tomcat'],
   }

I have an error message while attempting to apply the catalog on the dedicated agent

Error: Failed to apply catalog: Parameter source failed on File[logback]: Cannot use relative URLs
<xml file gets displayed here>
at /etc/puppet/environments/app/.../manifests/config.pp:17

After re-reading the documentation regarding the file / source usage, I don't understand why it fails.

Does anyone have a clue ?

NB :

currently running puppet 3.8.7

usage of puppet:/// is not an option because of performance issues

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-12-01 10:43:02 -0500

joshc gravatar image

puppet is interpreting source => file('app/logback.xml') as a relative URL. Puppet supports file, puppet, and http(s) URL schemes, so you can either:

  1. Use puppet scheme to refer to a file on puppet's fileserver:

    source => 'puppet:///modules/<module>/app/logback.xml'

  2. Use file scheme to refer to a file on the agent's local file system, such as if you have an NFS mount:

    source => 'file:///path/to/logback.xml'

  3. Use http scheme to refer to a file on some other fileserver. When using this option you'll want to specify the desired checksum value so puppet doesn't redownload the file each time it runs.

    source => 'http://host:port/path/to/logback.xml'

Other options include inlining the file content in the catalog: content => file('app/logback.xml')

edit flag offensive delete link more

Comments

1

Thank you for your answer. The solution was indeed ( here ) to use [ content => file() ] and not [ source => file() ]

craymore gravatar imagecraymore ( 2016-12-02 08:33:57 -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: 2016-12-01 04:09:47 -0500

Seen: 130 times

Last updated: Feb 08