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

Fix wrong interface name with auto_vlan=yes #39

Merged
merged 9 commits into from
Sep 18, 2017
Merged

Fix wrong interface name with auto_vlan=yes #39

merged 9 commits into from
Sep 18, 2017

Conversation

mvidner
Copy link
Member

@mvidner mvidner commented Aug 11, 2017

Porting #38 to SLE-12

The actual patch has a couple of lines, the rest of the PR makes its surroundings a bit more readable.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 85610b1 on vlan-12 into ** on SLE-12-SP2**.

Copy link
Member

@mchf mchf left a comment

Choose a reason for hiding this comment

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

I assume that complexity of the code is no-go for an automatic test. Was it tested manually?

Otherwise just a couple of NPs, but missing changelog is blocker.

),
"nfsroot"
)
SCR.Write(ifcfg_path + "STARTMODE", "nfsroot")
Copy link
Member

Choose a reason for hiding this comment

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

this can be picked out of if-else - shared between both branches

)
SCR.Write(ifcfg_path + "BOOTPROTO", "static")
SCR.Write(ifcfg_path + "STARTMODE", "nfsroot")
SCR.Write(ifcfg_path + "NAME", Ops.get_string(card, "device", ""))
Copy link
Member

Choose a reason for hiding this comment

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

why not to get even rid of last remaining Ops.get_string(...)?

dev_name,
Ops.get_string(card, "vlan_interface", "")
)
cmd_ifup = Builtins.sformat("ifup %1.%2", dev_name, vlan_interface)
Copy link
Member

Choose a reason for hiding this comment

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

we have SetIfaceUp in yast2-network ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Having learned about it, well, it is such a lone function (nobody uses it!) that I don't feel comfortable using it.
BTW it does not document its return value: http://www.rubydoc.info/github/yast/yast-network/Yast%2FNetworkRoutinesInclude%3ASetIfaceUp

Copy link
Member

Choose a reason for hiding this comment

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

well it used to be used. Currently it is replaced by something more friendly to wicked.

if card["auto_vlan"] == "yes" || vlan_interface == "0"
command = Builtins.sformat("fipvlan -c -s -f '-fcoe' %1", dev_name)
else
command = Builtins.sformat("fipvlan -c -s %1", dev_name)
Copy link
Member

Choose a reason for hiding this comment

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

You did a nice cleanup, so you can go even further: "fipvlan -c -s #{ dev_name}"

def HandleConfigurationDialog(id, event)
event = deep_copy(event)
action = Ops.get(event, "ID")
def HandleConfigurationDialog(_id, _event)
Copy link
Member

Choose a reason for hiding this comment

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

what is the reason why this cannot be removed completely?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could, but I just have to stop the refactoring somewhere.

Copy link
Member

Choose a reason for hiding this comment

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

you're touching it anyway and dropping unused method makes more sense to me over adding '_' to satisfy a convention ;-)

Copy link
Member Author

Choose a reason for hiding this comment

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

An empty method is not an unused method. You have missed my point.

Ops.get_string(card, "fcoe_vlan", "") != @NOT_CONFIGURED
fcoe_vlan = card.fetch("fcoe_vlan", "")
if fcoe_vlan != @NOT_AVAILABLE &&
fcoe_vlan != @NOT_CONFIGURED
Copy link
Member

Choose a reason for hiding this comment

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

alternative which I sometimes prefer: ![@NOT_AVAILABLE, @NOT_CONFIGURED].include? fcoe_vlan

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 385781c on vlan-12 into ** on SLE-12-SP2**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling e12fa5d on vlan-12 into ** on SLE-12-SP2**.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c56f146 on vlan-12 into ** on SLE-12-SP2**.

Copy link
Member

@mchf mchf left a comment

Choose a reason for hiding this comment

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

nice cleanup + docu + tests. Thanks and LGTM

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

Successfully merging this pull request may close these issues.

3 participants