Skip to content

Instantly share code, notes, and snippets.

@jprovaznik
jprovaznik / gist:4194136
Created December 3, 2012 10:39
template os
diff --git a/app/models/tim/template.rb b/app/models/tim/template.rb
index 1aed281..49d1d7b 100644
--- a/app/models/tim/template.rb
+++ b/app/models/tim/template.rb
@@ -10,10 +10,25 @@ module Tim
attr_accessible :xml
attr_protected :id
+ OS = Struct.new(:name, :version, :arch)
+
diff --git a/spec/models/template_spec.rb b/spec/models/template_spec.rb
index 6897a9f..38d2461 100644
--- a/spec/models/template_spec.rb
+++ b/spec/models/template_spec.rb
@@ -12,5 +12,14 @@ module Tim
Template.find(template).base_images.size.should == 2
end
end
+
+ describe "XML helper methods" do
[jprovazn@f17 src]$ curl https://github.com/aeolusproject/conductor/pull/200.patch | git am
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 63913 100 63913 0 0 33018 0 0:00:01 0:00:01 --:--:-- 35311
Applying: costs for conductor
/home/jprovazn/devel/conductor/.git/rebase-apply/patch:248: trailing whitespace.
validates_numericality_of :price,
/home/jprovazn/devel/conductor/.git/rebase-apply/patch:771: trailing whitespace.
t.string :billing_model, :limit=>30
/home/jprovazn/devel/conductor/.git/rebase-apply/patch:917: trailing whitespace.
rescue Exception => ex
flash[:error] = t('hardware_profiles.flash.error.failed_to_update_cost %message', :message => ex.message)
set_edit_cost_variables
render :action => 'edit_cost_billing'
tady to jeste zalogujes s backtracem
end
[jprovazn@f17 src]$ curl -X GET --user admin:password --header "Accept: application/xml" --header "Content-Type: application/xml" -k http://localhost:3000/api
<api href='http://localhost:3000/api'>
<catalogs href='http://localhost:3000/api/catalogs'></catalogs>
<deployments href='http://localhost:3000/api/deployments'></deployments>
<pools href='http://localhost:3000/api/pools'></pools>
<pool_families href='http://localhost:3000/api/pool_families'></pool_families>
<providers href='http://localhost:3000/api/providers'></providers>
<provider_accounts href='http://localhost:3000/api/provider_accounts'></provider_accounts>
<provider_realms href='http://localhost:3000/api/provider_realms'></provider_realms>
<tim href='http://localhost:3000/api/tim'></tim>
@jprovaznik
jprovaznik / gist:4483239
Created January 8, 2013 12:00
dc-core openstack 500
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: Unable to connect to 10.16.17.7
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/gems/gems/openstack-1.0.6/lib/openstack/connection.rb:216:in `rescue in start_http'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/gems/gems/openstack-1.0.6/lib/openstack/connection.rb:208:in `start_http'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/gems/gems/openstack-1.0.6/lib/openstack/connection.rb:142:in `csreq'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/gems/gems/openstack-1.0.6/lib/openstack/compute/connection.rb:210:in `limits'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/deltacloud-core/lib/deltacloud/drivers/openstack/openstack_driver.rb:124:in `block in realms'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: /usr/share/deltacloud-core/lib/deltacloud/drivers/exceptions.rb:212:in `call'
Jan 8 05:28:19 hp-dl320egen8-01 deltacloudd[32427]: 127.0.0.1 - - [08/Jan/2013 05:28:19]
@jprovaznik
jprovaznik / gist:4483286
Created January 8, 2013 12:11
auth fix
diff --git a/src/app/models/provider.rb b/src/app/models/provider.rb
index eb99c8d..ad1c418 100644
--- a/src/app/models/provider.rb
+++ b/src/app/models/provider.rb
@@ -304,10 +304,14 @@ class Provider < ActiveRecord::Base
def valid_framework?
begin
!! connect!
+ rescue DeltaCloud::HTTPError::Unauthorized
+ # Some providers will return a 401 - Unauthorized, which is okay at this
@jprovaznik
jprovaznik / gist:5793088
Last active December 18, 2015 13:49
horizon-api
class Flavor(APIResourceWrapper):
_attrs = ['id', 'name', 'memory', 'vcpu', 'disk', 'ephemeral', 'swap']
@classmethod
def create(cls, request, name, memory, vcpu, disk, ephemeral=0, swap=0,
metadata=None):
flavor = cls(novaclient(request).flavors.create(name, memory, vcpu,
disk, ephemeral=ephemeral,
swap=swap))
if (metadata):
Description: 'Nova API,Keystone,Heat Engine and API,Glance,Neutron,Dedicated MySQL
server,Dedicated RabbitMQ Server,Group of Nova Computes,Swift-common: Openstack
object storage common configurations'
HeatTemplateFormatVersion: '2012-12-12'
Outputs:
KeystoneURL:
Description: URL for the Overcloud Keystone service
Value:
Fn::Join:
- ''
Description: 'Nova API,Keystone,Heat Engine and API,Glance,Neutron,Dedicated MySQL
server,Dedicated RabbitMQ Server,Group of Nova Computes,Swift-common: Openstack
object storage common configurations'
HeatTemplateFormatVersion: '2012-12-12'
Outputs:
KeystoneURL:
Description: URL for the Overcloud Keystone service
Value:
Fn::Join:
- ''