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

Support Puppet 4 and 5 #148

Open
wants to merge 41 commits into
base: develop
Choose a base branch
from
Open

Conversation

pmuller
Copy link

@pmuller pmuller commented Feb 19, 2018

No description provided.

Because the later is deprecated.
This commits adds a dependency toward thrnio/ip to ease matching IPv6
networks (stdlib's types only match addresses).
Without this, long lines are truncated, making Puppet 4 type matching
errors unreadable.
Because there are no functional changes between 1.0.0 and 1.0.1
Because it makes rspec fail with some versions.
Of course, Puppet 4 and Puppet 5 have different messages for the same
errors!
@pmuller pmuller changed the title Support Puppet 4 Support Puppet 4 and 5 Feb 19, 2018
@@ -53,7 +53,7 @@
# $ensure - required - up|down
# $ipaddress - optional
# $netmask - optional
# $macaddress - required
# $macaddress - optional
Copy link
Author

Choose a reason for hiding this comment

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

This was marked as "required" but accepted then ignored empty string values.

# Only "dhcp" and "bootp" are used in /etc/sysconfig/network-scripts
#
# "static" and "none" are used in some parts of the module,
# and those values have no side effects, so we accept them too.
Copy link
Author

Choose a reason for hiding this comment

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

Not sure it's a good idea to keep allowing "static" and "none", as these values are not used by RedHat scripts.
But I kept them as I did not intend to introduce any regression in the PR.

@@ -322,7 +322,7 @@ The Hiera naming substitutes underscore for any secondary double colons, i.e. sp
Notes
-----

* Runs under Puppet 2.7 and later.
* Runs under Puppet 4.9 and later.
Copy link
Author

Choose a reason for hiding this comment

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

I expect this module to work on >=4.x but I am not sure what is the best method to validate this belief.

Boolean $noaliasrouting = false,
Boolean $restart = true,
Optional[IP::Address::V4::NoSubnet] $netmask = undef,
Optional[IP::Address::V4::NoSubnet] $broadcast = undef,
Copy link
Author

@pmuller pmuller Feb 20, 2018

Choose a reason for hiding this comment

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

Previous default values were misleading, and keeping them would make us accept Boolean for these parameters (doesn't sound like a good idea). This change has no impact on the way templates use the data.

case $::operatingsystemrelease {
/^[45]/: {
case $::os['release']['major'] {
/^[45]$/: {
Copy link
Author

Choose a reason for hiding this comment

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

Switched to major release, as only the "major" part was used.

:macaddress_eth1 => 'fe:fe:fe:aa:aa:aa',
:os => {
:family => 'RedHat',
:name => 'RedHat',
Copy link
Author

Choose a reason for hiding this comment

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

TODO: remove "name" and "release"

Copy link
Author

Choose a reason for hiding this comment

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

Fixed in c3c6b44

3 defines were using the same template, because of code duplication.

As I had to update all 3 for this commit, I chose to re-use
network::bridge in network::bridge::dynamic and network::bridge::static,
thus removing previous code duplication.
Optional[IP::Address::NoSubnet] $dns1 = undef,
Optional[IP::Address::NoSubnet] $dns2 = undef,
Optional[String] $domain = undef,
Boolean $restart = true,
Copy link
Author

@pmuller pmuller Feb 20, 2018

Choose a reason for hiding this comment

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

network::bridge now takes takes all arguments that are used by network::bridge::dynamic and network::bridge::static in order to prevent code duplication.

$effective_hostname = $hostname ? {
String => $hostname,
default => $::networking['fqdn'],
}
Copy link
Author

@pmuller pmuller Feb 20, 2018

Choose a reason for hiding this comment

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

This is ugly, but was the only way to preserve the current behavior:

  • When called with a $hostname, it is used both by hostnamectl and the template
  • When called without a $hostname, the template gets a value through facts, but the hostnamectl exec isn't evaluated

I know the result is the same, but to simplify the code, we could use $::networking['fqdn'] as default value for $hostname, and let the unless attribute of the exec resource do its job.

What do you think?

@pmuller
Copy link
Author

pmuller commented Mar 15, 2018

@razorsedge How can I improve this PR ?

@mrolli
Copy link

mrolli commented May 29, 2018

+1'000: I'd like to see this merged so bad....

@olifre
Copy link

olifre commented Jul 2, 2018

Same here, we are on Puppet 5 and https://github.com/voxpupuli/puppet-network has many issues for us, so we'd like to migrate to this module here, but this is one of the things preventing us...

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

3 participants