@@ -170,20 +170,8 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
170
170
String userId , String password ) throws AruException {
171
171
List <AruPatch > result = new ArrayList <>();
172
172
for (AruProduct product : type .products ()) {
173
- List <AruPatch > patches = getRecommendedPatches (product , version , userId , password );
174
- // temporary, until OHS stops using same release number and product ID for two different installs
175
- if (type == FmwInstallerType .OHS_DB19 ) {
176
- if (product == AruProduct .OHS ) {
177
- patches = patches .stream ().filter (p -> p .description ().contains (" DB19C " ))
178
- .collect (Collectors .toList ());
179
- } else if (product == AruProduct .OAM_WG ) {
180
- patches = patches .stream ().filter (p -> p .description ().contains (" DB19c " ))
181
- .collect (Collectors .toList ());
182
- } else if (product == AruProduct .OSS ) {
183
- patches = patches .stream ().filter (p -> p .description ().contains (" 19C " ))
184
- .collect (Collectors .toList ());
185
- }
186
- }
173
+ List <AruPatch > patches = getRecommendedPatches (type , product , version , userId , password );
174
+
187
175
if (!patches .isEmpty ()) {
188
176
patches .forEach (p -> logger .info ("IMG-0068" , product .description (), p .patchId (), p .description ()));
189
177
result .addAll (patches );
@@ -205,8 +193,8 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
205
193
* @return the recommended patches for the given product and version
206
194
* @throws AruException when response from ARU has an error or fails
207
195
*/
208
- List <AruPatch > getRecommendedPatches (AruProduct product , String version , String userId , String password )
209
- throws AruException {
196
+ List <AruPatch > getRecommendedPatches (FmwInstallerType type , AruProduct product , String version ,
197
+ String userId , String password ) throws AruException {
210
198
logger .entering (product , version );
211
199
List <AruPatch > patches = Collections .emptyList ();
212
200
try {
@@ -218,6 +206,12 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
218
206
} else {
219
207
// Get a list of patches applicable to the given product and release number
220
208
patches = getReleaseRecommendations (product , releaseNumber , userId , password );
209
+ logger .fine ("Search for {0} recommended patches returned {1}" , product , patches .size ());
210
+ if (type == FmwInstallerType .OHS_DB19 ) {
211
+ // Workaround for OHS where the DB19 patches and the DB12 patches have the same product/release ID
212
+ patches = filterDb19Patches (patches , product );
213
+ }
214
+
221
215
String psuVersion = getPsuVersion (product .description (), patches );
222
216
if (psuVersion != null ) {
223
217
// Check to see if there is a release with the PSU version that contains overlay patches.
@@ -227,11 +221,11 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
227
221
String psuReleaseNumber = getReleaseNumber (product , psuVersion , userId , password );
228
222
// If there is a release for the specific PSU, check it for overlay patches
229
223
if (!Utils .isEmptyString (psuReleaseNumber )) {
230
- // Debug log - useful to know what was thrown away when "patches" is replaced by the new array
231
- patches .forEach (p -> logger .fine ("Discarding recommended patch {0} {1}" ,
232
- p .patchId (), p .description ()));
233
224
// Get recommended patches for PSU release (includes PSU overlay patches)
234
- patches = getReleaseRecommendations (product , psuReleaseNumber , userId , password );
225
+ List <AruPatch > overlays =
226
+ getReleaseRecommendations (product , psuReleaseNumber , userId , password );
227
+ logger .fine ("Search for PSU {0} overlay patches returned {1}" , psuVersion , overlays .size ());
228
+ patches .addAll (overlays );
235
229
} else {
236
230
// ARU does not have a release number for the PSU version found (no overlays needed)
237
231
logger .fine ("PSU release was not found for {0} : {1}" , product , psuVersion );
@@ -247,6 +241,25 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
247
241
return patches ;
248
242
}
249
243
244
+ /**
245
+ * This is a temporary workaround to select DB19 patches from a recommended list of patches.
246
+ * Currently, OHS is using the same release number and product ID for two different installs (DB19 and DB12).
247
+ * @param patches patches list to filter
248
+ * @param product AruProduct that the supplied patches are for
249
+ */
250
+ private List <AruPatch > filterDb19Patches (List <AruPatch > patches , AruProduct product ) {
251
+ List <AruPatch > result = patches ;
252
+ // temporary, until OHS stops using same release number and product ID for two different installs
253
+ if (product == AruProduct .OHS ) {
254
+ result = patches .stream ().filter (p -> p .description ().contains (" DB19C " )).collect (Collectors .toList ());
255
+ } else if (product == AruProduct .OAM_WG ) {
256
+ result = patches .stream ().filter (p -> p .description ().contains (" DB19c " )).collect (Collectors .toList ());
257
+ } else if (product == AruProduct .OSS ) {
258
+ result = patches .stream ().filter (p -> p .description ().contains (" 19C " )).collect (Collectors .toList ());
259
+ }
260
+ return result ;
261
+ }
262
+
250
263
private String getPsuVersion (String productName , Collection <AruPatch > patches ) {
251
264
String psuBundle = patches .stream ()
252
265
.map (AruPatch ::psuBundle )
@@ -270,6 +283,7 @@ List<AruPatch> getReleaseRecommendations(AruProduct product, String releaseNumbe
270
283
.filter (not (AruPatch ::isStackPatchBundle )) // remove the Stack Patch Bundle patch, if returned
271
284
// TODO: Need an option for the user to request the Coherence additional feature pack.
272
285
.filter (not (AruPatch ::isCoherenceFeaturePack )) // remove the Coherence feature pack, if returned
286
+ .filter (p -> p .release ().equals (releaseNumber ))
273
287
.collect (Collectors .toList ());
274
288
}
275
289
0 commit comments