Guest User

Untitled

a guest
Apr 17th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.99 KB | None | 0 0
  1. From: /home/lzap/work/foreman/app/models/nic/base.rb @ line 284 Nic::Base#interface_attribute_uniqueness:
  2.  
  3. 283: def interface_attribute_uniqueness(attr, base = Nic::Base.where(nil))
  4. => 284: require 'pry'; binding.pry
  5. 285: in_memory_candidates = self.host.present? ? self.host.interfaces.select { |i| i.persisted? && !i.marked_for_destruction? } : [self]
  6. 286: db_candidates = base.where(attr => self.public_send(attr))
  7. 287: db_candidates = db_candidates.select { |c| c.id != self.id && in_memory_candidates.map(&:id).include?(c.id) }
  8. 288: errors.add(attr, :taken) if db_candidates.present?
  9. 289: end
  10.  
  11. [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
  12. [1] pry(#<Nic::Managed>)>
  13. [2] pry(#<Nic::Managed>)> in_memory_candidates = self.host.present? ? self.host.interfaces.select { |i| i.persisted? && !i.marked_for_destruction? } : [self]
  14. => [#<Nic::Managed:0x0055e3cb167b50
  15. id: 263,
  16. mac: "52:54:00:d5:e1:6e",
  17. ip: "192.168.88.3",
  18. type: "Nic::Managed",
  19. name: "lyle-antona.home.lan",
  20. host_id: 187,
  21. subnet_id: 3,
  22. domain_id: 1,
  23. attrs: {},
  24. created_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
  25. updated_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
  26. provider: nil,
  27. username: nil,
  28. password: nil,
  29. virtual: false,
  30. link: true,
  31. identifier: "",
  32. tag: "",
  33. attached_to: "",
  34. managed: true,
  35. mode: "balance-rr",
  36. attached_devices: "",
  37. bond_options: "",
  38. primary: true,
  39. provision: true,
  40. compute_attributes: {},
  41. ip6: "",
  42. subnet6_id: nil>]
  43. [3] pry(#<Nic::Managed>)> db_candidates = base.where(attr => self.public_send(attr))
  44. => [#<Nic::Managed:0x0055e3d30744c0
  45. id: 262,
  46. mac: "52:54:00:d5:e1:6e",
  47. ip: "192.168.88.2",
  48. type: "Nic::Managed",
  49. name: "gail-sielaff.home.lan",
  50. host_id: 186,
  51. subnet_id: 3,
  52. domain_id: 1,
  53. attrs: {},
  54. created_at: Mon, 09 Apr 2018 12:47:23 CEST +02:00,
  55. updated_at: Mon, 09 Apr 2018 12:47:23 CEST +02:00,
  56. provider: nil,
  57. username: nil,
  58. password: nil,
  59. virtual: false,
  60. link: true,
  61. identifier: "",
  62. tag: "",
  63. attached_to: "",
  64. managed: true,
  65. mode: "balance-rr",
  66. attached_devices: "",
  67. bond_options: "",
  68. primary: true,
  69. provision: true,
  70. compute_attributes: {},
  71. ip6: "",
  72. subnet6_id: nil>,
  73. #<Nic::Managed:0x0055e3d300ad68
  74. id: 263,
  75. mac: "52:54:00:d5:e1:6e",
  76. ip: "192.168.88.3",
  77. type: "Nic::Managed",
  78. name: "lyle-antona.home.lan",
  79. host_id: 187,
  80. subnet_id: 3,
  81. domain_id: 1,
  82. attrs: {},
  83. created_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
  84. updated_at: Mon, 09 Apr 2018 12:47:49 CEST +02:00,
  85. provider: nil,
  86. username: nil,
  87. password: nil,
  88. virtual: false,
  89. link: true,
  90. identifier: "",
  91. tag: "",
  92. attached_to: "",
  93. managed: true,
  94. mode: "balance-rr",
  95. attached_devices: "",
  96. bond_options: "",
  97. primary: true,
  98. provision: true,
  99. compute_attributes: {},
  100. ip6: "",
  101. subnet6_id: nil>]
  102. [4] pry(#<Nic::Managed>)> db_candidates = db_candidates.select { |c| c.id != self.id && in_memory_candidates.map(&:id).include?(c.id) }
  103. => []
Add Comment
Please, Sign In to add comment