-
Notifications
You must be signed in to change notification settings - Fork 79
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
Refactors #172
Refactors #172
Conversation
This will ease using iteration later on.
As this is a quite complex refactor I have taken extra care to NOT change the existing spec tests. |
ce46f85
to
1cf1959
Compare
Added some refactoring for the common* files in #172. |
If you like this refactoring I will move as much data into Hiera 5 module data to clean up the code even more. |
manifests/init.pp
Outdated
@@ -136,324 +114,98 @@ | |||
mode => $pam_d_sshd_mode, | |||
} | |||
|
|||
case $::osfamily { | |||
case $facts['os']['family'] { |
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.
repeating the case statement inside itself seems wrong
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.
Well, that took more time for refactoring. Checkout the commit "Refactor case statements".
manifests/init.pp
Outdated
} | ||
} | ||
} | ||
default: { | ||
fail('Pam is not supported on your osfamily') | ||
} | ||
} | ||
|
||
$_common_files.each |$_common_file| { |
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.
very clever
@@ -268,15 +266,13 @@ | |||
:packages => [ 'libpam0g', ], | |||
:files => [ | |||
{ :prefix => 'pam_common_', | |||
:types => ['auth', 'account', 'password', 'session', 'noninteractive_session' ], | |||
:types => ['auth', 'account', 'password', 'session', 'session_noninteractive' ], |
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.
this would change the name of the file and i believe would result in both noninteractive_session
and session_noninteractive
being on disk. Does that pose any issue?
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.
I double checked the code that it only change the internal resource name but leaves the path untouched.
There was a special line (394) needed for these cases in the spec tests:
https://github.com/ghoneycutt/puppet-module-pam/blob/v2.33.0/spec/classes/init_spec.rb#L389-L403. With that removed now it is easier to see.
1cf1959
to
ed9ecfe
Compare
ed9ecfe
to
0cd717d
Compare
eea9b41
to
d1118e2
Compare
d1118e2
to
5f7c732
Compare
Main class looks so much cleaner now without all theses osfamily dependend settings. Based on the great work @treydock did in a8e9786 I have now moved the rest into hiera data. Using iteration for the common* files to get rid of the os specific resource collections. Finalise: Use module hiera data |
Thank you! |
Using iterations with
each
instead of resource declarations for each single common* file on Linux systems.