-
Notifications
You must be signed in to change notification settings - Fork 138
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
Allow HWADDR to be disabled #69
Conversation
I copied this pull request into my own because I'm working with hiera, and not setting macaddress there leaves a blank HWADDR= line even with the "if @macaddress" in the template (undef doesn't translate well). +1 to merge. :) |
@esalberg I'm currently running on a fork of this module as well with hiera support and support to disable HWADDR. In an attempt to try to use the origin module I made this pull request to add support for HWADDR. If you have a clean commit which add hiera support it would be awesome if you could open a pull request to add it to this module :) I'm unable to test it with hiera right now though. Perhaps it would be better to use the same logic as divansantana and use "[email protected]?"? |
@anders-larsson <% if @macaddress and @macaddress != '' %>HWADDR=<%= @macaddress %> (I did the same to ipaddress, netmask, and gateway) This lets the hwaddr be disabled (e.g. not show up as an unnecessary HWADDR= line) without having to add a new parameter throughout the code. It also leaves the default for macaddress as is (e.g. for bonds where hwaddr is optional, it's set to '' ). Looking at if::static, I think that the config will still fail if the macaddress is not available either as hardcoded data or from facter. If the default of undef from that manifest (no macaddress set) could be valid, then perhaps it would just be enough to update the validation statement, either removing it or allowing undef (e.g. add "and $macaddy != undef")? if ! is_mac_address($macaddy) { For hiera, I'm currently managing that in my own profile::network file separate from the module, but I do think it should be moved into the module, e.g. following the method used in Saz's puppet-ssh. I just haven't had a chance to move it in yet. It's not difficult really, just a bit time-consuming due to the number of defines involved, spec updates, testing, etc. I can hopefully get to it soon. |
6e35a04
to
9de19f7
Compare
@esalberg: I am also interessted in adding hiera functionality to this module. Maybe I can help finalise the feature ? I would be very glad if you could add your hiera-aware branch to your Github repository to have a look at your solution. Thanks & have phun |
I'm at the PuppetConf contributor summit today - I may see if I can get to working on this as part of that. |
I am at the Contributor Summit as well. This module is on the top of my list to get some attention. |
The Hiera requests are being tracked in issue #45. |
I don't think @esalberg's commit helps in this case. The reason an extra parameter is added is because even if you pass an empty string for macaddress to network::if::static it will default to the current interface's macaddress because of this logic on line 78-84 network::if::static. Please correct me if I'm wrong though. This is the code I used to test it:
|
So a potential answer for that could be to update the validator, e.g.: if ! is_mac_address($macaddress) and $macaddress != '' { If that's considered too dangerous (per @razorsedge ?), then adding manage_hwaddr makes sense, but I would suggest using it to bypass the validation / set macaddress to '' - which means that the template shouldn't need the change in the pull request (shouldn't need to reference @manage_hwaddr - it won't have the entry as long as macaddress remains '' ). |
@esalberg I think the whole point of that code was to provide a sane default for anyone not supplying I am fine with adding |
9de19f7
to
ccb54b1
Compare
ccb54b1
to
a384d75
Compare
I've updated the pull request. It now possible to use manage_hwaddr with network::if::dynamic as well. |
THANK YOU, Thank You, thank you @esalberg, @razorsedge and @anders-larsson for taking care :) |
Any updates @razorsedge ? |
I can't believe I completely forgot about all of this - my apologies! @razorsedge - do @anders-larsson and I need to add our names and contributors anywhere, or make any other changes? |
@esalberg Honestly, I don't know what I was waiting on for this PR (besides free time). If @anders-larsson wants to put his name in the various places, that is fine with me. I will try to get to merging this at some point soon. |
@razorsedge It's OK for me as it is. You can merge this if you feel it's satisfactory. |
@razorsedge Any updates? Sorry for bump. |
@razorsedge Thanks for asking, but we need the code not the fame ;) |
I have not forgotten this. It's been a complete lack of time and higher priorities (family issues) on my part. |
Got it, sorry for bumping. ¡ Good luck to you and your family ! |
@esalberg & @razorsedge THANKS A LOT !!! |
Inspired by #42. However since nothing happened with that pull request I've created my own take on it. Tried to cherry-pick @divansantana commit however it failed because of some structural changes that would require me to patch it to even work.
Parameter manage_hwaddr is set true as a default which keeps the current defaults. Setting it to false removes the HWADDR line in ifcfg-X.