Sha256: 5c0a7a2bfd024c8c26cdfaa9944d77367eb1ca9e59f6944fd0f5984374d9edb8
Contents?: true
Size: 1.59 KB
Versions: 67
Compression:
Stored size: 1.59 KB
Contents
class RenameSudoPasswordToEffectiveUserPassword < ActiveRecord::Migration[6.0] def up rename_column :job_invocations, :sudo_password, :effective_user_password Parameter.where(name: 'remote_execution_sudo_password').each do |parameter| record = Parameter.find_by(type: parameter.type, reference_id: parameter.reference_id, name: "remote_execution_effective_user_password") if record.nil? parameter.update(name: "remote_execution_effective_user_password") end end return unless (password = Setting.find_by(:name => 'remote_execution_sudo_password').try(:value)) Setting.find_by(:name => 'remote_execution_effective_user_password').update(value: password) Setting.find_by(:name => 'remote_execution_sudo_password').delete end def down rename_column :job_invocations, :effective_user_password, :sudo_password Parameter.where(name: 'remote_execution_effective_user_password').each do |parameter| record = Parameter.find_by(type: parameter.type, reference_id: parameter.reference_id, name: "remote_execution_sudo_password") if record.nil? parameter.update(name: "remote_execution_sudo_password") end end return unless (password = Setting.find_by(:name => 'remote_execution_effective_user_password').try(:value)) Setting.create!(name: 'remote_execution_sudo_password', value: password, description: 'Sudo password', category: 'Setting::RemoteExecution', settings_type: 'string', full_name: 'Sudo password',encrypted: true, default: nil) Setting.find_by(:name => 'remote_execution_effective_user_password').delete end end
Version data entries
67 entries across 67 versions & 1 rubygems