Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Commit

Permalink
better block device heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
Iaroslav Tarasenko committed Oct 14, 2015
1 parent d496e85 commit e04afab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ clean: cleanebs
rm -f .volume_id

cleanebs:
-vagrant ssh -c 'sudo umount /mnt/ebs_vagrant_test'
-. .exports && vagrant ssh -c 'sudo umount /mnt/ebs_vagrant_test'
. .exports && aws ec2 detach-volume --volume-id `cat .volume_id`
sleep 60
. .exports && aws ec2 delete-volume --volume-id `cat .volume_id`
Expand Down
8 changes: 6 additions & 2 deletions manifests/volume.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@
$volume_id_file = "/var/lib/puppet/.ebs__${name}__volume_id"
$aws_region = inline_template("<%= @ec2_placement_availability_zone.gsub(/.$/,'') %>")

$device_attached = $::osfamily? {
default => inline_template("<%= '/dev/xvd' << @device[-1] %>")
$_root_offset_device = inline_template("<%= @blockdevices.split(',').sort.first.gsub(/[0-9]/,'')[-1].ord %>")
$_offset_device = inline_template("<%= @device[-1].ord - 'a'[0].ord %>")
$_letter_xen_bd = inline_template("<%= (@_root_offset_device.to_i + @_offset_device.to_i).chr %>")

$device_attached = $::operatingsystem? {
default => inline_template("<%= '/dev/xvd' << @_letter_xen_bd %>")
}

exec { "EBS volume ${name}: obtaining the volume id":
Expand Down

0 comments on commit e04afab

Please sign in to comment.