Skip to content

Instantly share code, notes, and snippets.

@dayglojesus
Last active October 7, 2015 17:40
Show Gist options
  • Save dayglojesus/465788b7158b9caa99ba to your computer and use it in GitHub Desktop.
Save dayglojesus/465788b7158b9caa99ba to your computer and use it in GitHub Desktop.
Domain partial match in Foreman Nic::Interface#normalize_name
[1] pry(main)> Domain.all
=> []
[2] pry(main)> Host.all
=> []
[3] pry(main)> Host.create name: "host-00.foo.bar.com"
=> #<Host::Managed id: 1, name: "host-00.foo.bar.com", last_compile: nil, last_report: nil, updated_at: "2015-10-07 16:40:41", created_at: "2015-10-07 16:40:41", root_pass: nil, puppet_status: 0, architecture_id: nil, operatingsystem_id: nil, environment_id: nil, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: nil, hostgroup_id: nil, owner_id: nil, owner_type: nil, enabled: true, puppet_ca_proxy_id: nil, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "">
[4] pry(main)> Host.all.first.domain
=> nil
[5] pry(main)> Domain.create name: "bar.com"
=> #<Domain id: 1, name: "bar.com", fullname: nil, created_at: "2015-10-07 16:41:22", updated_at: "2015-10-07 16:41:22", dns_id: nil, hosts_count: 0, hostgroups_count: 0>
[6] pry(main)> Domain.all
=> [#<Domain id: 1, name: "bar.com", fullname: nil, created_at: "2015-10-07 16:41:22", updated_at: "2015-10-07 16:41:22", dns_id: nil, hosts_count: 0, hostgroups_count: 0>]
[7] pry(main)> Host.create name: "host-01.foo.bar.com"
=> #<Host::Managed id: 2, name: "host-01.foo.bar.com", last_compile: nil, last_report: nil, updated_at: "2015-10-07 16:41:48", created_at: "2015-10-07 16:41:48", root_pass: nil, puppet_status: 0, architecture_id: nil, operatingsystem_id: nil, environment_id: nil, ptable_id: nil, medium_id: nil, build: false, comment: nil, disk: nil, installed_at: nil, model_id: nil, hostgroup_id: nil, owner_id: nil, owner_type: nil, enabled: true, puppet_ca_proxy_id: nil, managed: false, use_image: nil, image_file: nil, uuid: nil, compute_resource_id: nil, puppet_proxy_id: nil, certname: nil, image_id: nil, organization_id: nil, location_id: nil, type: "Host::Managed", otp: nil, realm_id: nil, compute_profile_id: nil, provision_method: nil, grub_pass: "">
[8] pry(main)> Host.all.last.domain
=> #<Domain id: 1, name: "bar.com", fullname: nil, created_at: "2015-10-07 16:41:22", updated_at: "2015-10-07 16:41:22", dns_id: nil, hosts_count: 1, hostgroups_count: 0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment