Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From: /home/lzap/work/foreman/app/models/nic/base.rb @ line 284 Nic::Base#interface_attribute_uniqueness:
- 283: def interface_attribute_uniqueness(attr, base = Nic::Base.where(nil))
- => 284: require 'pry'; binding.pry
- 285: in_memory_candidates = self.host.present? ? self.host.interfaces.select { |i| i.persisted? && !i.marked_for_destruction? } : [self]
- 286: db_candidates = base.where(attr => self.public_send(attr))
- 287: db_candidates = db_candidates.select { |c| c.id != self.id && in_memory_candidates.map(&:id).include?(c.id) }
- 288: errors.add(attr, :taken) if db_candidates.present?
- 289: end
- [1] pry(#<Nic::Managed>)> app|I Started GET "/tasks/6b122264-4294-4605-bd2a-b26451b73113" for 127.0.0.1 at 2018-04-09 13:01:08 +0200
- [1] pry(#<Nic::Managed>)>
- [2] pry(#<Nic::Managed>)> in_memory_candidates = self.host.present? ? self.host.interfaces.select { |i| i.persisted? && !i.marked_for_destruction? } : [self]
- => [#<Nic::Managed:0x0055e3cb167b50
- id: 263,
- mac: "52:54:00:d5:e1:6e",
- ip: "192.168.88.3",
- type: "Nic::Managed",
- name: "lyle-antona.home.lan",
- host_id: 187,
- subnet_id: 3,
- domain_id: 1,
- attrs: {},
- created_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
- updated_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
- provider: nil,
- username: nil,
- password: nil,
- virtual: false,
- link: true,
- identifier: "",
- tag: "",
- attached_to: "",
- managed: true,
- mode: "balance-rr",
- attached_devices: "",
- bond_options: "",
- primary: true,
- provision: true,
- compute_attributes: {},
- ip6: "",
- subnet6_id: nil>]
- [3] pry(#<Nic::Managed>)> db_candidates = base.where(attr => self.public_send(attr))
- => [#<Nic::Managed:0x0055e3d30744c0
- id: 262,
- mac: "52:54:00:d5:e1:6e",
- ip: "192.168.88.2",
- type: "Nic::Managed",
- name: "gail-sielaff.home.lan",
- host_id: 186,
- subnet_id: 3,
- domain_id: 1,
- attrs: {},
- created_at: Mon, 09 Apr 2018 12:47:23 CEST +02:00,
- updated_at: Mon, 09 Apr 2018 12:47:23 CEST +02:00,
- provider: nil,
- username: nil,
- password: nil,
- virtual: false,
- link: true,
- identifier: "",
- tag: "",
- attached_to: "",
- managed: true,
- mode: "balance-rr",
- attached_devices: "",
- bond_options: "",
- primary: true,
- provision: true,
- compute_attributes: {},
- ip6: "",
- subnet6_id: nil>,
- #<Nic::Managed:0x0055e3d300ad68
- id: 263,
- mac: "52:54:00:d5:e1:6e",
- ip: "192.168.88.3",
- type: "Nic::Managed",
- name: "lyle-antona.home.lan",
- host_id: 187,
- subnet_id: 3,
- domain_id: 1,
- attrs: {},
- created_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
- updated_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
- provider: nil,
- username: nil,
- password: nil,
- virtual: false,
- link: true,
- identifier: "",
- tag: "",
- attached_to: "",
- managed: true,
- mode: "balance-rr",
- attached_devices: "",
- bond_options: "",
- primary: true,
- provision: true,
- compute_attributes: {},
- ip6: "",
- subnet6_id: nil>]
- [4] pry(#<Nic::Managed>)> db_candidates = db_candidates.select { |c| c.id != self.id && in_memory_candidates.map(&:id).include?(c.id) }
- => []
Add Comment
Please, Sign In to add comment