Ruby Chef |编写目录权限分配规范
我刚接触Chef和ruby,正在进行一个培训项目,我对一些可能非常简单的事情很感兴趣,但我已经用尽了谷歌搜索和/或提交的能力。我有以下资源Ruby Chef |编写目录权限分配规范,ruby,chef-infra,chefspec,Ruby,Chef Infra,Chefspec,我刚接触Chef和ruby,正在进行一个培训项目,我对一些可能非常简单的事情很感兴趣,但我已经用尽了谷歌搜索和/或提交的能力。我有以下资源 directory node['tcbuildagent']['toolsfolderpath'] do action :create owner 'BUILTIN\\Administrators' group 'BUILTIN\\Administrators' rights :read_execute, 'Everyone', applie
directory node['tcbuildagent']['toolsfolderpath'] do
action :create
owner 'BUILTIN\\Administrators'
group 'BUILTIN\\Administrators'
rights :read_execute, 'Everyone', applies_to_children: true
end
…我的规格看起来像
it 'creates creates tools directory' do
expect(chef_run).to create_directory('c:\fakepathone').with(
owner: 'BUILTIN\\Administrators',
group: 'BUILTIN\\Administrators',
rights: [{ permissions: 'read_execute', principals: 'Everyone', applies_to_children: true }]
)
结束
…就我的一生而言,我无法获得工作权利的测试。我最近的错误是
1) tcbuildagent::default creates creates tools directory
Failure/Error:
expect(chef_run).to create_directory('c:\fakepathone').with(
owner: 'BUILTIN\\Administrators',
group: 'BUILTIN\\Administrators',
rights: [{ permissions: 'read_execute', principals: 'Everyone', applies_to_children: true }]
)
expected "directory[c:\fakepathone]" to have parameters:
rights [{:permissions=>"read_execute", :principals=>"Everyone", :applies_to_children=>true}], was [{:permissions=>:read_execute, :principals=>"Everyone", :applies_to_children=>true}]
Diff:
@@ -1,4 +1,4 @@
-[{:permissions=>"read_execute",
+[{:permissions=>:read_execute,
:principals=>"Everyone",
:applies_to_children=>true}]
# ./spec/unit/recipes/default_spec.rb:19:in `block (2 levels) in <top (required)>'
1)tcbuildagent::default创建工具目录
失败/错误:
期望(chef_run)。使用创建_目录('c:\fakepathone')(
所有者:“内置\\管理员”,
组:“内置\\管理员”,
权限:[{permissions:'read_execute',principals:'everybody',appliew_to_children:true}]
)
“目录[c:\fakepathone]”应具有以下参数:
权限[{:permissions=>“read\u execute”,:principals=>“Everyone”,:application\u to\u children=>true}],是[{:permissions=>:read\u execute,:principals=>“Everyone”,:application\u to\u children=>true}]
差异:
@@ -1,4 +1,4 @@
-[{:permissions=>“read_execute”,
+[{:permissions=>:read\u execute,
:principals=>“每个人”,
:将_应用于_子项=>true}]
#./spec/unit/recipes/default_spec.rb:19:in'block(2级)in'
…但我也看到了很多其他的错误
我这里缺少什么?谢谢。您有
'read\u execute'
作为字符串,它需要是:read\u execute
(即一个符号)
'foo'!=:foo
:-)我就知道这是件愚蠢的事。谢谢。