Recursively chown directories when changing uid and gid of users when changing after initial reconfigure
Summary
When setting uid
and gid
of users in gitlab.rb
after the initial reconfigure, we should recursively chown
directories. /var/log
and /opt/gitlab
should be handled by a reconfigure.
Currently, sudo gitlab-ctl reconfigure
fails with the below error.
execute[/opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions] (gitlab::gitlab-shell line 97) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
STDOUT:
STDERR: /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_logger.rb:30:in `initialize': Permission denied @ rb_sysopen - /var/log/gitlab/gitlab-shell/gitlab-shell.log (Errno::EACCES)
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_logger.rb:30:in `open'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_logger.rb:30:in `initialize'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_logger.rb:119:in `new'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_logger.rb:119:in `<top (required)>'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_keys.rb:4:in `require_relative'
from /opt/gitlab/embedded/service/gitlab-shell/lib/gitlab_keys.rb:4:in `<top (required)>'
from /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys:24:in `require'
from /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys:24:in `<main>'
---- End output of /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions ----
Ran /opt/gitlab/embedded/service/gitlab-shell/bin/gitlab-keys check-permissions returned 1
Proposal
Recursively chown
directories when uid
ad gid
are set in gitlab.rb
.
Step to reproduce
sudo gitlab-ctl stop
service gitlab-runsvdir stop
- Update
uid
s andgid
s ingitlab.rb
. sudo gitlab-ctl reconfigure
Edited by Aric Buerer