Sha256: 58930bee84af97cb0b19f62b7b412929668c45f64554a223a075f4485af460c3
Contents?: true
Size: 578 Bytes
Versions: 12
Compression:
Stored size: 578 Bytes
Contents
class Publickey < ApplicationRecord belongs_to :user after_commit :do_refresh, on: [:create] # Updates /home/git/.ssh/authorized_keys # called when something added/?/etc to publickeys table def do_refresh Rails.logger.debug "DB8 publickey.rb:def self.refresh called" if Publickey.all.size > 0 File.write('/tmp/authorized_keys', Publickey.pluck(:data).join("\n") ) Cmd.run(%Q[sudo -u #{self.user.apiusername} cp /tmp/authorized_keys /home/#{self.user.apiusername}/.ssh/authorized_keys]) File.delete('/tmp/authorized_keys') end end end
Version data entries
12 entries across 12 versions & 1 rubygems