lib/specinfra/command_factory.rb in specinfra-2.11.6 vs lib/specinfra/command_factory.rb in specinfra-2.11.7
- old
+ new
@@ -46,10 +46,12 @@
command_class.create
end
def breakdown(meth)
- types = resource_types.map {|t| t.to_snake_case }.join('|')
+ # Somtimes `selinux_module' type matches `selinux' and error occurs.
+ # Reverse sorting is needed to avoid this problem.
+ types = resource_types.map {|t| t.to_snake_case }.sort.reverse.join('|')
md = meth.to_s.match(/^([^_]+)_(#{types})_?(.+)?$/)
if md.nil?
message = "Could not break down `#{meth}' to appropriate type and method.\n"
message += "The method name shoud be in the form of `action_type_subaction'."
raise message