|
43 | 43 | else
|
44 | 44 | device = node[:platform_family] == 'debian' ? ebsConfig['dev'].gsub(%r{^/dev/sd}, '/dev/xvd') : ebsConfig['dev']
|
45 | 45 |
|
46 |
| - execute 'mkfs' do |
47 |
| - command "mkfs -t #{ebsConfig['fstype']} #{device}" |
48 |
| - not_if do |
49 |
| - BlockDevice.wait_for(device) |
50 |
| - system("blkid -s TYPE -o value #{device}") |
| 46 | + case ebsConfig['fstype'] |
| 47 | + when "swap" |
| 48 | + execute 'mkswap' do |
| 49 | + command "mkswap #{device}" |
| 50 | + not_if do |
| 51 | + BlockDevice.wait_for(device) |
| 52 | + system("blkid -s TYPE -o value #{device}") |
| 53 | + end |
51 | 54 | end
|
52 |
| - end |
53 | 55 |
|
54 |
| - # workaround for when user doesn't exist during bootstrap |
55 |
| -# user ebsConfig['user'] do |
56 |
| -# end |
| 56 | + execute 'swapon' do |
| 57 | + command "swapon #{device}" |
| 58 | + end |
57 | 59 |
|
58 |
| - directory mountPoint do |
59 |
| - owner ebsConfig['user'] |
60 |
| - mode 0755 |
| 60 | + mount mountPoint do |
| 61 | + device device |
| 62 | + fstype ebsConfig['fstype'] |
| 63 | + options ebsConfig['mountopts'] |
61 | 64 |
|
62 |
| - action :create |
63 |
| - end |
| 65 | + pass 0 |
| 66 | + action [:enable] |
| 67 | + end |
| 68 | + |
| 69 | + else |
| 70 | + execute 'mkfs' do |
| 71 | + command "mkfs -t #{ebsConfig['fstype']} #{device}" |
| 72 | + not_if do |
| 73 | + BlockDevice.wait_for(device) |
| 74 | + system("blkid -s TYPE -o value #{device}") |
| 75 | + end |
| 76 | + end |
64 | 77 |
|
65 |
| - mount mountPoint do |
66 |
| - device device |
67 |
| - fstype ebsConfig['fstype'] |
68 |
| - options ebsConfig['mountopts'] |
| 78 | + # workaround for when user doesn't exist during bootstrap |
| 79 | + # user ebsConfig['user'] do |
| 80 | + # end |
69 | 81 |
|
70 |
| - action [:mount, :enable] |
| 82 | + directory mountPoint do |
| 83 | + owner ebsConfig['user'] |
| 84 | + mode 0755 |
| 85 | + |
| 86 | + action :create |
| 87 | + end |
| 88 | + |
| 89 | + mount mountPoint do |
| 90 | + device device |
| 91 | + fstype ebsConfig['fstype'] |
| 92 | + options ebsConfig['mountopts'] |
| 93 | + |
| 94 | + action [:mount, :enable] |
| 95 | + end |
71 | 96 | end
|
72 | 97 | end
|
73 | 98 | end
|
|
0 commit comments