这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Mar 4, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'nebula.netflixoss' version '2.2.9'
id 'net.saliman.cobertura' version '2.2.7'
id 'com.github.hierynomus.license' version '0.11.0'
}

// Establish version and status
Expand Down Expand Up @@ -62,8 +63,9 @@ tasks.withType(JavaCompile) {
artifacts {
archives tasks.jar
}
import nl.javadude.gradle.plugins.license.License
tasks.withType(License).each { licenseTask ->
licenseTask.exclude '**/*.json'
licenseTask.exclude '**/*.properties'

license {
exclude '**/*.properties'
exclude '**/*.json'
exclude '**/*.sh'
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ private List<Resource> getVolumeResources(String... volumeIds) {
* Gets all volumes that are not attached to any instance. Janitor Monkey only considers unattached volumes
* as cleanup candidates, so there is no need to get volumes that are in-use.
* @param region
* @return
* @return list of resources that are not attached to any instance
*/
private List<Resource> getUnattachedVolumeResourcesInRegion(String region, String... volumeIds) {
String url = eddaClient.getBaseUrl(region) + "/aws/volumes;";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ public AWSCredentialsProvider getAwsCredentialsProvider() {
* (Duplicates a method in MonkeyServer; refactor to util?).
*
* @param key
* @return
* @return the loaded class or null if the class is not found
*/
@SuppressWarnings("rawtypes")
private Class loadClientClass(String key) {
Expand Down
31 changes: 18 additions & 13 deletions src/main/java/com/netflix/simianarmy/client/aws/AWSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,16 @@ public class AWSClient implements CloudClient {
/** The plain name for AWS account */
private final String accountName;

/** Maximum retry count for Simple DB */
private static final int SIMPLE_DB_MAX_RETRY = 11;

private final AWSCredentialsProvider awsCredentialsProvider;

private final ClientConfiguration awsClientConfig;

private ComputeService jcloudsComputeService;



/**
* This constructor will let the AWS SDK obtain the credentials, which will
Expand Down Expand Up @@ -220,7 +225,7 @@ public String region() {
/**
* The accountName.
*
* @accountName the plain name for the aws account easier to identify which account
* @return the plain name for the aws account easier to identify which account
* monkey is running in
*/
public String accountName() {
Expand Down Expand Up @@ -306,19 +311,19 @@ protected AmazonElasticLoadBalancingClient elbClient() {
*/
public AmazonSimpleDB sdbClient() {
AmazonSimpleDB client;
if (awsClientConfig == null) {
if (awsCredentialsProvider == null) {
client = new AmazonSimpleDBClient();
} else {
client = new AmazonSimpleDBClient(awsCredentialsProvider);
}
ClientConfiguration cc = awsClientConfig;

if (cc == null) {
cc = new ClientConfiguration();
cc.setMaxErrorRetry(SIMPLE_DB_MAX_RETRY);
}

if (awsCredentialsProvider == null) {
client = new AmazonSimpleDBClient(cc);
} else {
if (awsCredentialsProvider == null) {
client = new AmazonSimpleDBClient(awsClientConfig);
} else {
client = new AmazonSimpleDBClient(awsCredentialsProvider, awsClientConfig);
}
client = new AmazonSimpleDBClient(awsCredentialsProvider, cc);
}

// us-east-1 has special naming
// http://docs.amazonwebservices.com/general/latest/gr/rande.html#sdb_region
if (region == null || region.equals("us-east-1")) {
Expand All @@ -328,7 +333,7 @@ public AmazonSimpleDB sdbClient() {
}
return client;
}

/**
* Describe auto scaling groups.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ public void cleanupResources() {
markedResource.setState(Resource.CleanupState.JANITOR_TERMINATED);
resourceTracker.addOrUpdate(markedResource);
} catch (Exception e) {
LOGGER.error(String.format("Failed to clean up the resource %s.",
markedResource.getId()), e);
LOGGER.error(String.format("Failed to clean up the resource %s of type %s.",
markedResource.getId(), markedResource.getResourceType().name()), e);
failedToCleanResources.add(markedResource);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ public ImmediateCleanupRule(DateTime now) {
@Override
public boolean isValid(Resource resource) {
resource.setExpectedTerminationTime(new Date(now.minusMinutes(10).getMillis()));
resource.setNotificationTime(new Date(now.getMillis()));
resource.setNotificationTime(new Date(now.getMillis()-5000));
return false;
}
}
Expand Down