From 79e5298e706d534e3c9dc9bd4c66fefd2bfce0a4 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Fri, 12 Jul 2013 10:47:13 -0500 Subject: [PATCH] Add ability to specify custom cfengine pacakge name This is intended to allow adding support for installing CFEngine Enterprise. --- .../provisioners/cfengine/cap/debian/cfengine_install.rb | 2 +- .../provisioners/cfengine/cap/redhat/cfengine_install.rb | 2 +- plugins/provisioners/cfengine/config.rb | 6 ++++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/cfengine/cap/debian/cfengine_install.rb b/plugins/provisioners/cfengine/cap/debian/cfengine_install.rb index f57522abf..57c235654 100644 --- a/plugins/provisioners/cfengine/cap/debian/cfengine_install.rb +++ b/plugins/provisioners/cfengine/cap/debian/cfengine_install.rb @@ -9,7 +9,7 @@ module VagrantPlugins comm.sudo("GPGFILE=`tempfile`; wget -O $GPGFILE #{config.repo_gpg_key_url} && apt-key add $GPGFILE; rm -f $GPGFILE") comm.sudo("apt-get update") - comm.sudo("apt-get install -y cfengine-community") + comm.sudo("apt-get install -y #{config.package_name}") end end end diff --git a/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb b/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb index 820886f4d..828b336d6 100644 --- a/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb +++ b/plugins/provisioners/cfengine/cap/redhat/cfengine_install.rb @@ -14,7 +14,7 @@ module VagrantPlugins logger.info("Installing CFEngine Community Yum Repository GPG KEY from #{config.repo_gpg_key_url}") comm.sudo("GPGFILE=$(mktemp) && wget -O $GPGFILE #{config.repo_gpg_key_url} && rpm --import $GPGFILE; rm -f $GPGFILE") - comm.sudo("yum -y install cfengine-community") + comm.sudo("yum -y install #{config.package_name}") end end end diff --git a/plugins/provisioners/cfengine/config.rb b/plugins/provisioners/cfengine/config.rb index 9ecff81dd..5d3cd3f02 100644 --- a/plugins/provisioners/cfengine/config.rb +++ b/plugins/provisioners/cfengine/config.rb @@ -20,6 +20,7 @@ module VagrantPlugins attr_accessor :upload_path attr_accessor :yum_repo_file attr_accessor :yum_repo_url + attr_accessor :package_name def initialize @am_policy_hub = UNSET_VALUE @@ -37,6 +38,7 @@ module VagrantPlugins @upload_path = UNSET_VALUE @yum_repo_file = UNSET_VALUE @yum_repo_url = UNSET_VALUE + @package_name = UNSET_VALUE end def finalize! @@ -81,6 +83,10 @@ module VagrantPlugins if @yum_repo_url == UNSET_VALUE @yum_repo_url = "http://cfengine.com/pub/yum/" end + + if @package_name == UNSET_VALUE + @package_name = "cfengine-community" + end end def validate(machine)