camptocamp/puppet-aws — Issue #2: aws::partition: replace weak ec2_instance_type check
Author: fredj
Created: 2011-12-06 13:33:06+00:00
State: open

The ```ec2_instance_type``` switch is weak and the same resources are defined multiple times.

It could be replaced with something like (untested):

class aws::partition {
$fstype = $lsbdistcodename ? {
'squeeze' => 'ext4',
default => 'ext3',
}

if ($ec2_block_device_mapping_ephemeral0) {
file {"/mnt":
ensure => directory,
mode => 755,
}
mount {"/mnt":
ensure => mounted,
device => "/dev/${ec2_block_device_mapping_ephemeral0}",
fstype => $fstype,
options => "defaults",
require => File["/mnt"],
}
}
if ($ec2_block_device_mapping_ephemeral1) {
file {"/mnt2":
ensure => directory,
mode => 755,
}
mount {"/mnt2":
ensure => mounted,
device => "/dev/${ec2_block_device_mapping_ephemeral1}",
fstype => $fstype,
options => "defaults",
require => File["/mnt2"],
}
}
if ($ec2_block_device_mapping_ephemeral2) {
# ...

No more instance type dependency, no duplicate code.