On 2015-05-10 8:51, Fabien Delpierre wrote:
Hey folks,
I have something like this in a manifest:

class foo(
   $python_pips   = {
     pbr => { ensure => '1.3.0', install_args => ['-I'] },
     linecache2 => { ensure => '1.0.0', install_args => ['-I'] },
     elasticsearch => { ensure => '1.6.0', install_args => ['-I'] },
   },
   ) {
   require python
   create_resources('python::pip', $python_pips)
}

I'm using this module: https://github.com/stankevich/puppet-python

I'm wondering if there's a more elegant way of telling the python::pip
resource to use the -I flag when installing those three pip packages.
It's going to get even uglier since the $python_pips variable will
ultimately live in Hiera, and I have some environments that require a
proxy to access the Internet, so in Hiera for those environments it's
going to look like this:

foo::python_pips:
   "pbr":
     ensure: 1.3.0
     install_args: ['-I']
     proxy: 'http://proxy.example.com:3128";
   "linecache2":
     ensure: 1.0.0
     install_args: ['-I']
     proxy: "http://proxy.example.com:3128";
   "elasticsearch":
     ensure: 1.6.0
     install_args: ['-I']
     proxy: "http://proxy.example.com:3128";

I don't like all this repetition. Wanted to double check if I can make
this easier on the eyes before I move on.
I appreciate any input!


If you are using 3.x with parser=future, or 4.x you can do like this:

python::pip {
  default:
    install_args => ['-I'],
    proxy        => 'http://proxy.example.com:3128' ;

  "pbr":           ensure => '1.3.0' ;
  "linecached":    ensure => '1.0.0' ;
  "elasticsearch": ensure => '1.6.0' ;
}

The 'default' title defines attributes that are common to all other bodies in the same resource expression.


- henrik

--
You received this message because you are subscribed to the Google
Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to puppet-users+unsubscr...@googlegroups.com
<mailto:puppet-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/aa823d3e-71bd-4cba-887c-d044656d945a%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/aa823d3e-71bd-4cba-887c-d044656d945a%40googlegroups..com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.


--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/muuune%24i62%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to