Puppet: is there a way to catch failure to apply a resource?

岁酱吖の 提交于 2020-01-06 08:33:35

问题


is there a way in Puppet to catch a failure when resource is applied, for example, when declaration like

 file { '/var/tmp/test':
      ensure => file,
      mode   => '0755',
    }

fails, invoke something like

exec { 'Register some failure':
    command => '/var/tmp/register failure for /var/tmp/test',
}

?


回答1:


You can try this :

  exec { 'Notify a failure' :
      command => "/var/tmp/register failure for /var/tmp/test",
      path => "/bin:",
      subscribe => File["/var/tmp/test"],
  }


来源:https://stackoverflow.com/questions/22173654/puppet-is-there-a-way-to-catch-failure-to-apply-a-resource

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!