Skip to content
Browse files

Fixed transient context creation and live tests

  • Loading branch information...
1 parent 7ca9278 commit b737f44c3dc545c9cfc5bbd5aede2267774a16e1 @nacx nacx committed Mar 9, 2013
View
5 ...src/main/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImpl.java
@@ -63,8 +63,9 @@ public UpdateAutomaticAttributesOnNodeImpl(ChefApi chef, @Automatic Supplier<Map
public void execute(String nodeName) {
logger.trace("updating node %s", nodeName);
Node node = chef.getNode(nodeName);
- node.getAutomatic().putAll(automaticSupplier.get());
- chef.updateNode(node);
+ Node mutable = new Node(node.getName(), node.getNormal(), node.getOverride(), node.getDefault(),
+ automaticSupplier.get(), node.getRunList(), node.getChefEnvironment());
+ chef.updateNode(mutable);
logger.debug("updated node %s", nodeName);
}
}
View
3 core/src/main/java/org/jclouds/chef/test/TransientChefApiMetadata.java
@@ -20,6 +20,7 @@
import org.jclouds.apis.ApiMetadata;
import org.jclouds.chef.ChefApiMetadata;
+import org.jclouds.chef.config.ChefBootstrapModule;
import org.jclouds.chef.config.ChefParserModule;
import org.jclouds.chef.test.config.TransientChefApiModule;
import org.jclouds.ohai.config.JMXOhaiModule;
@@ -59,7 +60,7 @@ protected Builder() {
.defaultEndpoint("transientchef")
.defaultModules(
ImmutableSet.<Class<? extends Module>> of(TransientChefApiModule.class, ChefParserModule.class,
- JMXOhaiModule.class));
+ ChefBootstrapModule.class, JMXOhaiModule.class));
}
@Override
View
17 core/src/main/java/org/jclouds/chef/test/config/TransientChefApiModule.java
@@ -35,8 +35,8 @@
import org.jclouds.chef.ChefAsyncApi;
import org.jclouds.chef.config.Validator;
import org.jclouds.chef.domain.Client;
-import org.jclouds.chef.functions.ClientForGroup;
import org.jclouds.chef.functions.BootstrapConfigForGroup;
+import org.jclouds.chef.functions.ClientForGroup;
import org.jclouds.chef.functions.RunListForGroup;
import org.jclouds.chef.test.TransientChefApi;
import org.jclouds.chef.test.TransientChefAsyncApi;
@@ -45,10 +45,9 @@
import org.jclouds.domain.JsonBall;
import org.jclouds.rest.ConfiguresRestClient;
import org.jclouds.rest.config.RestModule;
-import org.jclouds.scriptbuilder.domain.Statement;
-import org.jclouds.scriptbuilder.statements.chef.InstallChefGems;
import com.google.common.base.Optional;
+import com.google.common.base.Supplier;
import com.google.common.cache.CacheLoader;
import com.google.common.collect.ImmutableSet;
import com.google.inject.AbstractModule;
@@ -80,7 +79,17 @@ protected void configure() {
.modules(
ImmutableSet.<Module> of(new ExecutorServiceModule(sameThreadExecutor(),
sameThreadExecutor()))).buildInjector().getInstance(LocalAsyncBlobStore.class));
- bind(Statement.class).annotatedWith(Names.named("installChefGems")).to(InstallChefGems.class);
+ }
+
+ @Provides
+ @Singleton
+ public Supplier<PrivateKey> supplyKey() {
+ return new Supplier<PrivateKey>() {
+ @Override
+ public PrivateKey get() {
+ return null;
+ }
+ };
}
@Provides
View
3 core/src/test/java/org/jclouds/chef/internal/BaseStubbedOhaiLiveTest.java
@@ -26,6 +26,7 @@
import org.jclouds.chef.ChefApi;
import org.jclouds.chef.ChefApiMetadata;
import org.jclouds.chef.ChefContext;
+import org.jclouds.chef.config.ChefBootstrapModule;
import org.jclouds.chef.config.ChefParserModule;
import org.jclouds.chef.config.ChefRestClientModule;
import org.jclouds.domain.JsonBall;
@@ -64,7 +65,7 @@ protected ApiMetadata createApiMetadata() {
.toBuilder()
.defaultModules(
ImmutableSet.<Class<? extends Module>> of(ChefRestClientModule.class, ChefParserModule.class,
- TestOhaiModule.class)).build();
+ ChefBootstrapModule.class, TestOhaiModule.class)).build();
}
@Override

0 comments on commit b737f44

Please sign in to comment.
Something went wrong with that request. Please try again.