2017-02-21 39 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