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

extract nssdb creation into separate class #139

Merged
merged 1 commit into from
Mar 22, 2017

Conversation

timogoebel
Copy link
Member

Both qpidd and candlepin need the nssdb present. This commit extracts the code to a common class.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

There's a merge conflict as well.

Other than that this is looking like a very nice refactoring.

owner => 'root',
group => $::certs::qpidd_group,
mode => '0755',
} ~>
Copy link
Member

Choose a reason for hiding this comment

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

I think this doesn't have to be a notify

owner => 'root',
group => $::certs::qpidd_group,
mode => '0640',
} ~>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this has to be a notify

command => "certutil -N -d '${::certs::nss_db_dir}' -f '${nss_db_password_file}'",
path => '/usr/bin',
creates => $nssdb_files,
} ~>
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this has to be a notify

@@ -0,0 +1,35 @@
# Creates a nssdb
class certs::ssltools::create_nssdb inherits certs {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just name it ```nssdb``? The current name sounds like a command.

Copy link
Member

Choose a reason for hiding this comment

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

I'd also prefer if this was just a class with a parameter rather than inheriting from certs. Looks like there are just 2 (nss_db_dir and group).

@timogoebel
Copy link
Member Author

@ekohl : Rebased and addressed your comments.

group => $::certs::qpidd_group,
mode => '0755',
} ->
exec { 'generate-nss-password':
Copy link
Member

Choose a reason for hiding this comment

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

While we're at it, maybe set the umask as well for security reasons?

Copy link
Member Author

Choose a reason for hiding this comment

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

... to 027?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, and maybe if we add group => $group the file resource won't change anything at all (but still should be there to ensure it's correct).

group => $::certs::qpidd_group,
mode => '0640',
} ->
exec { 'create-nss-db':
Copy link
Member

Choose a reason for hiding this comment

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

This could use a umask as well.

@@ -0,0 +1,35 @@
# Creates a nssdb
class certs::ssltools::nssdb inherits certs {
Copy link
Member

Choose a reason for hiding this comment

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

Could you implement it as a non-inheriting class with parameters? That would make testing easier and faster.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ekohl: How do you suggest that we pass the parameters? That would mean we can't call the class with include but have to use class {'':} although we have to call the class several times?

Copy link
Member

Choose a reason for hiding this comment

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

If they default to $::certs::pki_dir and $::certs__qpidd_group a simple include should work I think.

@timogoebel timogoebel force-pushed the extract_nssdb branch 3 times, most recently from 84a8ba5 to 02ab6e7 Compare March 21, 2017 07:16
@timogoebel
Copy link
Member Author

@ekohl : The class does not inherit from certs anymore. Added the group and umask parameters. They work nicely.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

Looks good

# Sets up nssdb
class certs::ssltools::nssdb (
$nss_db_dir = $::certs::nss_db_dir,
$qpidd_group = $::certs::qpidd_group
Copy link
Member

Choose a reason for hiding this comment

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

Given this is now just about creating the nss db I think it could even be just $group = ... and use a trailing comma.

@timogoebel
Copy link
Member Author

Updated.

@timogoebel
Copy link
Member Author

Now that the pipeline is back to green, I think this should be next to merge to unblock the other PRs.

@ehelms
Copy link
Member

ehelms commented Mar 22, 2017

Thanks @timogoebel

@ehelms ehelms merged commit 661bc31 into theforeman:master Mar 22, 2017
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.

3 participants