Check the output of a exec

27 views
Skip to first unread message

giovanni possemato

unread,
Nov 8, 2013, 10:06:08 AM11/8/13
to puppet...@googlegroups.com
Hi all,

i'm making a manifest for an agent on windows.
I have to make some actions ONLY if a file already exists.
I tried in this way, but it seems dowsn't work..

class sql2008{

  package { sql2008:
ensure => present,
  }

  exec {'check_dotnet':
        command => 'IF EXIST c:\Windows\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll (echo 1) ELSE (echo 0)',
        returns => $check_dotnet_exist
        
  }

  notice("  __ $check_dotnet_exist __ ")

}

When i call the agent, the notice message is "__ __"
How can i save the output of the exec in a variable?

Ty all,
Giovanni

jcbollinger

unread,
Nov 11, 2013, 9:26:48 AM11/11/13
to puppet...@googlegroups.com


You can't.  You can, however, create a custom fact that will contain the output generated by your command.   The fact will be evaluated before each Puppet run, so it will be available to all your classes.  See http://docs.puppetlabs.com/guides/custom_facts.html.


John

Reply all
Reply to author
Forward
0 new messages