> On Apr 22, 2016, at 11:04 AM, [email protected] wrote:
>
> Hi all,
>
> I am trying to manage python packages from puppet.I wanted to run the
> following commands without using EXEC..
>
> After installing python-setuptools i tried to install pika using pip as
> provider .. but it did not work.
>
> What is the best way to puppetize this??
>
> Thank You
> Bapi
>
>
> sudo yum install python-setuptools
>
> sudo easy-install pip
>
> sudo easy-install argparse
>
> sudo /usr/bin/pip install pika
>
Since puppet runs as root, generally, you wouldn’t need the sudo for these
commands.
Note, I’m not a python guy, so testing for the install of these may or may not
work this way, since if these eggs are apps, they’ll likely not have modules
with the same name as the driver script...
Anyway, back to your question, if I were doing this, and couldn’t use the
number of existing options on the forge for whatever reason, I’d do something
like this:
--- puppet code ---
# should really get this from some other source instead of hard-coding it...
PYTHON_PREFIX = “/usr"
# same for the package name.
package { “python-setuptools”:
ensure => installed,
provider => yum
}
exec { “pip_install”:
command => “$PYTHON_PREFIX/bin/easy-install pip”,
require => Package[ ‘python-setuptools’,
unless => “test -x /usr/bin/pip"
}
exec { “argparse_install":
command => “$PYTHON_PREFIX/bin/easy-install argparse”,
require => Exec[ ‘pip_install’ ],
unless => 'python -c “import argparse” &> /dev/null'
}
exec { “pika_install”:
command => “$PYTHON_PREFIX/bin/pip install pika”,
require => Exec[ ‘pip_install’ ],
unless => 'python -c “import pika” &> /dev/null'
}
--- end of puppet code ---
Note that these kinds of chains can be fragile if not tested well for your
environment.
--
Gary L. Greene, Jr.
==============================================================================
Volunteer developer of the KDE F/OSS project and Project Lead for AltimatOS
http://www.kde.org/ <http://www.kde.org/>
http://www.altimatos.com/ <http://www.altimatos.com/>
==============================================================================
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/F8A2A601-6964-4E23-B237-72ACE1902F55%40tolharadys.net.
For more options, visit https://groups.google.com/d/optout.