2017-02-21 40 views

回答

2

有关如何从文件中读取数据的更多信息,请参阅this answer

对于这种情况,因为id_rsa.pub大概只有几KB的顺序,你可以只使用

default = {'sample_cookbook' => {'auth_keys' => File.read("/app/ABC/.ssh/id_rsa.pub") }} 
+0

所以,我明白你的答案并写了这以下说明─它的工作就好了。 'default ['sample_cookbook'] ['auth_keys'] = :: File.read(“/ app/ABC/.ssh/id_rsa.pub”)' – srajappa

+3

只要记住当文件执行时会发生这种情况,您使用该属性。 – coderanger