private static String getConfigProperty(String propertyName) { return ConfigurationUtil.getProperty(propertyName); }
/** * Returns whether Admiral is running on embedded mode or not based on the "embedded" * configuration property. */ public static boolean isEmbedded() { return Boolean.valueOf(ConfigurationUtil.getProperty(EMBEDDED_MODE_PROPERTY)); }
/** * Checks for additional runtimes that are not provided out of the box. We need to provide * registry to download the image from. * * @param runtime * @return */ public static boolean isAdditionalRuntimeSwitchedOn(String runtime) { String runtimeOn = ConfigurationUtil .getProperty(ClosureProps.CLOSURE_RUNTIME_IMAGE_REGISTRY + runtime); return !(runtimeOn == null || runtimeOn.isEmpty()); }
public static boolean isVca() { return Boolean.valueOf(ConfigurationUtil.getProperty(VCA_MODE_PROPERTY)); }
public static Long getContainerMinMemoryLimit() { if (containerMinMemory.get() == -1) { try { String value = ConfigurationUtil.getProperty(CONTAINER_MIN_MEMORY_PROPERTY); long l = Long.parseLong(value); containerMinMemory.compareAndSet(-1, l); return containerMinMemory.get(); } catch (Exception e) { containerMinMemory.set(CONTAINER_MIN_MEMORY_BYTES); } } return containerMinMemory.get(); }
private void validatePlainHttpConnection(Service sender, HostSpec hostSpec, Operation op, Runnable callbackFunction) { boolean allowRegistryInsecureConnection = Boolean.valueOf( ConfigurationUtil.getProperty(ALLOW_REGISTRY_PLAIN_HTTP_CONNECTION_PROP_NAME)); if (!hostSpec.isSecureScheme() && !allowRegistryInsecureConnection) { String message = String.format("Plain HTTP registry connections are not allowed."); LocalizableValidationException ex = new LocalizableValidationException(message, "compute.registry.plain.http.not.allowed"); ServiceErrorResponse rsp = Utils.toValidationErrorResponse(ex, op); logSevere(rsp.message); op.setStatusCode(Operation.STATUS_CODE_BAD_REQUEST); op.fail(ex, rsp); } else { callbackFunction.run(); } }
static ServiceDocument buildDefaultStateInstance(ServiceHost host) { RegistryState state = new RegistryState(); state.documentSelfLink = DEFAULT_INSTANCE_LINK; state.address = DEFAULT_REGISTRY_ADDRESS; state.name = DEFAULT_REGISTRY_NAME; state.endpointType = RegistryState.DOCKER_REGISTRY_ENDPOINT_TYPE; state.disabled = Boolean.FALSE; state.customProperties = new HashMap<>(); state.customProperties.put(API_VERSION_PROP_NAME, ApiVersion.V1.toString()); boolean disableDefaultRegistry = Boolean.valueOf( ConfigurationUtil.getProperty(RegistryService.DISABLE_DEFAULT_REGISTRY_PROP_NAME)); // create or delete default registry if (disableDefaultRegistry) { // ensure default registry does not exist host.registerForServiceAvailability((o, e) -> { host.log(Level.INFO, "registerForServiceAvailability: %s", RegistryFactoryService.SELF_LINK); deleteDefaultRegistry(host); }, true, RegistryFactoryService.SELF_LINK); return null; } return state; }
.valueOf(ConfigurationUtil.getProperty(ALLOW_VCH_STATS_COLLECTION_PROP_NAME)); if (ContainerHostUtil.isVicHost(context.computeState) && !allowVchStatsCollection) { context.operation.fail(new LocalizableValidationException(
assertEquals("key1", config.key); assertEquals("one", config.value); assertEquals("one", ConfigurationUtil.getProperty("key1")); assertEquals("key2", config.key); assertEquals("2", config.value); assertEquals("2", ConfigurationUtil.getProperty("key2")); assertEquals("key3", config.key); assertEquals("true", config.value); assertEquals("true", ConfigurationUtil.getProperty("key3")); assertEquals("key1", config.key); assertEquals("one more", config.value); assertEquals("one more", ConfigurationUtil.getProperty("key1")); assertEquals("key2", config.key); assertEquals("4", config.value); assertEquals("4", ConfigurationUtil.getProperty("key2")); assertEquals("key3", config.key); assertEquals("false", config.value); assertEquals("false", ConfigurationUtil.getProperty("key3")); ctx.completeIteration(); } catch (Throwable t) {