Sha256: be3f8c1fb66960c2863f201223b9e944645f11033b87855a26992fe6b87dd6a6

Contents?: true

Size: 1.44 KB

Versions: 2

Compression:

Stored size: 1.44 KB

Contents

FactoryBot.define do
  factory :setup_provisioner, :class => ForemanSetup::Provisioner do
    host do
      association :host, :managed, :domain => FactoryBot.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 = FactoryBot.create(:fact_name, :name => "ipaddress_#{prov.provision_interface}")
        FactoryBot.create(:fact_value, :fact_name => fact, :host => prov.host, :value => '192.168.1.20')

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

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

        fact = FactoryBot.create(:fact_name, :name => 'interfaces')
        FactoryBot.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

2 entries across 2 versions & 1 rubygems

Version Path
foreman_setup-8.0.1 test/factories/provisioners.rb
foreman_setup-8.0.0 test/factories/provisioners.rb