Method: HP::Cloud::Accounts#write

Defined in:
lib/hpcloud/accounts.rb

#write(account) ⇒ Object



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/hpcloud/accounts.rb', line 236

def write()
  config = @accts[]
  if config.nil?
    raise Exception.new("Cannot find account information for #{account}")
  end
  file_name = get_file_name()
  begin
    FileUtils.mkpath(@directory)
    File.open(file_name, 'w') do |file|
      file.write config.to_yaml
    end
  rescue Exception => e
    raise Exception.new("Error writing file #{file_name}")
  end
end