kuzushi 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/kuzushi.rb +29 -4
  3. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.11
1
+ 0.0.12
@@ -138,9 +138,31 @@ class Kuzushi
138
138
  add_package "mdadm"
139
139
  end
140
140
 
141
+ def mount_options(m)
142
+ o = []
143
+ o << m.options if m.options
144
+ o << "size=#{m.size}M" if m.size and s.media == "tmpfs"
145
+ o << "mode=#{m.mode}" if m.mode
146
+ o << "noatime" if o.empty?
147
+ o
148
+ end
149
+
150
+ def handle_mount_tmpfs(m)
151
+ task "mount #{m.mount}" do
152
+ shell "mkdir -p #{m.mount} && mount -o #{mount_options(m)} -t tmpfs tmpfs #{m.mount}" unless mounted?(m.mount)
153
+ end
154
+ end
155
+
156
+ def handle_mount_device(m)
157
+ task "mount #{m.mount}" do
158
+ shell "mkdir -p #{m.mount} && mount -o #{mount_options(m)} #{m.device} #{m.mount}" unless mounted?(m.mount)
159
+ end
160
+ end
161
+
141
162
  def handle_mount(m)
142
- task "mount #{m.device}" do
143
- shell "mkdir -p #{m.mount} && mount -o #{m.options || "noatime"} #{m.device} #{m.mount}" unless mounted?(m.device)
163
+ case m.media
164
+ when "tmpfs" then handle_mount_tmpfs(m)
165
+ else handle_mount_device(m)
144
166
  end
145
167
  end
146
168
 
@@ -148,8 +170,10 @@ class Kuzushi
148
170
  system.kernel["machine"]
149
171
  end
150
172
 
151
- def mounted?(dev)
152
- !!system.filesystem[File.basename(dev)]["mount"] rescue false
173
+ def mounted?(mount)
174
+ ## cant use ohai here b/c it mashes drives together with none or tmpfs devices
175
+ mount = mount.chop if mount =~ /\/$/
176
+ !!(File.read("/proc/mounts") =~ / #{mount} /)
153
177
  end
154
178
 
155
179
  def package_arch
@@ -238,6 +262,7 @@ class Kuzushi
238
262
  def fetch(file, &block)
239
263
  names = @config_names.clone
240
264
  begin
265
+ ## its important that we try each name for the script - allows for polymorphic scripts
241
266
  tmpfile RestClient.get("#{@base_url}/#{names.first}#{file}"), file do |tmp|
242
267
  block.call(tmp)
243
268
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kuzushi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orion Henry
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-21 00:00:00 -05:00
12
+ date: 2010-02-23 00:00:00 -05:00
13
13
  default_executable: kuzushi
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency