Skip to content

Commit

Permalink
Fixes #2948 - added sp_* host attributes to safe mode
Browse files Browse the repository at this point in the history
Refs #2948 - Add sp_ host attributes to jail test

(cherry picked from commit 13d9564)
  • Loading branch information
lzap authored and Dominic Cleal committed Jan 27, 2015
1 parent ad82296 commit faeca37
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/models/host/base.rb
Expand Up @@ -136,6 +136,7 @@ def facts_hash
end
hash
end
alias_method :facts, :facts_hash

def ==(comparison_object)
super ||
Expand Down
5 changes: 3 additions & 2 deletions app/models/host/managed.rb
Expand Up @@ -56,11 +56,12 @@ def build_hooks
include HostCommon

class Jail < ::Safemode::Jail
allow :name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup, :location,
allow :name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup,
: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?, :indent, :primary_interface, :interfaces,
:has_primary_interface?, :bond_interfaces, :interfaces_with_identifier, :managed_interfaces
:has_primary_interface?, :bond_interfaces, :interfaces_with_identifier, :managed_interfaces, :facts, :facts_hash,
:sp_name, :sp_ip, :sp_mac, :sp_subnet
end

attr_reader :cached_host_params
Expand Down
7 changes: 4 additions & 3 deletions test/unit/host_jail_test.rb
Expand Up @@ -2,10 +2,11 @@

class HostJailTest < ActiveSupport::TestCase
def test_jail_should_include_these_methods
allowed = [:name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup, :location,
allowed = [:name, :diskLayout, :puppetmaster, :puppet_ca_server, :operatingsystem, :os, :environment, :ptable, :hostgroup,
: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?, :indent]
:model, :certname, :capabilities, :provider, :subnet, :token, :location, :organization, :provision_method, :image_build?,
:pxe_build?, :otp, :realm, :param_true?, :param_false?, :nil?, :indent, :sp_name, :sp_ip, :sp_mac, :sp_subnet, :facts,
:facts_hash]

allowed.each do |m|
assert Host::Managed::Jail.allowed?(m), "Method #{m} is not available in Host::Managed::Jail while should be allowed."
Expand Down

0 comments on commit faeca37

Please sign in to comment.