#794: small refactoring
This commit is contained in:
parent
097ffacf61
commit
c6f13c60b7
|
@ -154,7 +154,7 @@ class Ability
|
|||
cannot([:get_list, :create], MassBuild) {|mass_build| mass_build.platform.personal?}
|
||||
cannot(:cancel, MassBuild) {|mass_build| mass_build.platform.personal? || mass_build.stop_build}
|
||||
|
||||
if @user.uname == 'iso_worker_1'
|
||||
if @user.system?
|
||||
can :key_pair, Repository
|
||||
else
|
||||
cannot :key_pair, Repository
|
||||
|
|
|
@ -14,16 +14,12 @@ class KeyPair < ActiveRecord::Base
|
|||
validates :repository_id, :uniqueness => {:message => I18n.t("activerecord.errors.key_pair.repo_key_exists")}
|
||||
validate :check_keys
|
||||
|
||||
before_create :set_key_id
|
||||
before_create { |record| record.key_id = @fingerprint }
|
||||
after_create :resign_rpms,
|
||||
:unless => Proc.new { |key_pair| key_pair.repository.platform.personal? }
|
||||
|
||||
protected
|
||||
|
||||
def set_key_id
|
||||
self.key_id = @fingerprint
|
||||
end
|
||||
|
||||
def resign_rpms
|
||||
platform = repository.platform
|
||||
type = platform.distrib_type
|
||||
|
|
|
@ -52,8 +52,7 @@ APP_CONFIG['git_path'] = "#{Rails.root}/tmp/test_root"
|
|||
|
||||
def init_test_root
|
||||
clear_test_root
|
||||
%x(mkdir -p #{APP_CONFIG['root_path']}/platforms)
|
||||
%x(mkdir -p #{APP_CONFIG['root_path']}/tmp)
|
||||
%x(mkdir -p #{APP_CONFIG['root_path']}/{platforms,tmp})
|
||||
end
|
||||
|
||||
def clear_test_root
|
||||
|
|
Loading…
Reference in New Issue