-
Notifications
You must be signed in to change notification settings - Fork 34
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 write anything when nothing was changed #402
Conversation
21539b1
to
62a1c6e
Compare
e4aca6b
to
333e4af
Compare
nm_name variable is only assigned but never used in the code. Moreover it seems that its usage has started to be replaced since 2.15.46 (see 624c041)
Seems to be unused anywhere including installation clients
Commit always sets modified flag. Everything is written subsequently including forcing network service restart. That is too much when nothing was changed.
Which raised when querying nonexistent widget.
ab2e93e
to
e21a798
Compare
ProtectByFirewall method allways sets modified flag for firewall module. So when called unconditionally it causes rewriting of network configuration even when not needed (no zone changed).
2e887a3
to
847b02b
Compare
@@ -2031,15 +2031,12 @@ def Commit | |||
# CanonicalizeIP is called to get new device map into the same shape as | |||
# NetworkInterfaces provides the current one. | |||
if current_map != NetworkInterfaces.CanonicalizeIP(new_map) | |||
NetworkInterfaces.Name = Items()[@current]["ifcfg"] || "" | |||
NetworkInterfaces.Current = deep_copy(newdev) | |||
Items()[@current]["ifcfg"] = "" if !NetworkInterfaces.Change2(Items()[@current]["ifcfg"], newdev, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please assign that false
to a explode_if_existing
or whatever, before use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can factor out the Items access if we use a mutating method on ::String
:
ifcfg_name = Items()[@current]["ifcfg"]
explode = false
ifcfg_name.replace("") if !NetworkInterfaces.Change2(ifcfg_name, newdev, explode)
LGTM. The coverage has increased slightly but I've noticed that |
Thanks for hint. I'm going for another 0.001% ;-) Any small step towards 50% test coverage is appreciated ;-) |
@mvidner |
Once |
.to receive(method) | ||
.and_return true | ||
|
||
expect(modname.send(method)).to be true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you mock a method and then you call it. It does succeed but it is not testing any of production code.
That's bcs I forgot to actually run the test on |
bc3ba1e
to
57ccc88
Compare
0be5e01
to
f56d2cd
Compare
Yay! LGTM. |
Thank you. |
fate#318787