diff --git a/openframe-data-mongo-sync/src/main/java/com/openframe/data/service/rmm/software/PackageManagerAvailability.java b/openframe-data-mongo-sync/src/main/java/com/openframe/data/service/rmm/software/PackageManagerAvailability.java index ebfbb91211..fc91907bab 100644 --- a/openframe-data-mongo-sync/src/main/java/com/openframe/data/service/rmm/software/PackageManagerAvailability.java +++ b/openframe-data-mongo-sync/src/main/java/com/openframe/data/service/rmm/software/PackageManagerAvailability.java @@ -8,6 +8,7 @@ import com.openframe.data.repository.device.MachineRepository; import com.openframe.data.service.TenantIdProvider; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.Arrays; @@ -21,6 +22,7 @@ import static org.springframework.util.CollectionUtils.isEmpty; +@Slf4j @Component @RequiredArgsConstructor public class PackageManagerAvailability { @@ -61,9 +63,10 @@ public void requireSoftwareManageable(Collection machineIds, Collection< List notYetUsable = machines.stream() .flatMap(machine -> notYetUsable(machine, packageManagers)) .toList(); + // A MISSING or UNKNOWN state changes over time (user logs in, bootstrap finishes), + // so one such device must not block the whole request. if (!notYetUsable.isEmpty()) { - throw new BadRequestException("Package manager not yet usable on these devices: " + notYetUsable - + ". Wait for the bootstrap to finish or remove the devices."); + log.info("Package manager not yet usable on these devices, accepting anyway: {}", notYetUsable); } } diff --git a/openframe-data-mongo-sync/src/test/java/com/openframe/data/service/rmm/software/PackageManagerAvailabilityTest.java b/openframe-data-mongo-sync/src/test/java/com/openframe/data/service/rmm/software/PackageManagerAvailabilityTest.java index 361adf151f..6d008195f5 100644 --- a/openframe-data-mongo-sync/src/test/java/com/openframe/data/service/rmm/software/PackageManagerAvailabilityTest.java +++ b/openframe-data-mongo-sync/src/test/java/com/openframe/data/service/rmm/software/PackageManagerAvailabilityTest.java @@ -178,7 +178,7 @@ void requireSoftwareManageable_unmanageableDevice_badRequestNamesOnlyIt() { @ParameterizedTest @EnumSource(value = PackageManagerState.class, names = {"MISSING", "UNKNOWN"}) - void requireSoftwareManageable_packageManagerNotYetUsable_badRequestNamesDeviceAndManager(PackageManagerState state) { + void requireSoftwareManageable_packageManagerNotYetUsable_passes(PackageManagerState state) { // setup Machine arm = machine("m-arm", Map.of(BREW, state, WINGET, UNSUPPORTED, CHOCO, UNSUPPORTED)); stubMachines(Set.of("m-arm"), arm); @@ -186,9 +186,7 @@ void requireSoftwareManageable_packageManagerNotYetUsable_badRequestNamesDeviceA List managers = List.of(BREW); // execution + verifications - assertThatThrownBy(() -> availability.requireSoftwareManageable(machineIds, managers)) - .isInstanceOf(BadRequestException.class) - .hasMessageContaining("m-arm BREW=" + state); + assertThatCode(() -> availability.requireSoftwareManageable(machineIds, managers)).doesNotThrowAnyException(); } @Test diff --git a/openframe-test-service-core/src/main/java/com/openframe/test/tests/SoftwareBundleTest.java b/openframe-test-service-core/src/main/java/com/openframe/test/tests/SoftwareBundleTest.java index 93254186f4..9a0ff9acd9 100644 --- a/openframe-test-service-core/src/main/java/com/openframe/test/tests/SoftwareBundleTest.java +++ b/openframe-test-service-core/src/main/java/com/openframe/test/tests/SoftwareBundleTest.java @@ -267,7 +267,7 @@ public void testSubmitInstallNow() { HOSTNAME + " is " + device.getStatus() + "; an install submitted now would wait for it and land after this run"); String winget = DeviceApi.getPackageManagerState(device.getMachineId(), "winget"); assumeTrue(winget == null || "PRESENT".equals(winget), - HOSTNAME + "'s agent reports winget=" + winget + "; submit refuses a package manager that is not yet usable (MISSING or UNKNOWN)"); + HOSTNAME + "'s agent reports winget=" + winget + "; an install cannot run while the package manager is not yet usable (MISSING or UNKNOWN)"); assumeTrue(MachineConfig.isConfigured() && HOSTNAME.equalsIgnoreCase(MachineConfig.getHostname()), "No SSH channel to " + HOSTNAME + " (TARGET_* / test.machine); it is needed to check the package is absent first and to uninstall it after"); assumeTrue(!new SshMachineVerifier().windowsProgramInstalled(PROGRAM),