1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

remove rake task for credentials hint, move into bin

This commit is contained in:
Wesley Beary 2009-12-21 13:26:40 -08:00
parent 31ef2f5e56
commit 2fddeb0110
2 changed files with 24 additions and 20 deletions

View file

@ -96,23 +96,3 @@ begin
rescue LoadError rescue LoadError
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured." puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
end end
namespace :fog do
desc 'Provide a sample yaml file for credentials'
task :yml do
puts('Copy the following sample to ~/.fog and fill in with your credentials as needed:')
yml = <<YML
:default:
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
:rackspace_username: INTENTIONALLY_LEFT_BLANK
:slicehost_password: INTENTIONALLY_LEFT_BLANK
YML
print(yml)
end
end

24
bin/fog
View file

@ -7,6 +7,18 @@ module AWS
class << self class << self
key = (ARGV.first && :"#{ARGV.first}") || :default key = (ARGV.first && :"#{ARGV.first}") || :default
unless Fog.credentials(key) unless Fog.credentials(key)
print("\n To run as '#{key}', add credentials like the following to ~/.fog\n")
yml = <<-YML
:#{key}:
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
:rackspace_username: INTENTIONALLY_LEFT_BLANK
:slicehost_password: INTENTIONALLY_LEFT_BLANK
YML
print(yml)
raise ArgumentError.new("No credentials for :#{key}") raise ArgumentError.new("No credentials for :#{key}")
end end
if Fog.credentials(key)[:aws_access_key_id] && Fog.credentials(key)[:aws_secret_access_key] if Fog.credentials(key)[:aws_access_key_id] && Fog.credentials(key)[:aws_secret_access_key]
@ -57,6 +69,18 @@ module Rackspace
class << self class << self
key = (ARGV.first && :"#{ARGV.first}") || :default key = (ARGV.first && :"#{ARGV.first}") || :default
unless Fog.credentials(key) unless Fog.credentials(key)
print("\n To run as '#{key}', add credentials like the following to ~/.fog\n")
yml = <<-YML
:#{key}:
:aws_access_key_id: INTENTIONALLY_LEFT_BLANK
:aws_secret_access_key: INTENTIONALLY_LEFT_BLANK
:rackspace_api_key: INTENTIONALLY_LEFT_BLANK
:rackspace_username: INTENTIONALLY_LEFT_BLANK
:slicehost_password: INTENTIONALLY_LEFT_BLANK
YML
print(yml)
raise ArgumentError.new("No credentials for :#{key}") raise ArgumentError.new("No credentials for :#{key}")
end end
if Fog.credentials(key)[:rackspace_api_key] && Fog.credentials(key)[:rackspace_username] if Fog.credentials(key)[:rackspace_api_key] && Fog.credentials(key)[:rackspace_username]