Skip to content

Instantly share code, notes, and snippets.

View ffeldhaus's full-sized avatar

Florian Feldhaus ffeldhaus

View GitHub Profile
@ffeldhaus
ffeldhaus / gist:2225345
Created March 28, 2012 10:44
Logging with ActiveSupport
require 'sinatra'
require 'active_support'
require 'logger'
class SinatraTest < Sinatra::Application
class TestClass
def initialize
ActiveSupport::Notifications.instrument("log", :level => Logger::INFO, :message => "my message" )
end
@ffeldhaus
ffeldhaus / gist:3407267
Created August 20, 2012 19:57
bundle install with puppet-rvm
exec { 'bundle install':
command => '/usr/local/rvm/bin/rvm 1.9.3@rocci-server do bundle install',
cwd => '/home/occi/rocci-server',
logoutput => true,
}
diff --git a/lib/occi/api/client.rb b/lib/occi/api/client.rb
index 13875ff..59ca9af 100644
--- a/lib/occi/api/client.rb
+++ b/lib/occi/api/client.rb
@@ -7,6 +7,7 @@ module OCCI
# HTTParty for raw HTTP requests
include HTTParty
+ debug_output $stderr
headers 'Accept' => 'application/occi+json,text/plain;q=0.5'
@ffeldhaus
ffeldhaus / README
Created September 13, 2012 22:00
OCCI Test Scenarios
The Cloud Standards Interoperability Plugfest Series (or "Cloud Plugfests"
for short) was originated by the OGF and SNIA in 2011 as a method to exchange
information and to encourage interoperability on implementations of cloud
standards. It has since expanded to include a variety of tools provided by
these organizations and by ETSI to support the community, and is open to
participation by other organizations.
This tool set hosted on the ogf.org site supports those community activities
and features that are in public view according to the terms of the Open Grid
Forum IPR. The community is welcome to make use of the tools and features
@ffeldhaus
ffeldhaus / gist:3748656
Created September 19, 2012 09:21
Error in OpenStack OCCI when rendering discovery interface in text/occi
Florians-MacBook-Pro-3:rOCCI ffeldhaus$ curl -v --cert /Users/ffeldhaus/.cert/florianfeldhaus.pem --capath /Users/ffeldhaus/.cert/grid-security/ -X GET -H 'Accept: text/occi' https://occi.cloud.gwdg.de:5000/-/
* About to connect() to occi.cloud.gwdg.de port 5000 (#0)
* Trying 141.5.96.16...
* connected
* Connected to occi.cloud.gwdg.de (141.5.96.16) port 5000 (#0)
Enter PEM pass phrase:
* successfully set certificate verify locations:
* CAfile: /opt/local/share/curl/curl-ca-bundle.crt
CApath: /Users/ffeldhaus/.cert/grid-security/
* SSLv3, TLS handshake, Client hello (1):
@ffeldhaus
ffeldhaus / gist:3821245
Created October 2, 2012 17:10
rOCCI 3.0 alpha example
1.9.3p194 :001 > require 'occi'
=> true
1.9.3p194 :002 > compute=Occi::Core::Entity.new 'http://schemas.ogf.org/occi/infrastructure#compute'
http://schemas.ogf.org/occi/infrastructure
=> {
"kind": "http://schemas.ogf.org/occi/infrastructure#compute"
}
1.9.3p194 :003 > compute.cores=5
=> 5
1.9.3p194 :004 > compute
@ffeldhaus
ffeldhaus / gist:3861740
Created October 9, 2012 22:06
rOCCI awesomeness
irb -I lib/
1.9.3p194 :001 > require 'occi'
=> true
1.9.3p194 :002 > network=Occi::Core::Entity.new 'http://schemas.ogf.org/occi/infrastructure#network'
=> {
"kind": "http://schemas.ogf.org/occi/infrastructure#network"
}
1.9.3p194 :003 > network.class
=> Occi::Infrastructure::Network
1.9.3p194 :004 > network.class.superclass
@ffeldhaus
ffeldhaus / gist:4018052
Created November 5, 2012 16:15
rOCCI parse text plain message
1.9.3p286 :001 > body=%Q|Category: storage;scheme="http://schemas.ogf.org/occi/infrastructure#";class="kind"
1.9.3p286 :002"> Category: storage;scheme="http://opennebula.org/occi/infrastructure#";class="mixin"
1.9.3p286 :003"> X-OCCI-Attribute: occi.core.id="e7db6669-d819-5e20-a7ee-90be46591490"
1.9.3p286 :004"> X-OCCI-Attribute: occi.core.title="debian6"
1.9.3p286 :005"> X-OCCI-Attribute: occi.core.summary="Debian6 sample image"
1.9.3p286 :006"> X-OCCI-Attribute: occi.storage.state="online"
1.9.3p286 :007"> X-OCCI-Attribute: org.opennebula.storage.id="31"
1.9.3p286 :008"> X-OCCI-Attribute: org.opennebula.storage.type="OS"
1.9.3p286 :009"> X-OCCI-Attribute: org.opennebula.storage.dev_prefix="xvd"
1.9.3p286 :010"> X-OCCI-Attribute: org.opennebula.storage.bus="ide"
@ffeldhaus
ffeldhaus / gist:4197449
Created December 3, 2012 19:47
Script for measuring the duration of nova get-vnc-console
#!/bin/bash
# first parameter is the ID of a nova instance
# second parameter may be the amount of runs
count=${2:-100}
timefile=/tmp/vnctime.out
fmt="%e"
# mv out file to old
@ffeldhaus
ffeldhaus / gist:5013193
Created February 22, 2013 12:50
rOCCI adding a user defined mixin
scheme = 'http://myscheme#'
term = 'myterm'
title = 'mytitle'
attributes = Occi::Core::AttributeProperties.new
related = []
my_mixin = Occi::Core::Mixin.new scheme, term, title, attributes, related
# POST /-/
# Body: Rendering of the mixin