From d384478c0645ab1fbf069389460a2f80b4b0fbe0 Mon Sep 17 00:00:00 2001 From: Gordon Franke Date: Tue, 5 Jan 2016 15:30:05 +0100 Subject: [PATCH] add chef installer for suse --- .../chef/cap/suse/chef_install.rb | 27 +++++++++++++++++++ plugins/provisioners/chef/plugin.rb | 5 ++++ 2 files changed, 32 insertions(+) create mode 100644 plugins/provisioners/chef/cap/suse/chef_install.rb diff --git a/plugins/provisioners/chef/cap/suse/chef_install.rb b/plugins/provisioners/chef/cap/suse/chef_install.rb new file mode 100644 index 000000000..c6cedcefe --- /dev/null +++ b/plugins/provisioners/chef/cap/suse/chef_install.rb @@ -0,0 +1,27 @@ +require_relative "../../omnibus" + +module VagrantPlugins + module Chef + module Cap + module Suse + module ChefInstall + def self.chef_install(machine, project, version, channel, options = {}) + unless curl?(machine) + machine.communicate.sudo("zypper -n -q update") + machine.communicate.sudo("zypper -n -q install curl") + end + + command = Omnibus.sh_command(project, version, channel, options) + machine.communicate.sudo(command) + end + + protected + + def self.curl?(machine) + machine.communicate.test("/usr/bin/which -s curl") + end + end + end + end + end +end diff --git a/plugins/provisioners/chef/plugin.rb b/plugins/provisioners/chef/plugin.rb index f7af36138..48a51e031 100644 --- a/plugins/provisioners/chef/plugin.rb +++ b/plugins/provisioners/chef/plugin.rb @@ -78,6 +78,11 @@ module VagrantPlugins Cap::Redhat::ChefInstall end + guest_capability(:suse, :chef_install) do + require_relative "cap/suse/chef_install" + Cap::Suse::ChefInstall + end + guest_capability(:windows, :chef_install) do require_relative "cap/windows/chef_install" Cap::Windows::ChefInstall