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

Do not create duplicate udev attributes #825

Merged
merged 4 commits into from Jun 10, 2019
Merged

Conversation

teclator
Copy link
Contributor

@teclator teclator commented Jun 5, 2019

Problem

When editing an interface name.

If no previous udev rule exist and the udev rule to be written is based on the interface :mac, then it generates a duplicate attribute:

edit_nic_name

Something like:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="9c:eb:e8:1a:d2:2f", ATTR{dev_id}=="0x0", ATTR{type}=="1", ATTR{address}=="9c:eb:e8:1a:d2:2f", NAME="eth1"

That also happens with an existent rule and pressing 'OK' without modifying the key attribute.

In combination with this another bug the situation is even worworst because there could be two different mac addresses, the current and the permanent one.

Solution

When editing an interface name:

1.- The rule only will be updated if the matching attribute or value from the original differs.
2.- The update_item_udev_rule! method will check if a rule already exist and if not will initialize it. As the default rule is based on :mac, we will return after initialization in case the update rule is based on :mac.

Testing

  • Added a new unit test for the new current udev rule method
  • Tested manually

@teclator teclator changed the title Do not create duplicate udev attributes [WIP] Do not create duplicate udev attributes Jun 5, 2019
@coveralls
Copy link

coveralls commented Jun 5, 2019

Coverage Status

Coverage increased (+0.03%) to 31.135% when pulling 030fd03 on duplicate_udev_key into 4b950ad on SLE-12-SP4.

@teclator teclator changed the base branch from network-ng to SLE-12-SP4 June 9, 2019 21:39
@teclator teclator changed the title [WIP] Do not create duplicate udev attributes Do not create duplicate udev attributes Jun 9, 2019
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.

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.

None yet

4 participants