- configarvados = File.join(userdotconfig, "arvados")
- Dir.mkdir(configarvados) if !File.exist?(configarvados)
-
- tokenfile = File.join(configarvados, "settings.conf")
-
- begin
- STDERR.puts "Processing #{tokenfile} ..." if debug
- newToken = false
- if File.exist?(tokenfile)
- # check if the token is still valid
- myToken = ENV["ARVADOS_API_TOKEN"]
- userEnv = IO::read(tokenfile)
- if (m = /^ARVADOS_API_TOKEN=(.*?\n)/m.match(userEnv))
- begin
- tmp_arv = Arvados.new({ :api_host => logincluster_host,
- :api_token => (m[1]),
- :suppress_ssl_warnings => false })
- tmp_arv.user.current
- rescue Arvados::TransactionFailedError => e
- if e.to_s =~ /401 Unauthorized/
- STDERR.puts "Account #{l[:username]} token not valid, creating new token."
- newToken = true
- else
- raise
+ begin
+ STDERR.puts "Processing #{tokenfile} ..." if debug
+ newToken = false
+ if File.exist?(tokenfile)
+ # check if the token is still valid
+ myToken = ENV["ARVADOS_API_TOKEN"]
+ userEnv = File.read(tokenfile)
+ if (m = /^ARVADOS_API_TOKEN=(.*?\n)/m.match(userEnv))
+ begin
+ tmp_arv = Arvados.new({ :api_host => logincluster_host,
+ :api_token => (m[1]),
+ :suppress_ssl_warnings => false })
+ tmp_arv.user.current
+ rescue Arvados::TransactionFailedError => e
+ if e.to_s =~ /401 Unauthorized/
+ STDERR.puts "Account #{l[:username]} token not valid, creating new token."
+ newToken = true
+ else
+ raise
+ end