Chef infra foodcritic报告厨师长皮棉警告

Chef infra foodcritic报告厨师长皮棉警告,chef-infra,cookbook,Chef Infra,Cookbook,我配置了一个Jenkins作业来运行foodcritic的分析,正如推荐的那样。 当我运行此作业时,所有结果显示如下: 如前表所示,代码库中有一个由As引用的“厨师名单警告”。postgredb.rb的原始代码是: # Support whyrun require 'chef/mixin/shell_out' require 'chef/mixin/language' include Chef::Mixin::ShellOut def whyrun_supported? true e

我配置了一个Jenkins作业来运行foodcritic的分析,正如推荐的那样。 当我运行此作业时,所有结果显示如下:

如前表所示,代码库中有一个由As引用的“厨师名单警告”。postgredb.rb的原始代码是:

# Support whyrun
require 'chef/mixin/shell_out'

require 'chef/mixin/language'
include Chef::Mixin::ShellOut

def whyrun_supported?
   true
end

action :install do
  version = @new_resource.version
  options = @new_resource.options
  e = execute "sudo apt-get install postgresql-#{version} #{options}"
  @new_resource.updated_by_last_action(e.updated_by_last_action?)
end

# Now, it just changes the default password to postgres.
action :unistall do
  converge_by "Unistall postgresql--#{@new_resource.version}" do
     e = execute "sudo apt-get purge postgresql--#{@new_resource.version}" do
       #not_if { "dpkg --get-selections | grep postgresql-#{@new_resource.version}" }
     end
  end
end

...
警告针对第10行,因为“LWRP在发生更新时不通知”:

然后我试着解决换线的问题:

 @new_resource.updated_by_last_action(true)
但这个问题在第10行仍然存在


有人知道问题出在哪里吗?如果参数设置为true,为什么此警告未被消除?

从新资源之前删除
@
符号

您是否尝试从新资源之前删除@symbol?谢谢punkle,您的建议解决了此警告
 @new_resource.updated_by_last_action(true)