Skip to content

Commit

Permalink
Merge pull request #62 from rundeck-plugins/issue/61
Browse files Browse the repository at this point in the history
Fix #61 add synchronousLoad to disable async load
  • Loading branch information
gschueler committed Feb 23, 2017
2 parents 8520924 + 295225b commit 89f3af9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Readme.md
Expand Up @@ -35,7 +35,8 @@ Here are the configuration properties:
* `accessKey`: API AccessKey value (if not using IAM profile)
* `secretKey`: API SecretKey value (if not using IAM profile)
* `endpoint` - the URL of the AWS **endpoint** to use, or blank for the default endpoint (see [Amazon EC2 Regions and Endpoints](http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region))
* `refreshInterval`: Time in seconds used as minimum interval between calls to the AWS API. (default 30)
* `synchronousLoad`: Do not use internal async loading behavior. (boolean, default: true)
* `refreshInterval`: Unless using Synchronous Loading, time in seconds used as minimum interval between calls to the AWS API. (default 30)
* `filter` A set of ";" separated query filters ("$Name=$Value") for the AWS EC2 API, see below.
* `runningOnly`: if "true", automatically filter the * instances by "instance-state-name=running"
* `useDefaultMapping`: if "true", base all mapping definitions off the default mapping provided.
Expand All @@ -44,6 +45,10 @@ Here are the configuration properties:

If you leave `accessKey` and `secretKey` blank, the EC2 IAM profile will be used.

Note: Rundeck 2.6.3+ uses an asynchronous nodes cache by
default. You should enable `synchronousLoad` if you are using the
rundeck nodes cache, or set the `refreshInterval` to 0.

## Filter definition

The syntax for defining filters uses `$Name=$Value[;$Name=$value[;...]]` for any of the allowed filter names (see [DescribeInstances][1] for the available filter Names). *Note*: you do not need to specify `Filter.1.Name=$Name`, etc. as described in the EC2 API documentation, this will handled for you. Simply list the Name = Value pairs, separated by `;`.
Expand Down
Expand Up @@ -40,6 +40,8 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;

import static com.dtolabs.rundeck.plugin.resources.ec2.EC2ResourceModelSourceFactory.SYNCHRONOUS_LOAD;

/**
* EC2ResourceModelSource produces nodes by querying the AWS EC2 API to list instances.
* <p/>
Expand Down Expand Up @@ -186,6 +188,7 @@ public EC2ResourceModelSource(final Properties configuration) {
clientConfiguration.setProxyUsername(httpProxyUser);
clientConfiguration.setProxyPassword(httpProxyPass);
}
queryAsync = !("true".equals(configuration.getProperty(SYNCHRONOUS_LOAD)) || refreshInterval <= 0);

initialize();
}
Expand Down
Expand Up @@ -62,6 +62,7 @@ public class EC2ResourceModelSourceFactory implements ResourceModelSourceFactory
public static final String ROLE_ARN = "assumeRoleArn";
public static final String MAPPING_FILE = "mappingFile";
public static final String REFRESH_INTERVAL = "refreshInterval";
public static final String SYNCHRONOUS_LOAD = "synchronousLoad";
public static final String USE_DEFAULT_MAPPING = "useDefaultMapping";
public static final String HTTP_PROXY_HOST = "httpProxyHost";
public static final String HTTP_PROXY_PORT = "httpProxyPort";
Expand Down Expand Up @@ -107,8 +108,18 @@ public ResourceModelSource createResourceModelSource(final Properties properties
null
)
)
.property(PropertyUtil.integer(REFRESH_INTERVAL, "Refresh Interval",
"Minimum time in seconds between API requests to AWS (default is 30)", false, "30"))
.property(PropertyUtil.bool(
SYNCHRONOUS_LOAD,
"Synchronous Loading",
"Do not use internal async loading behavior.\n\n" +
"Note: Rundeck 2.6.3+ uses an asynchronous nodes cache by " +
"default. You should enable this if you are using the " +
"rundeck nodes cache.",
false,
"true"
))
.property(PropertyUtil.integer(REFRESH_INTERVAL, "Async Refresh Interval",
"Unless using Synchronous Loading, minimum time in seconds between API requests to AWS (default is 30)", false, "30"))
.property(PropertyUtil.string(FILTER_PARAMS, "Filter Params", "AWS EC2 filters", false, null))
.property(PropertyUtil.string(ENDPOINT, "Endpoint", "AWS EC2 Endpoint, or blank for default", false, null))
.property(PropertyUtil.string(HTTP_PROXY_HOST, "HTTP Proxy Host", "HTTP Proxy Host Name, or blank for default", false, null))
Expand Down

0 comments on commit 89f3af9

Please sign in to comment.