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

Document campotocamp/systemd soft dependency #696

Merged
merged 1 commit into from
Jun 22, 2019

Conversation

jarekgrzabel
Copy link
Contributor

Description

This pull request is to merge changes in files listing module dependencies. Latest version (12.0.0) didn't mention camptocamp/systemd module requirement hence when running puppet module install theforeman-puppet puppet run failed with the dependency error.

Changes

README.md - added new dependency section listing all the dependencies
metadata.json - added new values to add dependency for camptocamp/systemd module.

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.

If this is added, a you can remove this line:

install_module_from_forge('camptocamp-systemd', '>= 2.0.0 < 3.0.0')

However, I'm not sure we need to. It's only needed if you enable the one option and only if you use systemd. Note we also support platforms which are unlikely to ever support that (BSD). However, I can't find the document around optional dependency best practices now.

metadata.json Outdated Show resolved Hide resolved
metadata.json Outdated Show resolved Hide resolved
@jarekgrzabel
Copy link
Contributor Author

If this is added, a you can remove this line:

puppet-puppet/spec/spec_helper_acceptance.rb

Line 16 in 15a8ae7

install_module_from_forge('camptocamp-systemd', '>= 2.0.0 < 3.0.0')
However, I'm not sure we need to. It's only needed if you enable the one option and only if you use systemd. Note we also support platforms which are unlikely to ever support that (BSD). However, I can't find the document around optional dependency best practices now.

Sorry I'm a bit confused now. Your systemd dependency inside the module is managed by code (

if $facts['service_provider'] == 'systemd' {
) ... if that dependency is not being met then you don't have any systemd conflict. So as long as your code doesn't inject that systemd depencency somewhere it won't be a problem. Downloading the systemd module itself won't cause any harm on BSD systems either unless the module is being called. Similar practice when you need to download the package and you need to support multiple providers (like apt on RHEL systems).

@ekohl
Copy link
Member

ekohl commented Apr 23, 2019

https://puppet.com/docs/puppet/5.5/style_guide.html#dependencies states:

Soft dependencies should be called out in the README.md, and must not be enforced as a hard requirement in your metadata.json. A soft dependency is a dependency that is only required in a specific set of use cases. For an example, see the rabbitmq module.

This is a rather specific use case: if you enable file limits on the puppetserver when running on systemd. That's why I do feel that mentioning it in README.md should be sufficient.

@jarekgrzabel
Copy link
Contributor Author

https://puppet.com/docs/puppet/5.5/style_guide.html#dependencies states:

Soft dependencies should be called out in the README.md, and must not be enforced as a hard requirement in your metadata.json. A soft dependency is a dependency that is only required in a specific set of use cases. For an example, see the rabbitmq module.

This is a rather specific use case: if you enable file limits on the puppetserver when running on systemd. That's why I do feel that mentioning it in README.md should be sufficient.

The problem is I don't really understand why you call this a soft dependency. Reason for that is you call part of this module in your code and even if you call it for some specific system type or distribution it is still not a suggested module to download. Without systemd module for that specific system type or distribution your puppet configuration module will not work at all and will drop big fat error.

How does this code work or BSD then if you don't include the systemd::dropin_file define anywhere?

@mmoll
Copy link
Contributor

mmoll commented Apr 23, 2019

Not 100% sure, but I think this module would even work on Linux without the systemd modules, as long as the puppetserver features are not used...

The main problem is that in the default config, the dropin is set to absent, which requires the system modules...

@jarekgrzabel
Copy link
Contributor Author

jarekgrzabel commented Apr 23, 2019

Are you sure that defaults don't call it ? I use your module to configure initial puppet master and I use only this part to get it configured intially:

/opt/puppetlabs/bin/puppet module install puppetlabs-puppetdb

cat > puppet_master_install.pp <<EOF
class { 'puppet': 
  server => true,
  server_foreman => false,
  dns_alt_names => [ "${puppetmaster_host_name}" ],
  server_external_nodes => '',
  autosign_entries => [ "*.puppet.aws" ],
  server_certname => "${puppetmaster_host_name}",
  client_certname => "${puppetmaster_host_name}",
  ca_server => "${puppetmaster_host_name}",
  server_ca_allow_sans => true,
  puppetmaster => "${puppetmaster_host_name}",
}
EOF
/opt/puppetlabs/bin/puppet apply puppet_master_install.pp

So I'm not calling any dropin stuff by default...

@ekohl
Copy link
Member

ekohl commented Apr 23, 2019

Looks like you are right that we do manage it even if the limits are not set (ensure => absent) when running on systemd. However, if you set server => false (agent only) it's not included. The FreeBSD family also doesn't call it.

@jarekgrzabel
Copy link
Contributor Author

I think I will have a problem with understanding what is the real soft and hard dependency in that case. I also disagree with Puppet RabbitMQ module dependency model but that's fine. I just think if you call any third party modules they should become an integral part of the module from 2 reasons:

  1. You rely that your code will work on certain version of the other third party module and you probably writing your module you want to make sure that you test against these versions anyway.
  2. If you don't control the version of third party module but rely on it in the code, if it gets updated and brings errors to your module code, people will start raising requests to fix the issue. Then you have a situation who's problem is that going to be to fix it.

Anyway I removed that hard dependency from metadata.json and changed README file to mention that it may require systemd module for compatibility with some systems.

README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@mmoll mmoll left a comment

Choose a reason for hiding this comment

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

We'll fix the metadata.json nit on merge.

@mmoll mmoll changed the title Adding camptocamp/systemd module dependency Document campotocamp/systemd soft dependency Jun 21, 2019
@mmoll mmoll merged commit 10f437e into theforeman:master Jun 22, 2019
@mmoll
Copy link
Contributor

mmoll commented Jun 22, 2019

merged, dzięki @dogjarek!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants