Skip to content

Instantly share code, notes, and snippets.

@QuingKhaos
Last active August 29, 2015 14:24
Show Gist options
  • Save QuingKhaos/82f568f6f60a70383267 to your computer and use it in GitHub Desktop.
Save QuingKhaos/82f568f6f60a70383267 to your computer and use it in GitHub Desktop.
Puppet facter to extract the installed version of a composer package
# 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