Add chef_install(ed?) guest capability for omnios
This commit is contained in:
parent
5b716d1623
commit
17a0d08040
|
@ -0,0 +1,20 @@
|
|||
require_relative "../../omnibus"
|
||||
|
||||
module VagrantPlugins
|
||||
module Chef
|
||||
module Cap
|
||||
module OmniOS
|
||||
module ChefInstall
|
||||
def self.chef_install(machine, version, prerelease, download_path)
|
||||
su_cmd = machine.config.solaris.suexec_cmd
|
||||
|
||||
machine.communicate.execute("#{su_cmd} pkg list --no-refresh web/curl > /dev/null 2>&1 || pkg install -q --accept web/curl")
|
||||
|
||||
command = VagrantPlugins::Chef::Omnibus.build_command(version, prerelease, download_path)
|
||||
machine.communicate.execute(su_cmd + ' ' + command)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,23 @@
|
|||
module VagrantPlugins
|
||||
module Chef
|
||||
module Cap
|
||||
module OmniOS
|
||||
module ChefInstalled
|
||||
# TODO: this is the same code as cap/linux/chef_installed, consider merging
|
||||
# Check if Chef is installed at the given version.
|
||||
# @return [true, false]
|
||||
def self.chef_installed(machine, version)
|
||||
knife = "/opt/chef/bin/knife"
|
||||
command = "test -x #{knife}"
|
||||
|
||||
if version != :latest
|
||||
command << "&& #{knife} --version | grep 'Chef: #{version}'"
|
||||
end
|
||||
|
||||
machine.communicate.test(command, sudo: true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -67,6 +67,17 @@ module VagrantPlugins
|
|||
require_relative "cap/redhat/chef_install"
|
||||
Cap::Redhat::ChefInstall
|
||||
end
|
||||
|
||||
guest_capability(:omnios, :chef_installed) do
|
||||
require_relative "cap/omnios/chef_installed"
|
||||
Cap::OmniOS::ChefInstalled
|
||||
end
|
||||
|
||||
guest_capability(:omnios, :chef_install) do
|
||||
require_relative "cap/omnios/chef_install"
|
||||
Cap::OmniOS::ChefInstall
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue