satellites logs
This commit is contained in:
parent
7121a58eb9
commit
c84675ee06
13
lib/gitlab/satellite/logger.rb
Normal file
13
lib/gitlab/satellite/logger.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
module Gitlab
|
||||||
|
module Satellite
|
||||||
|
class Logger < Gitlab::Logger
|
||||||
|
def self.file_name
|
||||||
|
'satellites.log'
|
||||||
|
end
|
||||||
|
|
||||||
|
def format_message(severity, timestamp, progname, msg)
|
||||||
|
"#{timestamp.to_s(:long)}: #{msg}\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -13,6 +13,10 @@ module Gitlab
|
||||||
@project = project
|
@project = project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def log message
|
||||||
|
Gitlab::Satellite::Logger.error(message)
|
||||||
|
end
|
||||||
|
|
||||||
def raise_no_satellite
|
def raise_no_satellite
|
||||||
raise SatelliteNotExistError.new("Satellite doesn't exist")
|
raise SatelliteNotExistError.new("Satellite doesn't exist")
|
||||||
end
|
end
|
||||||
|
@ -29,10 +33,13 @@ module Gitlab
|
||||||
output, status = popen("git clone #{project.url_to_repo} #{path}",
|
output, status = popen("git clone #{project.url_to_repo} #{path}",
|
||||||
Gitlab.config.satellites.path)
|
Gitlab.config.satellites.path)
|
||||||
|
|
||||||
|
log("PID: #{project.id}: git clone #{project.url_to_repo} #{path}")
|
||||||
|
log("PID: #{project.id}: -> #{output}")
|
||||||
|
|
||||||
if status.zero?
|
if status.zero?
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
Gitlab::GitLogger.error("Failed to create satellite for #{project.name_with_namespace}")
|
log("Failed to create satellite for #{project.name_with_namespace}")
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue