puppet 3.x 弃用的一些语法

最近发现puppet 日志中报警告信息,如下:

 puppet puppet-master[17329]: Deprecation notice:  Resource references should now be capitalized on line 21 in file /etc/puppet/environments/production/modules/check_mk/manifests/debian.pp


经过查看,原来是puppet 3.x 弃用了一些2.7 的写法,具体如下:


file 与exec 依赖关系

file {"/tmp/check_upgrade.sh":
         mode    => 755,
         owner   => root,
         group   => root,
         source  => "puppet:///check_mk/check_upgrade.sh"
}

 exec {"/tmp/check_upgrade.sh":
        cwd => "/tmp",
        user => root,
        subscribe => File["/tmp/check_upgrade.sh"],
        refreshonly => true, ####如果/tmp/check_upgrade.sh 文件发生变化则执行改shell 文件
  }
弃用原来的如下:
file {"/tmp/check_upgrade.sh":
         source  => "puppet:///check_mk/check_upgrade.sh"
         alias => check,
}
exec {"/tmp/check_upgrade.sh"
          require => File ["check"],

file 与service 之间的关系
   file {"check_mk":
          #notify => service["xinetd"],
          name => "/etc/xinetd.d/check_mk",
          owner => root,
          group => root,
          mode => 0644,
          source => "puppet:///check_mk/check_mk",
          require => Package["xinetd"],    

     }
     service { "xinetd":
          ensure => running,
          enable => true,
          require => Package["xinetd"],
          subscribe=>File [check_mk], ###文件check_mk 变化则reload 服务,不是restart 服务

     }
弃用以前的:
# define the service to restart
service { "sshd":
    ensure  => "running",
    enable  => "true",
    require => Package["openssh-server"],
}

# add a notify to the file resource
file { "/etc/ssh/sshd_config":
    notify  => Service["sshd"],  # this sets up the relationship
    mode    => 600,
    owner   => "root",
    group   => "root",
    require => Package["openssh-server"],
    content => template("ssh/sshd_config.erb"),

}

http://hi.baidu.com/nessus1/item/5d1012514c82954e4eff20d0

你可能感兴趣的:(now,resource,puppet,3.x,references,should,be,弃用写法,capitalized)