Skip to content

Instantly share code, notes, and snippets.

NameError in FriendsController#create
uninitialized constant Paperclip::Storage::Fog::Excon
Rails.root: /Users/kyle.rames/Projects/paperclip_demo
Application Trace | Framework Trace | Full Trace
paperclip (3.5.0) lib/paperclip/storage/fog.rb:106:in `rescue in block in flush_writes'
paperclip (3.5.0) lib/paperclip/storage/fog.rb:113:in `block in flush_writes'
paperclip (3.5.0) lib/paperclip/storage/fog.rb:96:in `each'
paperclip (3.5.0) lib/paperclip/storage/fog.rb:96:in `flush_writes'
@krames
krames / monitoring_dev.md
Last active December 21, 2015 23:09
This is a quick crash course on fog development.

#Cloud Monitoring Pairing

Using curl with Rackspace Cloud

Authenticate

To authenticate with the Rackspace Cloud, execute the following curl command substituting USERNAME and API_KEY with the appropriate values:

curl -s https://identity.api.rackspacecloud.com/v2.0/tokens -X 'POST' \

1.9.3@fog_dev:fog [queues*]$ bundle exec shindo tests/rackspace/models/queues
[WARNING] Unsupported StormOnDemand service: network
[WARNING] Unsupported StormOnDemand service: storage
[WARNING] Unsupported StormOnDemand service: dns
[WARNING] Unsupported StormOnDemand service: billing
[WARNING] Unsupported StormOnDemand service: monitoring
[WARNING] Unsupported StormOnDemand service: support
[WARNING] Unsupported StormOnDemand service: account
[WARNING] Unsupported StormOnDemand service: vpn
Skipping tests for aws due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them)
require 'tweetstream'
require 'awesome_print'
TweetStream.configure do |config|
config.consumer_key = CONSUMER_KEY
config.consumer_secret = CONSUMER_SECRET
config.oauth_token = OAUTH_TOKEN
config.oauth_token_secret = OAUTH_TOKEN_SECRET
config.auth_method = :oauth
end
@krames
krames / volume_patch.rb
Created September 9, 2013 21:16
This patch addresses an issue where the `snapshot_id` is not being passed onto the Rackspace Cloud from the Fog Block Storage Service. Note that this patch will only work with Fog 1.15.0. To install it, save the patch in the same directory as your script and name it `volume_patch`. You will also need to include this line at the top of your scrip…
if Fog::VERSION == "1.15.0"
require 'rubygems'
require 'fog'
require 'fog/rackspace/models/block_storage/volume'
Fog::Logger.warning "PATCHING Fog::Rackspace::BlockStorage::Volume to honor snapshot_id attribute"
module Fog
module Rackspace
@krames
krames / model_errors.txt
Created September 10, 2013 20:22
auto scale test errors
1.9.3@fog_dev:fog [pr_2120]$ bundle exec shindo tests/rackspace/models/auto_scale/*
[WARNING] Unsupported StormOnDemand service: network
[WARNING] Unsupported StormOnDemand service: storage
[WARNING] Unsupported StormOnDemand service: dns
[WARNING] Unsupported StormOnDemand service: billing
[WARNING] Unsupported StormOnDemand service: monitoring
[WARNING] Unsupported StormOnDemand service: support
[WARNING] Unsupported StormOnDemand service: account
[WARNING] Unsupported StormOnDemand service: vpn
Skipping tests for aws due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them)
@krames
krames / sydney_storage.rb
Created September 11, 2013 14:29
This returns a storage service that works with Rackspace's Sydney data center.
service = Fog::Storage.new({
:provider => 'Rackspace', # Rackspace Fog provider
:rackspace_username => RACKSPACE_USER_NAME, # Your Rackspace Username
:rackspace_api_key => RACKSPACE_API, # Your Rackspace API key
:rackspace_region => :syd
})
@krames
krames / container-example.rb
Last active December 23, 2015 05:19
This is code entire code sample presented in the Ruby SDK training on 9/19/2013
# require the Fog library
require 'fog'
# Create a service object to access Cloud Files
service = Fog::Storage.new :provider => 'rackspace',
:rackspace_username => USER, # replace USER with your username
:rackspace_api_key => API_KEY, # replace API_KEY with your key
:rackspace_region => :ord # We are using the Chicago data center, by default Fog will use the Dallas data center
# Create a container - Note that Fog refers to containers as directories
@krames
krames / checkout_pr.sh
Last active December 25, 2015 12:19
This function will fetch and checkout a pull request allowing for easier PR reviews. To install this include it in your .bash_profile. To checkout pull request 123 from your repo you would execute the following: fpr 123
function fpr {
git branch -D pr_$1 2> /dev/null
git fetch upstream pull/$1/head:pr_$1
git checkout pr_$1
}
@krames
krames / pr_2226
Created October 14, 2013 13:57
Output of FOG_MOCK=true bundle exec shindo tests/hp/requests/storage/object_tests.rb
Fog::Storage[:hp] | object requests (hp, storage)
success
#put_object('fogobjecttests', 'fog_object') + succeeds
#get_object('fogobjecttests', 'fog_object') + succeeds
#get_object('fogobjecttests', 'fog_object', &block) + returns "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
#head_object('fogobjecttests', 'fog_object') + succeeds
#get_object_temp_url('fogobjecttests', 'fog_object', 60, 'GET') + succeeds
#put_object('fogobjecttests', 'fog_other_object', nil, {'X-Copy-From' => '/fogobjecttests/fog_object'}) + succeeds
#put_object('fogobjecttests2', 'fog_another_object'