152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
# File 'lib/conan/stackato.rb', line 152
def initialize(list_json, base_name, active_urls, inactive_urls)
app_list = JSON.parse(list_json)
active_app_names = []
inactive_app_names = []
app_list.each { |app_hash|
if !(app_hash.has_key? 'name' and app_hash.has_key? 'uris')
raise "Stackato list json is malformed: " + list_json
end
app_name = app_hash['name']
app_uris = app_hash['uris']
if app_name.start_with? base_name
if app_uris.sort == active_urls.sort
active_app_names << app_name
elsif app_uris.sort == inactive_urls.sort
inactive_app_names << app_name
else
raise 'Stackato app "' + app_name +
'" needs to be mapped exclusively to either the active or inactive set of URLs. Please reconcile before continuing.'
end
end
}
if active_app_names.length > 1
raise "More than one app is mapped to the active URL(s). Please reconcile before continuing."
end
if inactive_app_names.length > 1
raise "More than one app is mapped to the inactive URL(s). Please reconcile before continuing."
end
@active_app_name = active_app_names.first
@inactive_app_name = inactive_app_names.first
end
|