Skip to content

Instantly share code, notes, and snippets.

@ConfiguresHttpCommandExecutorService
@ConfiguresExecutorService
public static class MockModule extends AbstractModule {
private final TransformingHttpCommandExecutorService mock;
public MockModule() {
this(createMock(TransformingHttpCommandExecutorService.class));
}
(defproject webapp-nodes "0.4.0-SNAPSHOT"
:description "Webapp on tomcat"
:dependencies [[org.cloudhoist/pallet "0.4.0-SNAPSHOT" :exclusions [org.jclouds/jclouds-compute
org.jclouds/jclouds-blobstore
org.jclouds/jclouds-scriptbuilder
org.jclouds/jclouds-aws
org.jclouds/jclouds-bluelock
org.jclouds/jclouds-gogrid
org.jclouds/jclouds-rackspace
org.jclouds/jclouds-rimuhosting
INFO 2011-02-08 14:01:58,191 clj-ssh.ssh - Authentications that can continue: publickey,keyboard-interactive,password
INFO 2011-02-08 14:01:58,192 clj-ssh.ssh - Next authentication method: publickey
INFO 2011-02-08 14:01:58,472 clj-ssh.ssh - Authentication succeeded (publickey).
INFO 2011-02-08 14:02:03,232 clj-ssh.ssh - Disconnecting from 50.16.135.196 port 22
INFO 2011-02-08 14:02:03,239 clj-ssh.ssh - Caught an exception, leaving main loop due to Socket closed
'../mini-webapp/mini-webapp-1.0.0-SNAPSHOT.war' does not exist, is a directory, or is unreadable; cannot register it for transfer.
Exception in thread "main" java.lang.IllegalArgumentException: No matching field found: .printStackTrace for class java.lang.IllegalArgumentException (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5440)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5415)
@jclouds
jclouds / virtualbox-clojure
Created March 10, 2012 23:26
booting up a virtualbox vm in jclouds 1.5.0-SNAPSHOT w/zero config
;; Prereqs:
;; - 1.5.0-SNAPSHOT deps for org.jclouds.labs/virtualbox, org.jclouds.driver/jclouds-sshj, org.jclouds.driver/jclouds-slf4j
;; - downloaded & installed vbox 4.1.8; started vboxwebsrv
;; - you have an rsa ssh key that works on localhost, and sudo doesn't require a password
;;
;; all else is 0conf (ex. image built on demand from public iso, downloaded on demand)
;;
;; thx to andreaturli mattiasholmqvist dralves asavu + jedi4ever for the guidance!
;;
(use 'org.jclouds.compute2)
Adrian-Coles-iMac:jclouds-plugin adriancole$ git diff
diff --git a/src/main/java/jenkins/plugins/jclouds/blobstore/BlobStoreProfile.java b/src/main/java/jenkins/plugins/jclouds/blobstore/BlobStoreProfile.java
index 80f60a3..0d66111 100644
--- a/src/main/java/jenkins/plugins/jclouds/blobstore/BlobStoreProfile.java
+++ b/src/main/java/jenkins/plugins/jclouds/blobstore/BlobStoreProfile.java
@@ -88,7 +88,7 @@ public class BlobStoreProfile {
.credentials(identity, credential)
.overrides(overrides)
.modules(MODULES)
- .build(BlobStoreContext.class);
@jclouds
jclouds / gist:2500282
Created April 26, 2012 15:13
template test
@Test
public void testTemplateBuilder() {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "11.10");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getImage().getName(), "Ubuntu Oneiric 11.10 Server 64-bit 20111212");
assertEquals(defaultTemplate.getImage().getDefaultCredentials().getUser(), "ubuntu");
assertEquals(defaultTemplate.getLocation().getId(), "az-2.region-a.geo-1");
assertEquals(defaultTemplate.getImage().getLocation().getId(), "az-2.region-a.geo-1");
@jclouds
jclouds / gist:2699578
Created May 15, 2012 06:29
example CacheLoader that works around eventual consistency delay between bucket creation and bucket ACL access
CacheLoader<String, AccessControlList> loader = RetryingCacheLoaderDecorator.newDecorator()
.on(ResourceNotFoundException.class).exponentiallyBackoff()
.decorate(
new CacheLoader<String, AccessControlList>() {
@Override
public AccessControlList load(String bucketName) {
return client.getBucketACL(bucketName);
}
@Override
@jclouds
jclouds / gist:3202856
Created July 30, 2012 00:22
hostname approach
Here's an approach to ensure at least 2 things are sensible on the host: ${hostname} and ${fqdn}
if ${hostname} is not specified via api, it could be set to the same as the node's name
in private clouds, ${fqdn} may need to come from a property or a conversion fn (ex. = ${hostname}.mydomain.com)
in public clouds, ${fqdn} can be set via api data (ec2.publicDnsName), dns resolution, or x-x-x-x.static.cloud-ips.com
on (centos|fedora|rhel|amzn_linux)-based operating systems
/etc/sysconfig/network: replace line HOSTNAME=${fqdn}
/proc/sys/kernel/hostname: replace w/${fqdn}
@jclouds
jclouds / gist:3389111
Created August 18, 2012 19:04
create a windows VM in jclouds 1.5.0-beta.10
;; deps: 1.5.0-beta.10 org.jclouds/provider/aws-ec2 org.jclouds/driver/jclouds-bouncycastle
(use 'org.jclouds.compute2)
(def compute (compute-service "aws-ec2" "ACCESS" "SECRET" :bouncycastle ))
;; image has winrm installed
(def windows (create-node compute "windows" (build-template compute { :inbound-ports [5986, 3389] :image-id "us-east-1/ami-0cb76d65" :hardware-id "m1.small" } ) ) )
@jclouds
jclouds / gist:3805063
Created September 29, 2012 20:06
expect test for when nova doesn't match an api version in keystone
Here's the critical part of the keystone response:
"serviceCatalog": [{
"endpoints": [{
"adminURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"region": "RegionOne",
"internalURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317",
"id": "bb3ce9ccdc5045909882688b90cc3ff0",
"publicURL": "http://10.10.10.10:8774/v2/82d8d2f865484776a1daf1e2245d3317"
}],