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
==============================================================================