Sha256: 494a73fe153d6706edbda1dd7dbc52f410f7f2f33470a2ed1d2cc9b5250b1fe2
Contents?: true
Size: 1.05 KB
Versions: 15
Compression:
Stored size: 1.05 KB
Contents
module ChefMetal # Reads in a credentials file class OpenstackCredentials def initialize @credentials = {} end def default @credentials['default'] || @credentials.first[1] end def keys @credentials.keys end def [](name) @credentials[name] end def load_yaml(credentials_yaml_file) creds_file = YAML.load_file(File.expand_path(credentials_yaml_file)) creds_file.each do |section, creds| @credentials[section] = { :openstack_username => creds_file[section]['openstack_username'], :openstack_api_key => creds_file[section]['openstack_api_key'], :openstack_tenant => creds_file[section]['openstack_tenant'], :openstack_auth_url => creds_file[section]['openstack_auth_url'] } end end def load_default load_yaml('~/.fog') end def self.method_missing(name, *args, &block) singleton.send(name, *args, &block) end def self.singleton @openstack_credentials ||= OpenstackCredentials.new end end end
Version data entries
15 entries across 15 versions & 1 rubygems