我尝试通过大厨将%wheel
组添加到sudoers
文件中。
不幸的是,我很难弄清楚这本食谱是如何运作的。 readme对我来说听起来不太清楚。
我做了什么:
加
depends 'sudo'
到我食谱的元数据文件
在食谱末尾添加以下行
node.default['authorization']['sudo']['groups'] = ['wheel']
会发生什么(线被完全忽略):
Recipe: create-user::default
* yum_package[sudo] action install[2016-06-09T19:01:12+01:00] INFO: Processing yum_package[sudo] action install (create-user::default line 9)
(up to date)
* user[edgarsan] action create[2016-06-09T19:01:13+01:00] INFO: Processing user[edgarsan] action create (create-user::default line 14)
(up to date)
* group[wheel] action modify[2016-06-09T19:01:13+01:00] INFO: Processing group[wheel] action modify (create-user::default line 21)
(up to date)
* user[banana] action create[2016-06-09T19:01:13+01:00] INFO: Processing user[banana] action create (create-user::default line 14)
(up to date)
* group[wheel] action modify[2016-06-09T19:01:13+01:00] INFO: Processing group[wheel] action modify (create-user::default line 21)
(up to date)
[2016-06-09T19:01:13+01:00] INFO: Chef Run complete in 3.322762038 seconds
我遗漏了一些东西,但我没有从文档中找出它是什么。
提前致谢
答案 0 :(得分:1)
您还必须通过在食谱中添加以下行来执行默认配方:
casper.then(function () {
casper.sendKeys('input.street-address', 'fake address here', { keepFocus: true });
casper.page.sendEvent('keydown', 0);
casper.page.sendEvent('keyup', 0);
});
casper.waitUntilVisible('.pac-container .pac-item', function () {
casper.page.sendEvent('keydown', casper.page.event.key.Down);
casper.page.sendEvent('keydown', casper.page.event.key.Enter);
});
这将使用此属性here:
include_recipe "sudo"
答案 1 :(得分:0)
使用include_recipe "sudo"
我收到以下错误,这就是为什么我首先删除了该语句的原因。幸运的是@StephenKing让我回到了正轨......并告诉我该声明实际上是有原因的:)
================================================================================
Error executing action `create` on resource 'template[/sudoers]'
================================================================================
Chef::Mixin::Template::TemplateError
------------------------------------
undefined method `each' for nil:NilClass
...
Template Context:
-----------------
on line #4
2: # Do NOT modify this file directly.
3:
4: <% @sudoers_defaults.each do |defaults| -%>
5: Defaults <%= defaults %>
6: <% end -%>
...
即。默认值没有传递给sudo配方。解决方案是在 attributes / default.rb
中通过node.default['authorization']['sudo']['groups'] = ['wheel']
在 recipes / default.rb 中交换default['authorization']['sudo']['groups'] = ['wheel']
现在一切都按预期工作