Sha256: 186b9289eb9df434ecbfd5ad3ecf530c149511f958081fff862b15023b562d2b

Contents?: true

Size: 1.47 KB

Versions: 4

Compression:

Stored size: 1.47 KB

Contents

FactoryGirl.define do
  factory :setup_provisioner, :class => ForemanSetup::Provisioner do
    host do
      association :host, :with_puppet_orchestration, :domain => FactoryGirl.create(:domain)
    end
    smart_proxy { association :smart_proxy, :url => "https://#{host.name}:8443" }

    # After step1, interface selection
    trait :step1 do
      provision_interface 'eth0'
      after(:create) do |prov, evaluator|
        fact = FactoryGirl.create(:fact_name, :name => "ipaddress_#{prov.provision_interface}")
        FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.20')

        fact = FactoryGirl.create(:fact_name, :name => "network_#{prov.provision_interface}")
        FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.0')

        fact = FactoryGirl.create(:fact_name, :name => "netmask_#{prov.provision_interface}")
        FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '255.255.255.0')

        fact = FactoryGirl.create(:fact_name, :name => 'interfaces')
        FactoryGirl.create(:fact_value, :fact_name => fact, :host => prov.host, :value => 'lo,eth0,eth1')
      end
    end

    # After step2_update, update with nested subnet data
    trait :step2 do
      step1
      hostgroup
      domain
      association :subnet, :factory => :subnet_ipv4
      after(:create) do |prov, evaluator|
        prov.subnet.domains << prov.domain
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
foreman_setup-5.0.1 test/factories/provisioners.rb
foreman_setup-5.0.0 test/factories/provisioners.rb
foreman_setup-4.0.0 test/factories/provisioners.rb
foreman_setup-3.1.1 test/factories/provisioners.rb