123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
# File 'lib/fog/openstack.rb', line 123
def self.extract_version_from_body(body, supported_versions)
versions = []
unless body['versions'].nil? || body['versions'].empty?
versions = body['versions'].kind_of?(Array) ? body['versions'] : body['versions']['values']
end
unless body['version'].nil? or versions.length != 0
versions = [body['version']]
end
version = nil
%w(CURRENT stable SUPPORTED DEPRECATED).each do |status|
version = versions.find { |x| x['id'].match(supported_versions) && (x['status'] == status) }
break if version
end
version
end
|