当我尝试在 json 文件中包含以下内容时:
"pattern": "^carbon\..*",
Run Code Online (Sandbox Code Playgroud)
我收到错误“非法转义序列”。请问json应该怎么写呢?
谢谢。加布里埃尔
在厨师环境中,对于食谱,我有这些数组:
"envs": ["ci","ui","qa"],
"services": ["service_a","service_b","service_c","service_x"]
Run Code Online (Sandbox Code Playgroud)
在模板文件中我使用了这个:
<% @envs.each do |env| %>
file {
<%
logfiles = ""
@services.each do |service|
logfiles = logfiles + "\"" + "/remotelogs/" + @env + "/" + @service + "_syslog.log\", "
end
logfiles = logfiles.chomp(", ")
%>
path => [<%= logfiles %>]
}
<% end %>
Run Code Online (Sandbox Code Playgroud)
我得到的错误是这样的:
no implicit conversion of nil into String
...
Template Context:
-----------------
on line #7
5: logfiles = ""
6: @services.each do |service|
7: logfiles = logfiles + "\"" …Run Code Online (Sandbox Code Playgroud)