Skip to content

Commit d356e1f

Browse files
authored
fix: skip unusable for All Devices CU-17tkuw616e4 (#2854)
1 parent 538ef23 commit d356e1f

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎openframe-data-mongo-sync/src/main/java/com/openframe/data/service/rmm/software/PackageManagerAvailability.java‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.openframe.data.repository.device.MachineRepository;
99
import com.openframe.data.service.TenantIdProvider;
1010
import lombok.RequiredArgsConstructor;
11+
import lombok.extern.slf4j.Slf4j;
1112
import org.springframework.stereotype.Component;
1213

1314
import java.util.Arrays;
@@ -21,6 +22,7 @@
2122

2223
import static org.springframework.util.CollectionUtils.isEmpty;
2324

25+
@Slf4j
2426
@Component
2527
@RequiredArgsConstructor
2628
public class PackageManagerAvailability {
@@ -61,9 +63,10 @@ public void requireSoftwareManageable(Collection<String> machineIds, Collection<
6163
List<String> notYetUsable = machines.stream()
6264
.flatMap(machine -> notYetUsable(machine, packageManagers))
6365
.toList();
66+
// A MISSING or UNKNOWN state changes over time (user logs in, bootstrap finishes),
67+
// so one such device must not block the whole request.
6468
if (!notYetUsable.isEmpty()) {
65-
throw new BadRequestException("Package manager not yet usable on these devices: " + notYetUsable
66-
+ ". Wait for the bootstrap to finish or remove the devices.");
69+
log.info("Package manager not yet usable on these devices, accepting anyway: {}", notYetUsable);
6770
}
6871
}
6972

‎openframe-data-mongo-sync/src/test/java/com/openframe/data/service/rmm/software/PackageManagerAvailabilityTest.java‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,15 @@ void requireSoftwareManageable_unmanageableDevice_badRequestNamesOnlyIt() {
178178

179179
@ParameterizedTest
180180
@EnumSource(value = PackageManagerState.class, names = {"MISSING", "UNKNOWN"})
181-
void requireSoftwareManageable_packageManagerNotYetUsable_badRequestNamesDeviceAndManager(PackageManagerState state) {
181+
void requireSoftwareManageable_packageManagerNotYetUsable_passes(PackageManagerState state) {
182182
// setup
183183
Machine arm = machine("m-arm", Map.of(BREW, state, WINGET, UNSUPPORTED, CHOCO, UNSUPPORTED));
184184
stubMachines(Set.of("m-arm"), arm);
185185
List<String> machineIds = List.of("m-arm");
186186
List<PackageManagerType> managers = List.of(BREW);
187187

188188
// execution + verifications
189-
assertThatThrownBy(() -> availability.requireSoftwareManageable(machineIds, managers))
190-
.isInstanceOf(BadRequestException.class)
191-
.hasMessageContaining("m-arm BREW=" + state);
189+
assertThatCode(() -> availability.requireSoftwareManageable(machineIds, managers)).doesNotThrowAnyException();
192190
}
193191

194192
@Test

‎openframe-test-service-core/src/main/java/com/openframe/test/tests/SoftwareBundleTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public void testSubmitInstallNow() {
267267
HOSTNAME + " is " + device.getStatus() + "; an install submitted now would wait for it and land after this run");
268268
String winget = DeviceApi.getPackageManagerState(device.getMachineId(), "winget");
269269
assumeTrue(winget == null || "PRESENT".equals(winget),
270-
HOSTNAME + "'s agent reports winget=" + winget + "; submit refuses a package manager that is not yet usable (MISSING or UNKNOWN)");
270+
HOSTNAME + "'s agent reports winget=" + winget + "; an install cannot run while the package manager is not yet usable (MISSING or UNKNOWN)");
271271
assumeTrue(MachineConfig.isConfigured() && HOSTNAME.equalsIgnoreCase(MachineConfig.getHostname()),
272272
"No SSH channel to " + HOSTNAME + " (TARGET_* / test.machine); it is needed to check the package is absent first and to uninstall it after");
273273
assumeTrue(!new SshMachineVerifier().windowsProgramInstalled(PROGRAM),

0 commit comments

Comments
 (0)