Avoid redeclaring the mirror-health file resource
authorTollef Fog Heen <tfheen@err.no>
Fri, 2 Feb 2018 07:03:12 +0000 (08:03 +0100)
committerTollef Fog Heen <tfheen@err.no>
Fri, 2 Feb 2018 07:03:12 +0000 (08:03 +0100)
modules/roles/manifests/mirror_health.pp

index ebc195e..41a970d 100644 (file)
@@ -7,14 +7,15 @@ define roles::mirror_health (
 ) {
        ensure_packages(['python3-requests'], { ensure => 'installed' })
 
-        # XXX: avoid duplicating this?
-       file { '/usr/local/sbin/mirror-health':
-               source => 'puppet:///modules/roles/mirror_health/mirror-health',
-               owner  => 'root',
-               group  => 'root',
-               mode   => '0555',
-                notify  => Service["mirror-health-${check_service}"],
-       }
+       if !defined(File['/usr/local/sbin/mirror-health']) {
+               file { '/usr/local/sbin/mirror-health':
+                       source => 'puppet:///modules/roles/mirror_health/mirror-health',
+                       owner  => 'root',
+                       group  => 'root',
+                       mode   => '0555',
+                        notify  => Service["mirror-health-${check_service}"],
+                }
+        }
 
         file { "/etc/systemd/system/mirror-health-${check_service}.service":
                owner   => 'root',