KVM host image creator.Jessica Lockwood
Revisión | 06fa658f1656a5845e5afdcfd09a5960495c56db (tree) |
---|---|
Tiempo | 2019-12-09 18:15:40 |
Autor | ![]() |
Commiter | Tatsuki SUGIURA |
Add limit option.
@@ -201,6 +201,13 @@ class ImageCreator | ||
201 | 201 | end |
202 | 202 | |
203 | 203 | if $0 == __FILE__ |
204 | + require 'optparse' | |
205 | + | |
206 | + opts = ARGV.getopts('l:', 'limit:', 'skip:') | |
207 | + limit_pat = opts['limit'] || opts['l'] | |
208 | + limit_pat and | |
209 | + limit_pat = Regexp.new(limit_pat) | |
210 | + | |
204 | 211 | list = YAML.load_file(ARGV[0] || 'image-list.yml') |
205 | 212 | list.each do |imgdef| |
206 | 213 | name = nil |
@@ -214,6 +221,9 @@ if $0 == __FILE__ | ||
214 | 221 | else |
215 | 222 | name = imgdef |
216 | 223 | end |
224 | + if limit_pat | |
225 | + limit_pat.match?(name) or next | |
226 | + end | |
217 | 227 | dirs.empty? and dirs << SyncDirDef.new |
218 | 228 | ImageCreator.new(name, dirs).run |
219 | 229 | end |