Revision 3ff2bba4
Added by Dmitri Dolguikh almost 10 years ago
app/models/host/managed.rb | ||
---|---|---|
allow :name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup, :location,
|
||
:organization, :url_for_boot, :params, :info, :hostgroup, :compute_resource, :domain, :ip, :mac, :shortname, :architecture,
|
||
:model, :certname, :capabilities, :provider, :subnet, :token, :location, :organization, :provision_method,
|
||
:image_build?, :pxe_build?, :otp, :realm, :param_true?, :param_false?
|
||
:image_build?, :pxe_build?, :otp, :realm, :param_true?, :param_false?, :nil?
|
||
end
|
||
|
||
attr_reader :cached_host_params
|
app/models/token.rb | ||
---|---|---|
|
||
validates :value, :host_id, :expires, :presence => true
|
||
|
||
class Jail < ::Safemode::Jail
|
||
allow :host, :value, :expires, :nil?
|
||
end
|
||
|
||
def to_s
|
||
value
|
||
end
|
test/unit/host_jail_test.rb | ||
---|---|---|
require 'test_helper'
|
||
|
||
class HostJailTest < ActiveSupport::TestCase
|
||
def test_jail_should_include_these_methods
|
||
allowed = [:name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup, :location,
|
||
:organization, :url_for_boot, :params, :info, :hostgroup, :compute_resource, :domain, :ip, :mac, :shortname, :architecture,
|
||
:model, :certname, :capabilities, :provider, :subnet, :token, :location, :organization, :provision_method,
|
||
:image_build?, :pxe_build?, :otp, :realm, :param_true?, :param_false?, :nil?]
|
||
|
||
allowed.each do |m|
|
||
assert Host::Managed::Jail.allowed?(m), "Method #{m} is not available in Host::Managed::Jail while should be allowed."
|
||
end
|
||
end
|
||
end
|
test/unit/token_test.rb | ||
---|---|---|
assert_equal 1, Token.count
|
||
end
|
||
|
||
test "token jail test" do
|
||
allowed = [:host, :value, :expires, :nil?]
|
||
allowed.each do |m|
|
||
assert Token::Jail.allowed?(m), "Method #{m} is not available in Token::Jail while should be allowed."
|
||
end
|
||
end
|
||
|
||
end
|
Also available in: Unified diff
fixes #5708: #nil? is now an allowed method inside of Host and Token jails