Skip to content

Commit 234c9f7

Browse files
committed
Remove declaration of physical_volume if device isn't found
This prevents a Puppet parser error when a volume is not attached to an instance while appearing being mentionned in terraform_data.yaml. It can happen when for example OpenStack fails to attach a volume to an instance.
1 parent ec74c76 commit 234c9f7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

site/profile/manifests/volumes.pp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,17 @@
7070
path => ['/bin', '/usr/bin', '/sbin', '/usr/sbin'],
7171
}
7272

73-
physical_volume { $device:
74-
ensure => present,
73+
if $device != undef {
74+
physical_volume { $device:
75+
ensure => present,
76+
}
77+
} else {
78+
notify { "error_${volume_name}":
79+
message => @("EOT")
80+
WARNING: Could not find device ${glob} associated with ${volume_tag}-${volume_name}.
81+
This will cause errors with resources related to ${volume_tag}-${volume_name}.
82+
| EOT
83+
}
7584
}
7685

7786
volume_group { "${name}_vg":

0 commit comments

Comments
 (0)