厨师 - 错误:RuntimeError:请设置编辑器环境变量 - 同时在厨师中创建角色
我是厨师的新手。今天,当我在厨师中的学习角色时,我创建了一个测试角色RB文件 -
name "reposerver"
description "repo server for sles12.4,12.5"
run_list "recipe[e]"
然后我运行刀具来创建此角色,但失败了 -
C:\Work\chef-repo>knife role create from file roles\reposerver.rb
ERROR: RuntimeError: Please set EDITOR environment variable. See https://docs.chef.io/knife_setup/ for details.
搜索后,我找到了这一点 - 厨师 - 错误:runtimeerror:请设置编辑器环境变量
所以请按照它进行操作这个 -
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "eisenwang"
client_key "#{current_dir}/eisenwang.pem"
chef_server_url "https://api.chef.io/organizations/eisen"
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:editor] = "C:\\Program Files (x86)\\IDM Computer Solutions\\UltraEdit\\Uedit32.exe"
但是“刀具角色从文件角色\ reposerver.rb创建”仍然失败了,但我的config.rb中有任何错误?还是不应该在C中:\ Users \用户名\ .Chef? 感谢您的答复。
关于
艾森
I'm new to Chef. Today, while study role in chef, I created a test role rb file --
name "reposerver"
description "repo server for sles12.4,12.5"
run_list "recipe[e]"
Then I run knife command to create this role, but failed with --
C:\Work\chef-repo>knife role create from file roles\reposerver.rb
ERROR: RuntimeError: Please set EDITOR environment variable. See https://docs.chef.io/knife_setup/ for details.
After search, I found this -- Chef - ERROR: RuntimeError: Please set EDITOR environment variable
So follow it, I modify my config.rb like this --
current_dir = File.dirname(__FILE__)
log_level :info
log_location STDOUT
node_name "eisenwang"
client_key "#{current_dir}/eisenwang.pem"
chef_server_url "https://api.chef.io/organizations/eisen"
cookbook_path ["#{current_dir}/../cookbooks"]
knife[:editor] = "C:\\Program Files (x86)\\IDM Computer Solutions\\UltraEdit\\Uedit32.exe"
But that "knife role create from file roles\reposerver.rb" still fails with same error... Is there any wrong in my config.rb? Or it should not be in C:\users\username\.chef ?
Thanks for your reply.
Regards
Eisen
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
测试后,我发现了这个问题 -
这是由于Ultraedit而不是阻止文本编辑器,一旦打开文件,Ultraedit将不再容纳文件处理程序。因此,刀找不到是否更新。因此,一旦我将其更改为 -
刀[:editor] =“记事本”
问题。
After testing, I found the issue --
It's due to ultraedit is not a blocking text editor, once file is opened, ultraedit will not hold the file handler anymore. So knife can't find it updated or not. So once I changed it to --
knife[:editor] = "notepad"
Issue fixed.
设置一个名为
编辑器
指向Ultraedit可执行文件的Windows环境变量。应该解决它。Set a windows environment variable called
EDITOR
pointing to the UltraEdit executable. That should fix it.