Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get mac addr if the selected profile is '<Empty>' or '<Template>' #227

Merged
merged 1 commit into from
Mar 22, 2018

Conversation

AlonaKaplan
Copy link
Contributor

@AlonaKaplan AlonaKaplan commented Mar 19, 2018

In case the selected profile is '<Empty>' the mac of a nic with null
profile will be retrieved.

In case the selected profile is '<Template>' the mac of the first nic would
be retrieved.

Fixes https://bugzilla.redhat.com/1552597

@AlonaKaplan
Copy link
Contributor Author

@masayag please review

@AlonaKaplan
Copy link
Contributor Author

@miq-bot add_labels bug, gaprindashvili/yes

Copy link
Contributor

@masayag masayag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix rubocop complaints

@@ -551,10 +551,24 @@ def get_mac_address_of_nic_on_requested_vlan(args)
end

def find_mac_address_on_network(nics, vnic_profile_id)
nic = nics.detect do |n|
n.vnic_profile.id == vnic_profile_id
if vnic_profile_id == '<Empty>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please extract '' to constant - it is used widely and we should define it in one place, so let's start with defining a constant for it in this PR, and in a follow PR replace other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do it in a separate patch.

nic = nics.detect do |n|
n.vnic_profile.nil?
end
elsif vnic_profile_id == '<Template>'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for

if nics.empty?
_log.warn "Cannot find mac address, there are no NICs"
else
_log.warn "Cannot find mac address, cannot find NIC with vnic_profile=#{vnic_profile_id}" if nic.nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it sounds like there are two error messages in this line: one for mac address and the other for the profile.
Maybe 'or' between the two sentence parts or can we be more specific based on the detected nic ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@masayag
Copy link
Contributor

masayag commented Mar 21, 2018

the code looks okay, but a spec file is needed here.

@istein1
Copy link

istein1 commented Mar 21, 2018

Verified this fix,
that implemented on a CFME-5.9.1.0 appliance manually.

Tested on CFME side, for RHV provider, VM provision from pxe:

  1. with use template vnic - Finished successfully. (Didn't fail as reported in https://bugzilla.redhat.com/1552597)
  2. with empty vnic profile - Request fail on timeout, as this is an empty profile.
  3. with a specific vnic profile - Finished successfully.

…te>'

In case the selected profile is '<Empty>' the mac of a nic with null
profile will be retrieved.

In case the selected profile is '<Template>' the mac of the first nic would
be retrieved.

Bug-Url: https://bugzilla.redhat.com/1552597
Signed-off-by: Alona Kaplan <alkaplan@redhat.com>
@AlonaKaplan
Copy link
Contributor Author

@masayag a spec was added, please re-review.

@miq-bot
Copy link
Member

miq-bot commented Mar 21, 2018

Checked commit AlonaKaplan@1ec7344 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. ⭐

@masayag masayag merged commit 0c70a56 into ManageIQ:master Mar 22, 2018
@agrare agrare added this to the Sprint 82 Ending Mar 26, 2018 milestone Mar 27, 2018
simaishi pushed a commit that referenced this pull request Mar 27, 2018
Get mac addr if the selected profile is '<Empty>' or '<Template>'
(cherry picked from commit 0c70a56)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1561218
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit 1311873345b966802e220a18a295c24f8c0eb789
Author: Moti Asayag <masayag@redhat.com>
Date:   Thu Mar 22 09:22:24 2018 +0200

    Merge pull request #227 from AlonaKaplan/pxe
    
    Get mac addr if the selected profile is '<Empty>' or '<Template>'
    (cherry picked from commit 0c70a5690ea039b3f00bc93baf158e03c45f073d)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1561218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants