Method: Cloudkick::Command::Base#credentials

Defined in:
lib/cloudkick/commands/base.rb

#credentialsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cloudkick/commands/base.rb', line 27

def credentials
  begin
    key = ''
    File.open('/etc/cloudkick.conf') do |f|
      f.grep(/oauth_key (\w+)/) { key = $1 }
    end

    secret = ''
    File.open('/etc/cloudkick.conf') do |f|
      f.grep(/oauth_secret (\w+)/) { secret = $1 }
    end

    return key, secret
  rescue
    raise CommandFailed, 'Unable to open /etc/cloudkick.conf'
  end
end