5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/bravo/auth_data.rb', line 5
def fetch
unless File.exists?(Bravo.pkey)
raise "Archivo de llave privada no encontrado en #{Bravo.pkey}"
end
unless File.exists?(Bravo.cert)
raise "Archivo certificado no encontrado en #{Bravo.cert}"
end
todays_datafile = "/tmp/bravo_#{Time.new.strftime('%d_%m_%Y')}.yml"
opts = "-u #{Bravo.auth_url}"
opts += " -k #{Bravo.pkey}"
opts += " -c #{Bravo.cert}"
unless File.exists?(todays_datafile)
%x(#{File.dirname(__FILE__)}/../../wsaa-client.sh #{opts})
end
@data = YAML.load_file(todays_datafile).each do |k, v|
Bravo.const_set(k.to_s.upcase, v) unless Bravo.const_defined?(k.to_s.upcase)
end
end
|