Last active
August 29, 2015 14:24
-
-
Save QuingKhaos/82f568f6f60a70383267 to your computer and use it in GitHub Desktop.
Puppet facter to extract the installed version of a composer package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapt the variable name "package_version", the path of composer and the composer package name to your needs | |
Facter.add("package_version") do | |
setcode do | |
Facter::Util::Resolution.exec('/bin/bash -c "cd /var/www/my_project && [[ -f composer.lock ]] && /usr/local/bin/composer show -i acme/package | grep versions | awk \'{print \\$4}\'"') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment