Commit b6c537b3 authored by Roque's avatar Roque

bug fix: credentials were requested more than one time

parent c31993df
...@@ -132,6 +132,10 @@ class DatasetUtils ...@@ -132,6 +132,10 @@ class DatasetUtils
end end
def getCredentials(tool_dir) def getCredentials(tool_dir)
# using logger because it's a singleton
# TODO: refactor datase_utils to be a singleton and keep credentials in it
user, password = @logger.getCredentials()
if user.nil?
credential_path = appendSlashTo(tool_dir) + CREDENTIALS_FILE credential_path = appendSlashTo(tool_dir) + CREDENTIALS_FILE
if File.exist?(credential_path) if File.exist?(credential_path)
credentials = File.open(credential_path).read.chomp.split(RECORD_SEPARATOR) credentials = File.open(credential_path).read.chomp.split(RECORD_SEPARATOR)
...@@ -162,6 +166,8 @@ class DatasetUtils ...@@ -162,6 +166,8 @@ class DatasetUtils
puts puts
sleep 1 sleep 1
end end
@logger.setCredentials(user, password)
end
return user, password return user, password
end end
......
...@@ -11,6 +11,8 @@ class LogManager ...@@ -11,6 +11,8 @@ class LogManager
def initialize() def initialize()
now = Time.now.strftime("%d-%m-%Y") now = Time.now.strftime("%d-%m-%Y")
@filename = "#{now.to_s}.log" @filename = "#{now.to_s}.log"
@user
@password
end end
def setFilename(tool_dir, prefix) def setFilename(tool_dir, prefix)
...@@ -22,6 +24,15 @@ class LogManager ...@@ -22,6 +24,15 @@ class LogManager
File.open(@path, 'a') { |file| file.puts "------------------------------------------------" + "\r\n" } File.open(@path, 'a') { |file| file.puts "------------------------------------------------" + "\r\n" }
end end
def setCredentials(user, password)
@user = user
@password = password
end
def getCredentials()
return @user, @password
end
def getLogPath() def getLogPath()
return @path return @path
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment