www-apps/gitlab-ce:
Added ebuild for Gitlab CE 9.0.0 RC4 Package-Manager: Portage-2.3.3, Repoman-2.3.1
This commit is contained in:
parent
9b12f1e91a
commit
96b178ab65
5 changed files with 139 additions and 14 deletions
|
@ -0,0 +1,12 @@
|
|||
diff --git a/config/mail_room.yml b/config/mail_room.yml
|
||||
index 88d93d4..688d663 100644
|
||||
--- a/config/mail_room.yml
|
||||
+++ b/config/mail_room.yml
|
||||
@@ -1,6 +1,6 @@
|
||||
:mailboxes:
|
||||
<%
|
||||
- require_relative "../lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom)
|
||||
+ require_relative "/opt/gitlab/lib/gitlab/mail_room" unless defined?(Gitlab::MailRoom)
|
||||
config = Gitlab::MailRoom.config
|
||||
|
||||
if Gitlab::MailRoom.enabled?
|
|
@ -0,0 +1,80 @@
|
|||
diff --git a/Gemfile b/Gemfile
|
||||
index 2f81332..8d1b7d6 100644
|
||||
--- a/Gemfile
|
||||
+++ b/Gemfile
|
||||
@@ -349,7 +349,7 @@ gem 'health_check', '~> 2.6.0'
|
||||
|
||||
# System information
|
||||
gem 'vmstat', '~> 2.3.0'
|
||||
-gem 'sys-filesystem', '~> 1.1.6'
|
||||
+gem 'sys-filesystem', '~> 1.1.6', group: :exclude
|
||||
|
||||
# Gitaly GRPC client
|
||||
gem 'gitaly', '~> 0.2.1'
|
||||
diff --git a/app/controllers/admin/system_info_controller.rb b/app/controllers/admin/system_info_controller.rb
|
||||
index 9903972..41af5a2 100644
|
||||
--- a/app/controllers/admin/system_info_controller.rb
|
||||
+++ b/app/controllers/admin/system_info_controller.rb
|
||||
@@ -1,3 +1,5 @@
|
||||
+require 'open3'
|
||||
+
|
||||
class Admin::SystemInfoController < Admin::ApplicationController
|
||||
EXCLUDED_MOUNT_OPTIONS = [
|
||||
'nobrowse',
|
||||
@@ -29,10 +31,14 @@ class Admin::SystemInfoController < Admin::ApplicationController
|
||||
'vfat'
|
||||
].freeze
|
||||
|
||||
+ MOUNT_REGEX = /(\S+) on (\S+) type (\S+) \(([^)]+)\)/
|
||||
+
|
||||
+ Mount = Struct.new('Mount', :name, :mount_point, :mount_type, :options)
|
||||
+ FsStat = Struct.new('FsStats', :path, :bytes_total, :bytes_used)
|
||||
+
|
||||
def show
|
||||
@cpus = Vmstat.cpu rescue nil
|
||||
@memory = Vmstat.memory rescue nil
|
||||
- mounts = Sys::Filesystem.mounts
|
||||
|
||||
@disks = []
|
||||
mounts.each do |mount|
|
||||
@@ -42,15 +48,38 @@ class Admin::SystemInfoController < Admin::ApplicationController
|
||||
next if (EXCLUDED_MOUNT_TYPES & [mount.mount_type]).any?
|
||||
|
||||
begin
|
||||
- disk = Sys::Filesystem.stat(mount.mount_point)
|
||||
+ disk = fs_stat(mount.mount_point)
|
||||
@disks.push({
|
||||
bytes_total: disk.bytes_total,
|
||||
bytes_used: disk.bytes_used,
|
||||
disk_name: mount.name,
|
||||
mount_path: disk.path
|
||||
})
|
||||
- rescue Sys::Filesystem::Error
|
||||
+ rescue IOError
|
||||
end
|
||||
end
|
||||
end
|
||||
+
|
||||
+ def mounts
|
||||
+ stdout, stderr, status = Open3.capture3('mount')
|
||||
+ fail IOError, stderr unless status.success?
|
||||
+
|
||||
+ stdout.lines
|
||||
+ .map { |line| MOUNT_REGEX.match(line) }
|
||||
+ .compact
|
||||
+ .map { |match| Mount.new(*match.captures) }
|
||||
+ end
|
||||
+
|
||||
+ def fs_stat(mount_point)
|
||||
+ stdout, status = Open3.capture2('stat', '-c', '%s %b %a', '-f', mount_point)
|
||||
+ fail IOError unless status.success?
|
||||
+
|
||||
+ block_size, blocks_total, blocks_free = stdout.split(' ').map(&:to_i)
|
||||
+
|
||||
+ bytes_total = blocks_total * block_size
|
||||
+ bytes_free = blocks_free * block_size
|
||||
+ bytes_used = bytes_total - bytes_free
|
||||
+
|
||||
+ FsStat.new(mount_point, bytes_total, bytes_used)
|
||||
+ end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue