You haven't provided a command to run via the command attribute, so
the provider will attempt to execute what you have in the resource
title (checkForFile) - that is to say, it is trying to execute the
command 'checkForFile', which of course, doesn't exist.

As Denmat already pointed out, this may not be the best solution, but
if you really want to stick with this approach then you need to
specify a command - try adding.... command => '/bin/true' to the exec
resource declaration to get around your current problem.

Craig


On Thu, Jun 11, 2015 at 8:13 AM, Eddie Mashayev <eddie...@gmail.com> wrote:
> Anyone?!
>
>
> On Wednesday, June 10, 2015 at 2:30:33 PM UTC+3, Eddie Mashayev wrote:
>>
>> Hi All,
>>
>> I want to check that my service "nails" running on all my servers only if
>> file "/etc/NONAILS" not exists on this server.
>>
>> If it exists don’t start this process, this file works like a flag.
>>
>> I wrote script in puppet to check that and it works.
>>
>>
>> Still it throes error when this file do exists:
>>
>>
>> [root@test ~]# puppet  agent -t
>>
>> Info: Retrieving pluginfacts
>>
>> Info: Retrieving plugin
>>
>> Info: Loading facts
>>
>> Info: Loading facts
>>
>> Info: Caching catalog for test
>>
>> Info: Applying configuration version '1433921081'
>>
>> Error: Could not find command 'checkForFile'
>>
>> Error: /Stage[main]/Check_service/Exec[checkForFile]/returns: change from
>> notrun to 0 failed: Could not find command 'checkForFile'
>>
>> Notice: /Stage[main]/Check_service/Service[nails]: Dependency
>> Exec[checkForFile] has failures: true
>>
>> Warning: /Stage[main]/Check_service/Service[nails]: Skipping because of
>> failed dependencies
>>
>>
>> Question can I do it in cleaner way without throwing errors??
>>
>>
>>
>> This is my script:
>>
>>
>> class check_service {
>>
>>         service { "nails":
>>                 ensure => "running",
>>                 enable => true,
>>                 hasstatus  => false,
>>                 hasrestart => true,
>>                 require => exec['checkForFile'],
>>         }
>>
>>         exec {"checkForFile":
>>                 path => "/usr/bin/",
>>                 onlyif => "test -e /etc/NONAILS",
>>         }
>> }
>>
>>
> --
> 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/6cc13de4-eeba-44d7-8bd6-15af22d775fc%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 
Enviatics | Automation and configuration management
http://www.enviatics.com | @Enviatics
Puppet Training http://www.enviatics.com/training/

-- 
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/CACxdKhF3s%3D-HPcpFtoQS%2B2DMFZhsMn7z4vnYys5wt9-%3DYY3ZaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to