27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/beaker/hypervisor/vmpooler.rb', line 27
def load_credentials(dot_fog = '.fog')
creds = {}
if fog = read_fog_file(dot_fog)
if fog[:default] && fog[:default][:vmpooler_token]
creds[:vmpooler_token] = fog[:default][:vmpooler_token]
else
@logger.warn "Credentials file (#{dot_fog}) is missing a :default section with a :vmpooler_token value; proceeding without authentication"
end
else
@logger.warn "Credentials file (#{dot_fog}) is empty; proceeding without authentication"
end
creds
rescue TypeError, Psych::SyntaxError => e
@logger.warn "#{e.class}: Credentials file (#{dot_fog}) has invalid syntax; proceeding without authentication"
creds
rescue Errno::ENOENT
@logger.warn "Credentials file (#{dot_fog}) not found; proceeding without authentication"
creds
end
|