0
우리 노드에서 요리사 클라이언트를 예약 했으므로 채팅에서 오류가보고되도록 예외 처리를 설정하고 싶습니다. 요리사 예외 처리 -> chat_message (LWRP)를 사용하는 가장 간단한 방법은 다음과 같습니다. run_failed
는 이전에 나는, 나는 LWRPchat_message
로 예외를보고 할
간단한 방법을 싶습니다 내 조리법
deploy_stuff
에 지금
chat_message do
message "Hello, World"
channel "deployments"
end
채팅 글이 LWRP를 작성하는 여기에 도움이있어, 나는 시도 이 :
# set up error handler
Chef.event_handler do
on :run_failed do |exception|
chat_message ":exclamation: chef run_failed on #{Chef.run_context.node.name}: #{exception.message}"
end
end
은 작동하지 않았다 그러나 :
Running handlers:
[2016-10-14T10:13:48+02:00] ERROR: Running exception handlers
Running handlers complete
[2016-10-14T10:13:48+02:00] ERROR: Exception handlers complete
Chef Client failed. 10 resources updated in 20 seconds
[2016-10-14T10:13:48+02:00] ERROR: undefined method `chat_message' for #<#<Class:0x00000005e1ef60>:0x00000005e1ee70>
[2016-10-14T10:13:48+02:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
undefined method chat_message
의 의미는 무엇입니까? 여기 LWRP를 사용할 수 없습니까?
chat_message
을 호출하는 다른 코드가 잘 작동하기 때문에 chat
요리 책이 포함되어있을 것입니다.
그런 다음 라이브러리 메소드가 DSL을 사용할 수 있습니까? 'chat_message'는 차례대로'execute do \ n command "curl ...."을 사용하기 때문에 \ n end' – vikingsteve
아니요, 당신은 DSL에서 일반 Ruby를 호출 할 수 있지만 그 반대는 아닙니다. – coderanger
chef :: http 클라이언트 API를 사용해야합니다. – coderanger