vagrant-guest-omnios 0.0.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +5 -3
- data/lib/vagrant-guest-omnios/cap/chef_install.rb +19 -0
- data/lib/vagrant-guest-omnios/cap/chef_installed.rb +20 -0
- data/lib/vagrant-guest-omnios/cap/insert_public_key.rb +21 -0
- data/lib/vagrant-guest-omnios/cap/mount_nfs_folder.rb +15 -0
- data/lib/vagrant-guest-omnios/cap/remove_public_key.rb +21 -0
- data/lib/vagrant-guest-omnios/plugin.rb +26 -0
- metadata +13 -8
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
vagrant-guest-omnios
|
2
2
|
========================
|
3
3
|
|
4
|
-
A Vagrant 1.
|
4
|
+
A Vagrant 1.7+ plugin to provide support for the OmniOS operating system.
|
5
5
|
|
6
|
-
This code is
|
7
|
-
|
6
|
+
This code is a modified fork of the omnios plugin by mitchellh at https://github.com/mitchellh/vagrant/tree/1.7.2/plugins/guests/omnios/plugin.rb.
|
7
|
+
|
8
|
+
* It adds the support for the chef_install and chef_installed guest capabilities submitted in PR #5179. Once that PR is merged, there is no need to use this plugin.
|
9
|
+
* It adds support for the insert_public_key and remove_public_key guest capabilities submitted in PR #5182. Once that PR is merged, there is no need to use this plugin.
|
8
10
|
|
9
11
|
See LICENSE.
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# require_relative "../../omnibus"
|
2
|
+
require Vagrant.source_root.to_s + '/plugins/provisioners/chef/omnibus'
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module GuestOmniOS
|
6
|
+
module Cap
|
7
|
+
module ChefInstall
|
8
|
+
def self.chef_install(machine, version, prerelease, download_path)
|
9
|
+
su_cmd = machine.config.solaris.suexec_cmd
|
10
|
+
|
11
|
+
machine.communicate.execute("#{su_cmd} pkg list --no-refresh web/curl > /dev/null 2>&1 || pkg install -q --accept web/curl")
|
12
|
+
|
13
|
+
command = VagrantPlugins::Chef::Omnibus.build_command(version, prerelease, download_path)
|
14
|
+
machine.communicate.execute(su_cmd + ' ' + command)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOmniOS
|
3
|
+
module Cap
|
4
|
+
module ChefInstalled
|
5
|
+
# Check if Chef is installed at the given version.
|
6
|
+
# @return [true, false]
|
7
|
+
def self.chef_installed(machine, version)
|
8
|
+
knife = "/opt/chef/bin/knife"
|
9
|
+
command = "test -x #{knife}"
|
10
|
+
|
11
|
+
if version != :latest
|
12
|
+
command << "&& #{knife} --version | grep 'Chef: #{version}'"
|
13
|
+
end
|
14
|
+
|
15
|
+
machine.communicate.test(command, sudo: true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "vagrant/util/shell_quote"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestOmniOS
|
5
|
+
module Cap
|
6
|
+
class InsertPublicKey
|
7
|
+
def self.insert_public_key(machine, contents)
|
8
|
+
contents = contents.chomp
|
9
|
+
contents = Vagrant::Util::ShellQuote.escape(contents, "'")
|
10
|
+
|
11
|
+
machine.communicate.tap do |comm|
|
12
|
+
comm.execute("mkdir -p ~/.ssh")
|
13
|
+
comm.execute("chmod 0700 ~/.ssh")
|
14
|
+
comm.execute("printf '#{contents}\\n' >> ~/.ssh/authorized_keys")
|
15
|
+
comm.execute("chmod 0600 ~/.ssh/authorized_keys")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module VagrantPlugins
|
2
|
+
module GuestOmniOS
|
3
|
+
module Cap
|
4
|
+
class MountNFSFolder
|
5
|
+
def self.mount_nfs_folder(machine, ip, folders)
|
6
|
+
su_cmd = machine.config.solaris.suexec_cmd
|
7
|
+
folders.each do |name, opts|
|
8
|
+
machine.communicate.execute("#{su_cmd} mkdir -p #{opts[:guestpath]}")
|
9
|
+
machine.communicate.execute("#{su_cmd} /sbin/mount '#{ip}:#{opts[:hostpath]}' '#{opts[:guestpath]}'")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require "vagrant/util/shell_quote"
|
2
|
+
|
3
|
+
module VagrantPlugins
|
4
|
+
module GuestOmniOS
|
5
|
+
module Cap
|
6
|
+
class RemovePublicKey
|
7
|
+
def self.remove_public_key(machine, contents)
|
8
|
+
contents = contents.chomp
|
9
|
+
contents = Vagrant::Util::ShellQuote.escape(contents, "'")
|
10
|
+
|
11
|
+
machine.communicate.tap do |comm|
|
12
|
+
if comm.test("test -f ~/.ssh/authorized_keys")
|
13
|
+
comm.execute(
|
14
|
+
"sed -i '/^.*#{contents}.*$/d' ~/.ssh/authorized_keys")
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -15,6 +15,32 @@ module VagrantPlugins
|
|
15
15
|
require_relative "cap/change_host_name"
|
16
16
|
Cap::ChangeHostName
|
17
17
|
end
|
18
|
+
|
19
|
+
guest_capability("omnios", "mount_nfs_folder") do
|
20
|
+
require_relative "cap/mount_nfs_folder"
|
21
|
+
Cap::MountNFSFolder
|
22
|
+
end
|
23
|
+
|
24
|
+
guest_capability(:omnios, :chef_installed) do
|
25
|
+
require_relative "cap/chef_installed"
|
26
|
+
Cap::ChefInstalled
|
27
|
+
end
|
28
|
+
|
29
|
+
guest_capability(:omnios, :chef_install) do
|
30
|
+
require_relative "cap/chef_install"
|
31
|
+
Cap::ChefInstall
|
32
|
+
end
|
33
|
+
|
34
|
+
guest_capability(:omnios, :insert_public_key) do
|
35
|
+
require_relative "cap/insert_public_key"
|
36
|
+
Cap::InsertPublicKey
|
37
|
+
end
|
38
|
+
|
39
|
+
guest_capability(:omnios, :remove_public_key) do
|
40
|
+
require_relative "cap/remove_public_key"
|
41
|
+
Cap::RemovePublicKey
|
42
|
+
end
|
43
|
+
|
18
44
|
end
|
19
45
|
end
|
20
46
|
end
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-guest-omnios
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
- Mitchell Hashimoto
|
8
|
+
- Mitchell Hashimoto, Mark Harrison, Clinton Wolfe
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-01-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: Vagrant 1.
|
14
|
+
description: Vagrant 1.7+ plugin to provide guest support for omnios (interim prior
|
15
15
|
to core support), yep.
|
16
16
|
email: info@hashicorp.com
|
17
17
|
executables: []
|
@@ -19,10 +19,15 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- README.md
|
22
|
-
- lib/vagrant-guest-omnios.rb
|
23
22
|
- lib/vagrant-guest-omnios/guest.rb
|
24
|
-
- lib/vagrant-guest-omnios/cap/change_host_name.rb
|
25
23
|
- lib/vagrant-guest-omnios/plugin.rb
|
24
|
+
- lib/vagrant-guest-omnios/cap/mount_nfs_folder.rb
|
25
|
+
- lib/vagrant-guest-omnios/cap/remove_public_key.rb
|
26
|
+
- lib/vagrant-guest-omnios/cap/change_host_name.rb
|
27
|
+
- lib/vagrant-guest-omnios/cap/chef_install.rb
|
28
|
+
- lib/vagrant-guest-omnios/cap/insert_public_key.rb
|
29
|
+
- lib/vagrant-guest-omnios/cap/chef_installed.rb
|
30
|
+
- lib/vagrant-guest-omnios.rb
|
26
31
|
homepage: http://github.com/clintoncwolfe/vagrant-guest-omnios
|
27
32
|
licenses: []
|
28
33
|
post_install_message:
|
@@ -43,9 +48,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
48
|
version: '0'
|
44
49
|
requirements: []
|
45
50
|
rubyforge_project: vagrant-guest-omnios
|
46
|
-
rubygems_version: 1.8.
|
51
|
+
rubygems_version: 1.8.23
|
47
52
|
signing_key:
|
48
53
|
specification_version: 3
|
49
|
-
summary: Vagrant 1.
|
54
|
+
summary: Vagrant 1.7+ plugin to provide guest support for omnios (interim prior to
|
50
55
|
core support)
|
51
56
|
test_files: []
|