run list regex in constant
This commit is contained in:
parent
8dbc54b5da
commit
ad92c1fd67
@ -1,9 +1,10 @@
|
||||
module Validators
|
||||
class Helpers::RunList < Base
|
||||
|
||||
RUN_LIST_REGEX = /\Arole|recipe\[[\w-]+(::[\w-]+)?\]\Z/
|
||||
|
||||
def valid?
|
||||
rl = /\Arole|recipe\[[\w-]+(::[\w-]+)?\]\Z/
|
||||
@invalid_elements = @model.select {|l| (rl =~ l).nil?}
|
||||
@invalid_elements = @model.select {|l| (RUN_LIST_REGEX =~ l).nil?}
|
||||
@invalid_elements.empty?
|
||||
end
|
||||
|
||||
@ -12,4 +13,4 @@ module Validators
|
||||
"Invalid run list elements: '#{invalid_elements_as_string}'. Each element should be role or recipe."
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user