运行eval`ssh agent-s`会给出错误

运行eval`ssh agent-s`会给出错误,ssh,exec,puppet,puppetlabs-apache,Ssh,Exec,Puppet,Puppetlabs Apache,尝试使用命令选项puppet运行命令eval`ssh agent-s,这会导致以下错误: exec { 'eval' : command => "eval `ssh-agent -s`", } 给我这个错误: Error: Validation of Exec[eval] failed: 'eval `ssh-agent -s`' is not qualified and no path was specified. Please qualify the com

尝试使用命令选项puppet运行命令eval`ssh agent-s,这会导致以下错误:

exec { 'eval' :
        command => "eval `ssh-agent -s`",
     }
给我这个错误:

Error: Validation of Exec[eval] failed: 'eval `ssh-agent -s`' is not qualified and no path was specified. Please qualify the command or specify a path. at /puppet.pp:18
    Wrapped exception:
'eval `ssh-agent -s`' is not qualified and no path was specified. Please qualify the command or specify a path.

您需要为自己设置路径。通过设置路径参数,可以在本地定义I:

exec { 'eval' :
        command => "eval `ssh-agent -s`",
        path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ],
     }
或全球:

Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

你的方法有缺陷

无法通过
exec
资源运行命令来操纵Puppet代理的环境。每个这样的资源都派生一个独立的子流程,主环境保持不变


更新:允许Puppet使用
ssh代理运行的最佳方法取决于如何启动Puppet代理。例如,如果使用
/etc/init.d/puppet start
,则需要更改此init脚本以将puppet进程直接包装到
ssh代理中。如果从
cron
运行,请将作业更改为运行
ssh-agent
等。

您需要使用完全限定路径

例如:

exec { "sample":
  command => "/usr/bin/test",
}
或:


投票是“感谢”,一些评论会更好。我投票支持你,但这里有一些评论:你的答案是正确的,但不是很有用。你提出的解决方案是什么?@jbass这很公平。谢谢
exec { "sample":
  path    => ['/usr/bin', '/usr/sbin', '/bin'],
  command => "test",
}