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

Add boolean to control EPEL #181

Merged
merged 1 commit into from
Oct 24, 2017
Merged

Conversation

lukebigum
Copy link
Contributor

Add boolean to explicitly control whether Class[python] tries to manage EPEL or not - useful for environments that mirror EPEL internally.

This directly conflicts with #176 - but my commit is backwards compatible as EPEL will continue to be managed by default.

Note the Rubocop failure is on spec/spec_helper_acceptance.rb which is probably managed by Voxpupuli's Module Sync, so while I could make the Rubocop warning go away, my change will be overwritten by any msync from upstream :-)

# [*python_use_epel*]
# (bool) Whether the Python class will use attempt to manage EPEL or not.
# Defaults to true ($::puppetboard::params::python_use_epel)
#
Copy link
Member

Choose a reason for hiding this comment

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

The default for fedora users was actually false though. https://github.com/stankevich/puppet-python/blob/718e9bc482f72559d9035ec2b8b651be01984128/manifests/params.pp#L25 So this would change the default behaviour for them.

I'm not sure we want to be replicating the logic in that class in our own params.pp though... Dunno. Maybe someone else will have a suggestion.

@@ -289,6 +294,7 @@
class { '::python':
virtualenv => 'present',
dev => 'present',
use_epel => $python_use_epel,
Copy link
Member

Choose a reason for hiding this comment

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

This might also be backwards incompatible for any users that have already worked around the issue by setting python::use_epel: false in their hiera?

Copy link
Member

Choose a reason for hiding this comment

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

I forgot how hiera handles this. If it's undef, won't it still use the hiera value?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it an optional boolean vs. just a boolean again? And even if they had set python::use_epel: false earlier, would this actually generate an error if this setting were also false, or just be redundant?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I see, to try to avoid changing existing behavior. Makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

@ekohl Not sure. It's probably not too much of a big deal.

@lukebigum lukebigum force-pushed the master branch 5 times, most recently from 7427cb3 to 9dc632b Compare July 12, 2017 09:24
@lukebigum
Copy link
Contributor Author

Both good points. Attempt no. 2 - Boolean is now a Variant and defaults to undef, so the internal behaviours won't change (ie: Fedora) and Hiera will still kick in if people are tuning Class[python] it that way.

FYI: this set of tests looks broken. /etc/apache2 on Red Hat...? Leaving it alone, I think it's working on Travis by magic (it fails when I test locally).

@@ -173,6 +177,7 @@
$python_loglevel = $::puppetboard::params::python_loglevel,
$python_proxy = $::puppetboard::params::python_proxy,
$python_index = $::puppetboard::params::python_index,
Variant[Boolean, Undef] $python_use_epel = undef,
Copy link
Member

Choose a reason for hiding this comment

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

It's probably more common to use Optional[Boolean] $var_name = undef but I think that's just a style thing.

@lukebigum
Copy link
Contributor Author

IChanged to an Optional.

@lukebigum
Copy link
Contributor Author

Anything else holding up this PR?

@bastelfreak
Copy link
Member

Hi @lukebigum, could you also provide a fix for the rubocop issue?

@lukebigum
Copy link
Contributor Author

Hi, the Rubocop issue is on spec/spec_helper_acceptance.rb, which I assumed was managed by Voxpupuli's Module Sync. I can fix it, but it might just get overwritten again.

@alexjfisher
Copy link
Member

@lukebigum Good news is spec/spec_helper_acceptance.rb is not managed my modulesync. If you think you can fix it, that'd be much appreciated.

@lukebigum lukebigum force-pushed the master branch 6 times, most recently from 5fc13fb to 7946ff8 Compare July 24, 2017 13:55
@lukebigum
Copy link
Contributor Author

@alexjfisher I've looked, but now I think it's a false positive. The code style that rubocop-rspec is trying to catch is geared towards a very simple array loop in rspec, and this is not an Rspec test file (thus not possible to use rspec's all matcher here). I've disabled that test for that file.

@tux-o-matic
Copy link

@lukebigum, what's the point if EPEL is actually not needed?

@lukebigum
Copy link
Contributor Author

@tux-o-matic I don't understand what you mean. Class[puppetboard] declares Class[python] in such a way that it pulls in Class[epel] by default. This patch changes Class[puppetboard] so that it declares Class[python] with the 'use_epel' parameter, allowing you to turn that off, if say, you don't want to Class[epel] in your catalog.

@tux-o-matic
Copy link

@lukebigum, as I discovered out in #166, the only reason to need EPEL is for virtualenv on EL 6. And to get virtualenv on EL 6 you could within this module:

  • Define the Yumrepo resource directly.
  • Install virtualenv as a Package resource with the 'pip' provider.
    You have two built-in Python resource types to support that one OS instead of loading a third party module.

@lukebigum
Copy link
Contributor Author

@tux-o-matic that's exactly what I don't want to do. Such an approach assumes that you can simply create Yumrepo resources and Pip packages in my environment and it would all work perfectly. That would work for most people with free access to the Internet, think... "behind giant corporate firewall".

I could do that, but again I'd need to wrap all of said functionality in a Boolean so I personally could turn it off.

@tux-o-matic
Copy link

tux-o-matic commented Jul 31, 2017

@lukebigum The Yumrepo resource supports the proxy option, I've been using it. The pip provider can inherit proxy settings from the environment, can't recall how but I frequently use it on nodes behind a proxy.

@lukebigum
Copy link
Contributor Author

@tux-o-matic, the ability to proxy may help some people, but that's still not the point. My EPEL repository is already on the box, put there with Pulp, and it works perfectly fine. I don't need to proxy anything, nor do I need this module to help me manage EPEL, which is the real issue. This module assumes too much. It is trying to be too helpful. Dare I say... It's like the Microsoft Word Paperclip :-)

There are many good examples of modules that by default try to by helpful and set up lots of for you, but still allow you to disable this functionality if you have the need to do it yourself. ajcrowe/supervisord is one good example.

I'm all for being helpful, but at least allow me to turn it off, or merge my PR that allows me to turn it off ;-)

@tux-o-matic
Copy link

I agree, it's trying to do too much by default.

@lukebigum
Copy link
Contributor Author

Shameless bump. Both this PR and #166 are trying to make this module less tightly coupled. Anyone want to merge or provide additional feedback on either?

@tux-o-matic
Copy link

@lukebigum, you can take your PR further. I made a whole new module to install Puppetboard so I'm no longer using this module .

@wyardley
Copy link
Contributor

@alexjfisher anything remaining that needs to be changed for this one?

@wyardley wyardley added the enhancement New feature or request label Sep 17, 2017
@@ -54,6 +54,7 @@
$python_loglevel = 'info'
$python_proxy = false
$python_index = false
$python_use_epel = true
Copy link
Member

Choose a reason for hiding this comment

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

What does this do? You are defaulting to undef in init.pp not $::puppetboard::params::python_use_epel

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 just needs coming out.

@lukebigum
Copy link
Contributor Author

Good spot, left over from a previous change. Removed the unused variable and also fixed a rubocop merge conflict.

@ekohl
Copy link
Member

ekohl commented Oct 19, 2017

It looks like you merged master. It would help reviewing if you rebased on master instead.

@lukebigum
Copy link
Contributor Author

Fixed my poor merge, please let me know any other feedback.

.rubocop.yml Outdated
@@ -527,6 +528,10 @@ RSpec/NestedGroups:
Layout/IndentHeredoc:
Enabled: False

Rspec/IteratedExpectation:
Copy link
Contributor

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 is necessary now, .rubocop.yml is managed by modulesync, but current master doesn't have any rubocop warnings, so as long as this PR didn't change spec_helper_acceptance, shouldn't be necessary.

For some reason, I don't see this when I check out the PR locally.

…ge EPEL or not - useful for environments that mirror EPEL internally.
@lukebigum
Copy link
Contributor Author

You are right, I've removed the rubocop change and it still passes.

@alexjfisher alexjfisher merged commit 1181bd4 into voxpupuli:master Oct 24, 2017
@alexjfisher
Copy link
Member

Thanks @lukebigum!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants