diff options
author | Jacob Vosmaer (GitLab) <jacob@gitlab.com> | 2018-03-19 11:58:59 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-03-19 11:58:59 +0000 |
commit | b8a5e52193b7d02de4802b589e098bbbfa0ec425 (patch) | |
tree | 30833503feb797f8610b21f2475c04e959b0ebac /lib/gitlab_keys.rb | |
parent | 355e70e08b9180456ef57fb79a2c3b5654f85479 (diff) | |
download | gitlab-shell-b8a5e52193b7d02de4802b589e098bbbfa0ec425.tar.gz |
Switch to structured logging
Diffstat (limited to 'lib/gitlab_keys.rb')
-rw-r--r-- | lib/gitlab_keys.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab_keys.rb b/lib/gitlab_keys.rb index 9c38fc5..30444c3 100644 --- a/lib/gitlab_keys.rb +++ b/lib/gitlab_keys.rb @@ -53,7 +53,7 @@ class GitlabKeys # rubocop:disable Metrics/ClassLength when 'check-permissions' check_permissions else - $logger.warn "Attempt to execute invalid gitlab-keys command #{@command.inspect}." + $logger.warn('Attempt to execute invalid gitlab-keys command', command: @command.inspect) puts 'not allowed' false end @@ -64,7 +64,7 @@ class GitlabKeys # rubocop:disable Metrics/ClassLength def add_key lock do - $logger.info "Adding key #{@key_id} => #{@key.inspect}" + $logger.info('Adding key', key_id: @key_id, public_key: @key) auth_line = self.class.key_line(@key_id, @key) open_auth_file('a') { |file| file.puts(auth_line) } end @@ -102,7 +102,7 @@ class GitlabKeys # rubocop:disable Metrics/ClassLength tokens = input.strip.split("\t") abort("#{$0}: invalid input #{input.inspect}") unless tokens.count == 2 key_id, public_key = tokens - $logger.info "Adding key #{key_id} => #{public_key.inspect}" + $logger.info('Adding key', key_id: key_id, public_key: public_key) file.puts(self.class.key_line(key_id, public_key)) end end @@ -116,7 +116,7 @@ class GitlabKeys # rubocop:disable Metrics/ClassLength def rm_key lock do - $logger.info "Removing key #{@key_id}" + $logger.info('Removing key', key_id: @key_id) open_auth_file('r+') do |f| while line = f.gets # rubocop:disable Style/AssignmentInCondition next unless line.start_with?("command=\"#{self.class.command(@key_id)}\"") |