Skip to content

Commit fff4d03

Browse files
authored
Merge pull request #74 from varshavaradarajan/fix-non-blank-bug
Make enable_private_registry_authentication and pull_on_container_create optional with defaults. (#73)
2 parents 2aee96b + 382192f commit fff4d03

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/main/java/cd/go/contrib/elasticagents/docker/executors/GetPluginConfigurationExecutor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ public class GetPluginConfigurationExecutor implements RequestExecutor {
3939
public static final Field DOCKER_CA_CERT = new Field("docker_ca_cert", "Docker CA Certificate", null, false, true, "5");
4040
public static final Field DOCKER_CLIENT_KEY = new Field("docker_client_key", "Docker Client Key", null, false, true, "6");
4141
public static final Field DOCKER_CLIENT_CERT = new Field("docker_client_cert", "Docker Client Certificate", null, false, true, "7");
42-
public static final Field ENABLE_PRIVATE_REGISTRY_AUTHENTICATION = new NonBlankField("enable_private_registry_authentication", "Use Private Registry", "false", true, false, "8");
42+
public static final Field ENABLE_PRIVATE_REGISTRY_AUTHENTICATION = new Field("enable_private_registry_authentication", "Use Private Registry", "false", true, false, "8");
4343
private static final Predicate<ValidatePluginSettings> privateRegistryFieldsPredicate = new Predicate<ValidatePluginSettings>() {
4444
@Override public boolean apply(ValidatePluginSettings settings) { return Boolean.parseBoolean(settings.get(ENABLE_PRIVATE_REGISTRY_AUTHENTICATION.key()));}
4545
};
4646
public static final Field PRIVATE_REGISTRY_SERVER = new ConditionalNonBlankField("private_registry_server", "Private Registry Server", null, false, false, "9", privateRegistryFieldsPredicate);
4747
public static final Field PRIVATE_REGISTRY_USERNAME = new ConditionalNonBlankField("private_registry_username", "Private Registry Username", null, false, false, "10", privateRegistryFieldsPredicate);
4848
public static final Field PRIVATE_REGISTRY_PASSWORD = new ConditionalNonBlankField("private_registry_password", "Private Registry Password", null, false, true, "11", privateRegistryFieldsPredicate);
49-
public static final Field PULL_ON_CONTAINER_CREATE = new NonBlankField("pull_on_container_create", "Pull image before creating the container", "false", true, false, "12");
49+
public static final Field PULL_ON_CONTAINER_CREATE = new Field("pull_on_container_create", "Pull image before creating the container", "false", true, false, "12");
5050

5151
public static final Map<String, Field> FIELDS = new LinkedHashMap<>();
5252

src/test/java/cd/go/contrib/elasticagents/docker/executors/ValidateConfigurationExecutorTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,6 @@ public void shouldValidateABadConfiguration() throws Exception {
4747
" {\n" +
4848
" \"message\": \"Agent auto-register Timeout (in minutes) must be a positive integer.\",\n" +
4949
" \"key\": \"auto_register_timeout\"\n" +
50-
" },\n" +
51-
" {\n" +
52-
" \"message\": \"Use Private Registry must not be blank.\",\n" +
53-
" \"key\": \"enable_private_registry_authentication\"\n" +
54-
" },\n" +
55-
" {\n" +
56-
" \"message\": \"Pull image before creating the container must not be blank.\",\n" +
57-
" \"key\": \"pull_on_container_create\"\n" +
5850
" }\n" +
5951
"]\n", response.responseBody(), true);
6052
}

0 commit comments

Comments
 (0)