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

A collectd::plugin::python acceptance test #805

Merged
merged 1 commit into from
Jun 6, 2018

Conversation

traylenator
Copy link
Contributor

Pull Request (PR) description

A collectd::plugin::python acceptance test

@traylenator
Copy link
Contributor Author

traylenator commented May 30, 2018

ubuntu 16 fails because collectd does not pull in python , only python-lib.

So the fact python_dir defaults to

/usr/local/lib/python2.7/dist-packages

but this can't be made because

/usr/local/lib/python2.7

does not exist until python is installed.

In the real world this never happens probably because something pulls in python.

@bastelfreak
Copy link
Member

so python is a soft dependency? Can you document it in the README.md and install it during the acceptance tests?

@traylenator
Copy link
Contributor Author

It's really a hard dependency so added the python install the collectd::python::module.

@@ -47,6 +49,8 @@
globals => $globals,
}

ensure_packages([$python_package], { ensure => $python_package_ensure })
Copy link
Member

Choose a reason for hiding this comment

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

we should probably wrap this into a $manage_python condition. There are distributions where 'python' defaults to python 3, others default to version 2. Do we need to catch that here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Collectd is always built against exactly one python. It is the python package untill we have a counter example.

Happy to add a manage_python boolean. It will help people who install python in another funky way.

@traylenator traylenator force-pushed the pythonaccept branch 3 times, most recently from 8c31070 to c731ab7 Compare May 31, 2018 11:35
@traylenator traylenator removed needs-work not ready to merge just yet tests-fail labels May 31, 2018
Hash $modules = {},
$order = '10',
$conf_name = 'python-config.conf',
Boolean $manage_python = true,
Copy link
Member

Choose a reason for hiding this comment

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

I'm currently unsure if this should default to true. This probably breaks the catalog for many people. Should it default to false and be documented in the README.md?

Copy link

Choose a reason for hiding this comment

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

+1 to not install/manage prerequisites by default.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

collectd::plugin::python

cannot work if python is not installed. What's the difference between a pre-requisite and a requirement?
Package is added with 'ensure_packages' to reduce impact to people catalogs.

Happy to change of course.

Copy link
Member

Choose a reason for hiding this comment

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

ensure_packages works only if this class gets evaluated at the end. It will still fail if later on in the catalog somebody tries to manage the python package in a python specific module. Also the python package defaults to different versions depending on the operating system.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change because it's easier to do and get through. It's only ubunutu and I never use that so...

Think I already answered the python version comment above.

ensure_packages works only if this class gets evaluated at the end.

The other class probably needs fixing if it does not ensure_resource on such a fundamental package.
Essentially this is saying it's never okay to install python but given ubunut 16 docker images don't have python this is a new necessity.

Of course there's a total alternate method to this. Remove the facter fact that depends on a python interpreter to work and just set sensible values for python_sitelib on different OSes.

@bastelfreak bastelfreak added the needs-feedback Further information is requested label Jun 5, 2018
@traylenator traylenator removed the needs-feedback Further information is requested label Jun 6, 2018
@@ -47,6 +50,13 @@
globals => $globals,
}

if $manage_python {
ensure_packages([$python_package], { ensure => $python_package_ensure })
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 like this because it's really a soft dependency and is not some kind of separate collectd_python package. For example, if a plugin required mongodb, apache or ruby would it be appropriate to manage installation in this module? That being said, ensure_packages is the best way to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's slightly different because it's the fact and puppet manifest that requires 'python'. collectd itself does not require it.
Anyway especially with the default false the code is basically pointless so lets just chop it.

python being installed is pre-requiste to the fact operating correctly
so it is installed within the acceptence test and documented.
@traylenator
Copy link
Contributor Author

Changed after approval, still okay?

@traylenator traylenator merged commit e69dd24 into voxpupuli:master Jun 6, 2018
@traylenator traylenator deleted the pythonaccept branch June 6, 2018 12:22
@traylenator
Copy link
Contributor Author

Thanks @bastelfreak @juniorsysadmin for the comments.

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.

4 participants