大家好,希望得到帮助。
最近我发现我有一点问题。 我想以这种特定方式向我的厨师添加一些日志记录
log name do
message information
action :nothing
level :info
subscribes :write, "#{type}[#{name}]", :immediately
end
我的目标是创建新的配方(log.rb),我将把所有日志都放在"订阅"选项限制为我想记录的资源。
我的问题是事实,它不起作用。 Cookbook将编译,但不会显示任何日志 - 如果我将操作更改为':write',则会显示所有日志,但不会在我想要的时候显示(订阅不起作用,所以这一切都只是显示像正常的食谱。)
奇怪的是,只有资源" powershell_script"工作正常
powershell_script 'Run repo script' do
code <<-EOH
Start-Process "cmd.exe" "/c #{node['template']['path']['repo']}"
EOH
end
但是这不会记录任何信息
template 'JBoss instance settings' do
source node['template']['jboss_server_setting']
path node['template']['path']['jboss_server_setting']
end
有人有一个想法,为什么它没有工作f.e.使用模板,cookbook_file和remote_directory?
我的厨师是12.4.1,我在本地模式下运行chef-client。操作系统:Microsoft Windows 7.请询问其他信息。
以下是一些调试信息:
a)for powershell_script
Line 16223: [2015-07-31T09:05:39+02:00] INFO: Processing log[Run repo script] action nothing (line 7)
Line 16224: [2015-07-31T09:05:39+02:00] DEBUG: Skipping log[Run repo script] due to action :nothing
Line 16225: [2015-07-31T09:05:39+02:00] INFO: Processing powershell_script[Run repo script] action run (line 23)
Line 16227: [2015-07-31T09:05:39+02:00] DEBUG: Provider for action run on resource powershell_script[Run repo script] is Chef::Provider::PowershellScript
Line 16295: [2015-07-31T09:05:40+02:00] INFO: powershell_script[Run repo script] ran successfully
Line 16296: [2015-07-31T09:05:40+02:00] INFO: powershell_script[Run repo script] sending write action to log[Run repo script] (immediate)
Line 16296: [2015-07-31T09:05:40+02:00] INFO: powershell_script[Run repo script] sending write action to log[Run repo script] (immediate)
Line 16297: [2015-07-31T09:05:40+02:00] INFO: Processing log[Run repo script] action write (line 7)
b)其他资源
Line 16170: [2015-07-31T09:05:38+02:00] INFO: Processing log[JBoss instance settings] action nothing (line 7)
Line 16171: [2015-07-31T09:05:38+02:00] DEBUG: Skipping log[JBoss instance settings] due to action :nothing
Line 16172: [2015-07-31T09:05:38+02:00] INFO: Processing template[JBoss instance settings] action create (line 66)
Line 16174: [2015-07-31T09:05:38+02:00] DEBUG: Provider for action create on resource template[JBoss instance settings] is Chef::Provider::Template
Line 16175: [2015-07-31T09:05:38+02:00] DEBUG: template[JBoss instance settings] checksumming file at C:/Projekty/Colis/workspace/.metadata/.plugins/org.eclipse.wst.server.core/servers.xml.
感谢您的帮助。