On Tue, Oct 3, 2017 at 5:41 PM Sean <smalde...@gmail.com> wrote:

> Hi,
>
> I have a strange puppet error (v4.10.1) with a file resource that creates
> a cron job...
>
>   file { '/etc/cron.daily/aide':
>     ensure  => $mymodule::ensure_aide,
>     owner   => 'root',
>     group   => 'root',
>     mode    => '0755',
>     source  => 'puppet:///modules/mymodule/cron/daily-aide-check.sh',
>     require => Package['aide'],
>   }
>
> The error is:
>
> Error: Failed to apply catalog: Validation of File[/etc/cron.daily/aide]
> failed: You cannot specify more than one of content, source, target at <source
> file>:line#
>
>
>
> The ensure param is a Variant - either boolean or enum of true, false,
> present, absent, latest.  The code passes the puppet parser and checking
> puppet lookup for $mymodule::ensure_aide for the test node returns a 'true'
> value from the module's hiera data.
>

File's ensure doesn't take boolean values. If the ensure value is not one
of present, absent, file, directory, or link, the value gets interpreted as
a link target name:

david@davids:~$ puppet apply -e 'file {"/tmp/test_file": ensure => true,
content => "bar" }'
Notice: Compiled catalog for davids.corp.puppetlabs.net in environment
production in 0.07 seconds
Error: Validation of File[/tmp/test_file] failed: You cannot specify more
than one of content, source, target at line 1
david@davids:~$ puppet apply -e 'file {"/tmp/test_file": ensure => true }'
Notice: Compiled catalog for davids.corp.puppetlabs.net in environment
production in 0.07 seconds
Error: Could not set 'link' on ensure: FileSystem implementation expected
Pathname, got: 'TrueClass' at line 1
Error: Could not set 'link' on ensure: FileSystem implementation expected
Pathname, got: 'TrueClass' at line 1
Wrapped exception:
FileSystem implementation expected Pathname, got: 'TrueClass'
Error: /Stage[main]/Main/File[/tmp/test_file]/ensure: change from absent to
link failed: Could not set 'link' on ensure: FileSystem implementation
expected Pathname, got: 'TrueClass' at line 1
Notice: Applied catalog in 0.03 seconds
david@davids:~$

see https://docs.puppet.com/puppet/latest/type.html#file-attribute-ensure
for the long-form.

Cheers, David



>
> Any ideas?
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/64776827-6fe1-49c0-89b1-fc532faa211a%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/64776827-6fe1-49c0-89b1-fc532faa211a%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CALF7fHYoFKBb8YbKTzW8T8U3QBu_apH6%2BAeVEbt7hj-OqeA0CQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to