我正在使用烹饪食谱中的执行资源。菜谱正在正常工作,而菜谱则要求cli。食谱不适用于cron的日程安排。我在下面发送错误日志;
* execute[DNS Recording with Centrify] action run
================================================================================
Error executing action `run` on resource 'execute[DNS Recording with Centrify]'
================================================================================
Errno::ENOENT
-------------
No such file or directory - addns
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/rhel8/recipes/centrify.rb
48: execute 'DNS Recording with Centrify' do
49: command 'addns -U -m'
50: user "root"
51: ignore_failure false
52: end
53: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/rhel8/recipes/centrify.rb:48:in `from_file'
execute("DNS Recording with Centrify") do
action [:run]
default_guard_interpreter :execute
command "addns -U -m"
declared_type :execute
cookbook_name "rhel8"
recipe_name "centrify"
domain nil
user "root"
end我找到了原因。其原因是出现不同路径的游离层。烹饪书在cli和不同的cron中使用不同的路径。我的命令二进制在cli路径中。我不能使用静态路径,因为cli路径会根据操作系统、版本和分布进行更改。
如何根据所有linux在食谱中设置cli路径?
问候
发布于 2020-11-30 04:37:22
从问题中可以看出,您希望为execute资源提供相应的execute环境变量。
您可以尝试两个选项:
PATH:使用Centrify执行'DNS记录‘do命令'addns -U -m’user 'root‘环境({ 'PATH’=> ENV'PATH‘})结束
default_env属性查看是否使PATH可用:使用Centrify执行'DNS记录‘do命令'addns -U -m’user 'root‘default_env true end
https://stackoverflow.com/questions/65064399
复制相似问题