vagrant-guests-solaris11 0.0.1a
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +54 -0
- data/Gemfile +17 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +38 -0
- data/VERSION +1 -0
- data/develop.md +64 -0
- data/lib/vagrant-guests-solaris11.rb +1 -0
- data/lib/vagrant-guests-solaris11/cap/change_host_name.rb +21 -0
- data/lib/vagrant-guests-solaris11/cap/configure_networks.rb +31 -0
- data/lib/vagrant-guests-solaris11/cap/halt.rb +25 -0
- data/lib/vagrant-guests-solaris11/cap/mount_virtualbox_shared_folder.rb +32 -0
- data/lib/vagrant-guests-solaris11/guest.rb +15 -0
- data/lib/vagrant-guests-solaris11/plugin.rb +51 -0
- data/spec/cap/change_host_name_spec.rb +23 -0
- data/spec/cap/halt_spec.rb +11 -0
- data/spec/guest_spec.rb +11 -0
- data/spec/plugin_spec.rb +28 -0
- data/spec/spec_helper.rb +12 -0
- data/vagrant-solaris11.gemspec +75 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTQwZjFmMGY4OTMwOWEzZDdmYjk1NTdmN2I0ZDIwYTc1NzhmYTNhYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Y2UzYWVjYTNjZTljMDA1NDU4MjIzZjVlMGM4NjM2ZDgzYjdmZGEwZA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmUxNDg1OWRkYWM4Mzg0MWQyZjg4N2M1YzZhMGVhMmM0NjIxNmYxOWI1OGM2
|
10
|
+
MmRkNTE0YWNlYTM0MmFlZTlmZTM0NjQxNWFlNTQ0MGMwZTIzMzhkNThkZWUz
|
11
|
+
MGM5ZDEzZDA5NGI3MjJiNGZhYjgxNjQxMjY5NWRiM2JmNzk5Nzk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjEzNjNlMDhjMjY3M2ExODU1YmZiNmY3NWFiODcxM2U1YzM0ZWMwNTY0ZjE2
|
14
|
+
ZjVhMWNhN2MwNjU0YjViZGY1ZDRhYjU1ZTZiMjUwYzY5ZjkyZTM2MzNjYjZi
|
15
|
+
OTRiMTM3NTNhMmE5M2JlZTk0NzFlNDg0NzE2NGNmZjYwMDkwZjQ=
|
data/.gitignore
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
# OS-specific
|
2
|
+
.DS_Store
|
3
|
+
|
4
|
+
# Vim
|
5
|
+
*.swp
|
6
|
+
*.un~
|
7
|
+
|
8
|
+
# Bundler/Rubygems
|
9
|
+
*.gem
|
10
|
+
.bundle
|
11
|
+
pkg/*
|
12
|
+
tags
|
13
|
+
Gemfile.lock
|
14
|
+
test/tmp
|
15
|
+
|
16
|
+
# Vagrant
|
17
|
+
.vagrant
|
18
|
+
Vagrantfile
|
19
|
+
|
20
|
+
|
21
|
+
# Documentation
|
22
|
+
_site/*
|
23
|
+
.yardoc/
|
24
|
+
_yardoc
|
25
|
+
doc/
|
26
|
+
|
27
|
+
# Python
|
28
|
+
*.pyc
|
29
|
+
|
30
|
+
# Rubinius
|
31
|
+
*.rbc
|
32
|
+
|
33
|
+
# IDE junk
|
34
|
+
.idea/*
|
35
|
+
*.iml
|
36
|
+
|
37
|
+
# Ruby Managers
|
38
|
+
.rbenv
|
39
|
+
.ruby-gemset
|
40
|
+
.ruby-version
|
41
|
+
.rvmrc
|
42
|
+
|
43
|
+
# Other
|
44
|
+
*.rbc
|
45
|
+
.config
|
46
|
+
|
47
|
+
InstalledFiles
|
48
|
+
coverage
|
49
|
+
lib/bundler/man
|
50
|
+
|
51
|
+
rdoc
|
52
|
+
spec/reports
|
53
|
+
test/version_tmp
|
54
|
+
tmp
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in vagrant-guests-solaris11.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
# We depend on Vagrant for development, but we don't add it as a
|
8
|
+
# gem dependency because we expect to be installed within the
|
9
|
+
# Vagrant environment itself using `vagrant plugin`.
|
10
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
11
|
+
|
12
|
+
gem "shoulda", ">= 0"
|
13
|
+
gem "rdoc"
|
14
|
+
gem "bundler", "~> 1.0"
|
15
|
+
gem "jeweler", "~> 1.8.7"
|
16
|
+
gem "version"
|
17
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TANABE Ken-ichi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
|
2
|
+
## Vagrant Oracle Solaris 11 guest Provider
|
3
|
+
|
4
|
+
Vagrant >= 1.x has a built-in Oracle Solaris plugin, but the plugin lacks the ability to set hostname and confgure network on Oracle Solaris 11+
|
5
|
+
|
6
|
+
This is a [Vagrant](http://www.vagrantup.com) 1.2+ plugin that adds an [Solaris 11](http://www.oracle.com/us/products/servers-storage/solaris/solaris11/overview/index.html)
|
7
|
+
guest to Vagrant, allowing Vagrant to control Oracle Solaris 11.
|
8
|
+
|
9
|
+
**NOTE:** This plugin requires Vagrant 1.2+,
|
10
|
+
|
11
|
+
### Installation
|
12
|
+
with vagrant plugin from http://rubygems.org/
|
13
|
+
|
14
|
+
```bash
|
15
|
+
vagrant plugin install vagrant-guests-solaris11
|
16
|
+
```
|
17
|
+
|
18
|
+
### Features
|
19
|
+
|
20
|
+
* Set hostname and configure network in Oracle Solaris 11.
|
21
|
+
|
22
|
+
### Usage
|
23
|
+
Add this line to your Vagrantfile:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Vagrant.require_plugin "vagrant-guests-solaris11"
|
27
|
+
Vagrant.configure("2") do |config|
|
28
|
+
config.vm.guest = :solaris11
|
29
|
+
```
|
30
|
+
|
31
|
+
### Changelog
|
32
|
+
|
33
|
+
##### 0.0.1 (2013-08-25)
|
34
|
+
|
35
|
+
* Initial release
|
36
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Immediately sync all stdout so that tools like buildbot can immediately load in the output.
|
4
|
+
$stdout.sync = true
|
5
|
+
$stderr.sync = true
|
6
|
+
|
7
|
+
# Change to the directory of this file.
|
8
|
+
Dir.chdir(File.expand_path("../", __FILE__))
|
9
|
+
|
10
|
+
require 'rubygems'
|
11
|
+
require 'bundler'
|
12
|
+
|
13
|
+
begin
|
14
|
+
Bundler.setup(:default, :development)
|
15
|
+
rescue Bundler::BundlerError => e
|
16
|
+
$stderr.puts e.message
|
17
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
18
|
+
exit e.status_code
|
19
|
+
end
|
20
|
+
require 'bundler/setup'
|
21
|
+
|
22
|
+
# For gem creation and bundling
|
23
|
+
require "bundler/gem_tasks"
|
24
|
+
require 'rspec/core/rake_task'
|
25
|
+
require 'rake'
|
26
|
+
require 'rake/clean'
|
27
|
+
require 'rake/version_task'
|
28
|
+
Rake::VersionTask.new
|
29
|
+
|
30
|
+
# This installs the tasks that help with gem creation and publishing.
|
31
|
+
Bundler::GemHelper.install_tasks
|
32
|
+
|
33
|
+
|
34
|
+
# Install the `spec` task so that we can run tests.
|
35
|
+
RSpec::Core::RakeTask.new
|
36
|
+
|
37
|
+
# Default task is to run the unit tests
|
38
|
+
task :default => "spec"
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.1a
|
data/develop.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
### Development
|
2
|
+
|
3
|
+
To work on the `vagrant-guests-solaris11` plugin, clone [this repository
|
4
|
+
out](https://github.com/janth/vagrant-guests-solaris11), and use
|
5
|
+
[Bundler](http://gembundler.com) to get the dependencies:
|
6
|
+
|
7
|
+
```bash
|
8
|
+
bundle
|
9
|
+
```
|
10
|
+
|
11
|
+
Once you have the dependencies, verify the unit tests pass with `rake`:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
bundle exec rake
|
15
|
+
```
|
16
|
+
|
17
|
+
Other rake commands:
|
18
|
+
```bash
|
19
|
+
bundle exec rake --tasks
|
20
|
+
bundle exec rake --trace build
|
21
|
+
bundle exec rake --trace install
|
22
|
+
bundle exec rake --trace release
|
23
|
+
```
|
24
|
+
|
25
|
+
|
26
|
+
If those pass, you're ready to start developing the plugin. You can test
|
27
|
+
the plugin without installing it into your Vagrant environment by just
|
28
|
+
creating a `Vagrantfile` in the top level of this directory (it is gitignored)
|
29
|
+
and add the following line to your `Vagrantfile`
|
30
|
+
```ruby
|
31
|
+
Vagrant.require_plugin "vagrant-guests-solaris11"
|
32
|
+
```
|
33
|
+
Use bundler to execute Vagrant:
|
34
|
+
```bash
|
35
|
+
bundle exec vagrant up <vagranthost>
|
36
|
+
```
|
37
|
+
### Cleanup
|
38
|
+
|
39
|
+
```bash
|
40
|
+
bundle exec rake clobber
|
41
|
+
```
|
42
|
+
|
43
|
+
### Similar projects
|
44
|
+
|
45
|
+
* [vagrant-guests-openbsd](https://github.com/nabeken/vagrant-guests-openbsd.git)
|
46
|
+
|
47
|
+
### Fork
|
48
|
+
|
49
|
+
<!--
|
50
|
+
https://github.com/jamesflorentino/fork-ribbons/blob/master/README.md
|
51
|
+
https://github.com/aral/fork-me-on-github-retina-ribbons/blob/master/readme.md
|
52
|
+
https://github.com/simonwhitaker/github-fork-ribbon-css
|
53
|
+
https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet
|
54
|
+
-->
|
55
|
+
|
56
|
+
<a href="https://github.com/janth/vagrant-guests-solarsi11/"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>
|
57
|
+
<a href="https://github.com/janth/vagrant-guests-solaris11"><img style="position: absolute; top: 0; right: 30px; border: 0;" src="https://github.com/jamesflorentino/fork-ribbons/raw/master/ribbons/green-white.png" alt="Fork me on GitHub"></a>
|
58
|
+
|
59
|
+
<!-- BOTTOM RIGHT RIBBON: START COPYING HERE -->
|
60
|
+
<div class="github-fork-ribbon-wrapper right-bottom">
|
61
|
+
<div class="github-fork-ribbon">
|
62
|
+
<a href="https://github.com/simonwhitaker/github-fork-ribbon-css">Fork me on GitHub</a>
|
63
|
+
</div>
|
64
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
require "vagrant-guests-solaris11/plugin"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestSolaris11
|
7
|
+
module Cap
|
8
|
+
class ChangeHostName
|
9
|
+
def self.change_host_name(machine, name)
|
10
|
+
# Only do this if the hostname is not already set
|
11
|
+
if !machine.communicate.test("/usr/sbin/svccfg -s system/identity:node listprop config/nodename | /usr/bin/grep '#{name}'")
|
12
|
+
machine.communicate.sudo("/usr/sbin/svccfg -s system/identity:node setprop config/nodename=\"#{name}\"")
|
13
|
+
machine.communicate.sudo("/usr/sbin/svccfg -s system/identity:node setprop config/loopback=\"#{name}\"")
|
14
|
+
machine.communicate.sudo("/usr/sbin/svccfg -s system/identity:node refresh ")
|
15
|
+
machine.communicate.sudo("/usr/sbin/svcadm restart system/identity:node ")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestSolaris11
|
7
|
+
module Cap
|
8
|
+
class ConfigureNetworks
|
9
|
+
def self.configure_networks(machine, networks)
|
10
|
+
networks.each do |network|
|
11
|
+
device = "#{machine.config.solaris11.device}#{network[:interface]}"
|
12
|
+
mask = "#{network[:netmask]}"
|
13
|
+
# Convert netmask 255.255.x.y to CIDR /nn
|
14
|
+
cidr = mask.split(".").map { |e| e.to_i.to_s(2).rjust(8, "0") }.join.count("1").to_s
|
15
|
+
#ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
|
16
|
+
#machine.communicate.execute("#{ifconfig_cmd} plumb")
|
17
|
+
if network[:type].to_sym == :static
|
18
|
+
#machine.communicate.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
|
19
|
+
#machine.communicate.execute("#{ifconfig_cmd} up")
|
20
|
+
#machine.communicate.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
|
21
|
+
# ipadm create-addr -T static -a local=172.16.10.15/24 net2/v4
|
22
|
+
machine.communicate.sudo("ipadm create-addr -T static -a #{network[:ip]}/#{cidr} #{device}/v4")
|
23
|
+
elsif network[:type].to_sym == :dhcp
|
24
|
+
machine.communicate.sudo("ipadm create-addr -T addrconf #{device}/v4")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestSolaris11
|
7
|
+
module Cap
|
8
|
+
class Halt
|
9
|
+
def self.halt(machine)
|
10
|
+
# There should be an exception raised if the line
|
11
|
+
#
|
12
|
+
# vagrant::::profiles=Primary Administrator
|
13
|
+
#
|
14
|
+
# does not exist in /etc/user_attr. TODO
|
15
|
+
begin
|
16
|
+
machine.communicate.sudo("/usr/sbin/shutdown -y -i5 -g0")
|
17
|
+
rescue IOError
|
18
|
+
# Ignore, this probably means connection closed because it
|
19
|
+
# shut down.
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
module VagrantPlugins
|
6
|
+
module GuestSolaris11
|
7
|
+
module Cap
|
8
|
+
class MountVirtualBoxSharedFolder
|
9
|
+
def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
|
10
|
+
# These are just far easier to use than the full options syntax
|
11
|
+
owner = options[:owner]
|
12
|
+
group = options[:group]
|
13
|
+
|
14
|
+
# Create the shared folder
|
15
|
+
machine.communicate.sudo("mkdir -p #{guestpath}")
|
16
|
+
|
17
|
+
# We have to use this `id` command instead of `/usr/bin/id` since this
|
18
|
+
# one accepts the "-u" and "-g" flags.
|
19
|
+
id_cmd = "/usr/xpg4/bin/id"
|
20
|
+
|
21
|
+
# Mount the folder with the proper owner/group
|
22
|
+
mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`"
|
23
|
+
mount_options += ",#{options[:extra]}" if options[:extra]
|
24
|
+
machine.communicate.sudo("/sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")
|
25
|
+
|
26
|
+
# chown the folder to the proper owner/group
|
27
|
+
machine.communicate.sudo("chown `#{id_cmd} -u #{owner}`:`#{id_cmd} -g #{group}` #{guestpath}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
require "vagrant"
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module GuestSolaris11
|
9
|
+
class Guest < Vagrant.plugin("2", :guest)
|
10
|
+
def detect?(machine)
|
11
|
+
machine.communicate.test('[ "$(uname -s)" = "SunOS" ]')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# A general Vagrant system implementation for "solaris 11".
|
2
|
+
#
|
3
|
+
# Contributed by Jan Thomas Moldung <janth@moldung.no>
|
4
|
+
|
5
|
+
require "vagrant"
|
6
|
+
|
7
|
+
module VagrantPlugins
|
8
|
+
module GuestSolaris11
|
9
|
+
class Plugin < Vagrant.plugin("2")
|
10
|
+
name "Solaris 11 guest"
|
11
|
+
description "Oracle Solaris 11 guest support."
|
12
|
+
|
13
|
+
#config("solaris11") do
|
14
|
+
# require File.expand_path("../config", __FILE__)
|
15
|
+
# Config
|
16
|
+
#end
|
17
|
+
|
18
|
+
guest("solaris11") do
|
19
|
+
#require File.expand_path("../guest", __FILE__)
|
20
|
+
require_relative "guest"
|
21
|
+
Guest
|
22
|
+
end
|
23
|
+
|
24
|
+
guest_capability("solaris11", "change_host_name") do
|
25
|
+
require_relative "cap/change_host_name"
|
26
|
+
Cap::ChangeHostName
|
27
|
+
end
|
28
|
+
|
29
|
+
guest_capability("solaris11", "configure_networks") do
|
30
|
+
require_relative "cap/configure_networks"
|
31
|
+
Cap::ConfigureNetworks
|
32
|
+
end
|
33
|
+
|
34
|
+
guest_capability("solaris11", "halt") do
|
35
|
+
require_relative "cap/halt"
|
36
|
+
Cap::Halt
|
37
|
+
end
|
38
|
+
|
39
|
+
guest_capability("solaris11", "mount_virtualbox_shared_folder") do
|
40
|
+
require_relative "cap/mount_virtualbox_shared_folder"
|
41
|
+
Cap::MountVirtualBoxSharedFolder
|
42
|
+
end
|
43
|
+
|
44
|
+
#guest_capability("solaris11", "mount_nfs_folder") do
|
45
|
+
# require_relative "cap/mount_nfs_folder"
|
46
|
+
# Cap::MountNFSFold
|
47
|
+
#end
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'vagrant-guests-solaris11/cap/change_host_name'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe VagrantPlugins::GuestSolaris11::Cap::ChangeHostName do
|
5
|
+
include_context 'machine'
|
6
|
+
|
7
|
+
it "should change hostname when hostname is differ from current" do
|
8
|
+
name = 'vagrant-solaris11'
|
9
|
+
communicate.stub(:test).and_return(false)
|
10
|
+
communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node setprop config/nodename=\"#{name}\"")
|
11
|
+
communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node setprop config/loopback=\"#{name}\"")
|
12
|
+
communicate.should_receive(:sudo).with("/usr/sbin/svccfg -s system/identity:node refresh ")
|
13
|
+
communicate.should_receive(:sudo).with("/usr/sbin/svcadm restart system/identity:node ")
|
14
|
+
described_class.change_host_name(machine, name)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should not change hostname when hostname equals current" do
|
18
|
+
name = 'vagrant-solaris11'
|
19
|
+
communicate.stub(:test).and_return(true)
|
20
|
+
communicate.should_not_receive(:sudo)
|
21
|
+
described_class.change_host_name(machine, name)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'vagrant-guests-solaris11/cap/halt'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe VagrantPlugins::GuestSolaris11::Cap::Halt do
|
5
|
+
include_context 'machine'
|
6
|
+
|
7
|
+
it "should halt guest using '/usr/sbin/shutdown -y -i5 -g0'" do
|
8
|
+
communicate.should_receive(:sudo).with("/usr/sbin/shutdown -y -i5 -g0")
|
9
|
+
described_class.halt(machine)
|
10
|
+
end
|
11
|
+
end
|
data/spec/guest_spec.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-guests-solaris11/guest'
|
3
|
+
|
4
|
+
describe VagrantPlugins::GuestSolaris11::Guest do
|
5
|
+
include_context 'machine'
|
6
|
+
|
7
|
+
it "should be detected with SunOS" do
|
8
|
+
expect(communicate).to receive(:test).with('[ "$(uname -s)" = "SunOS" ]')
|
9
|
+
guest.detect?(machine)
|
10
|
+
end
|
11
|
+
end
|
data/spec/plugin_spec.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vagrant-guests-solaris11/plugin'
|
3
|
+
require 'vagrant-guests-solaris11/cap/change_host_name'
|
4
|
+
require 'vagrant-guests-solaris11/cap/configure_networks'
|
5
|
+
require 'vagrant-guests-solaris11/cap/halt'
|
6
|
+
require 'vagrant-guests-solaris11/cap/mount_virtualbox_shared_folder'
|
7
|
+
#require 'vagrant-guests-solaris11/cap/mount_nfs_folder'
|
8
|
+
|
9
|
+
describe VagrantPlugins::GuestSolaris11::Plugin do
|
10
|
+
[:solaris11].each do |os|
|
11
|
+
it "should be loaded with #{os}" do
|
12
|
+
expect(described_class.components.guests[os].first).to eq(VagrantPlugins::GuestSolaris11::Guest)
|
13
|
+
end
|
14
|
+
|
15
|
+
{
|
16
|
+
:halt => VagrantPlugins::GuestSolaris11::Cap::Halt,
|
17
|
+
:change_host_name => VagrantPlugins::GuestSolaris11::Cap::ChangeHostName,
|
18
|
+
:configure_networks => VagrantPlugins::GuestSolaris11::Cap::ConfigureNetworks,
|
19
|
+
:mount_virtualbox_shared_folder => VagrantPlugins::GuestSolaris11::Cap::MountVirtualBoxSharedFolder,
|
20
|
+
#:mount_nfs_folder => VagrantPlugins::GuestSolaris11::Cap::MountNFSFolder,
|
21
|
+
}.each do |cap, cls|
|
22
|
+
it "should be capable of #{cap} with #{os}" do
|
23
|
+
expect(described_class.components.guest_capabilities[os][cap])
|
24
|
+
.to eq(cls)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
# vim: coding: utf-8:shiftwidth=2
|
2
|
+
|
3
|
+
#$:.unshift File.expand_path("../lib", __FILE__)
|
4
|
+
#require "vagrant-guests-solaris11/version"
|
5
|
+
|
6
|
+
lib = File.expand_path('../lib', __FILE__)
|
7
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
8
|
+
|
9
|
+
Gem::Specification.new do |spec|
|
10
|
+
spec.name = "vagrant-guests-solaris11"
|
11
|
+
#spec.version = VagrantPlugins::SOLARIS11::VERSION
|
12
|
+
#spec.version = "0.0.2.dev"
|
13
|
+
spec.version = File.read('VERSION')
|
14
|
+
#spec.platform = Gem::Platform::RUBY
|
15
|
+
spec.authors = "Jan Thomas Moldung"
|
16
|
+
spec.email = "janth@moldung.no"
|
17
|
+
spec.homepage = "https://github.com/janth/vagrant-guests-solaris11"
|
18
|
+
spec.summary = "Enables Vagrant to manage Oracle Solaris 11 guests."
|
19
|
+
spec.description = "Enables Vagrant to manage Oracle Solaris 11 guests."
|
20
|
+
spec.license = "MIT"
|
21
|
+
|
22
|
+
spec.required_rubygems_version = ">= 1.3.6"
|
23
|
+
spec.rubyforge_project = "vagrant-solaris11"
|
24
|
+
|
25
|
+
#spec.add_runtime_dependency "fog", "~> 1.10.0"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler"
|
28
|
+
spec.add_development_dependency "jeweler"
|
29
|
+
spec.add_development_dependency "rake"
|
30
|
+
spec.add_development_dependency "rspec-core"
|
31
|
+
spec.add_development_dependency "rspec-expectations"
|
32
|
+
spec.add_development_dependency "rspec-mocks"
|
33
|
+
|
34
|
+
# The following block of code determines the files that should be included
|
35
|
+
# in the gem. It does this by reading all the files in the directory where
|
36
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
37
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
38
|
+
# the "!" syntax, but it should mostly work correctly.
|
39
|
+
root_path = File.dirname(__FILE__)
|
40
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
41
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
42
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
43
|
+
gitignore = File.readlines(gitignore_path)
|
44
|
+
gitignore.map! { |line| line.chomp.strip }
|
45
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
46
|
+
|
47
|
+
unignored_files = all_files.reject do |file|
|
48
|
+
# Ignore any directories, the gemspec only cares about files
|
49
|
+
next true if File.directory?(file)
|
50
|
+
|
51
|
+
# Ignore any paths that match anything in the gitignore. We do
|
52
|
+
# two tests here:
|
53
|
+
#
|
54
|
+
# - First, test to see if the entire path matches the gitignore.
|
55
|
+
# - Second, match if the basename does, this makes it so that things
|
56
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
57
|
+
# as git).
|
58
|
+
#
|
59
|
+
gitignore.any? do |ignore|
|
60
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
61
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
spec.files = unignored_files
|
66
|
+
spec.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
67
|
+
spec.require_path = 'lib'
|
68
|
+
|
69
|
+
|
70
|
+
spec.files = `git ls-files`.split($/)
|
71
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
72
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
73
|
+
spec.require_paths = ["lib"]
|
74
|
+
|
75
|
+
end
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-guests-solaris11
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1a
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan Thomas Moldung
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec-core
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-expectations
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-mocks
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Enables Vagrant to manage Oracle Solaris 11 guests.
|
98
|
+
email: janth@moldung.no
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- .gitignore
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.md
|
107
|
+
- Rakefile
|
108
|
+
- VERSION
|
109
|
+
- develop.md
|
110
|
+
- lib/vagrant-guests-solaris11.rb
|
111
|
+
- lib/vagrant-guests-solaris11/cap/change_host_name.rb
|
112
|
+
- lib/vagrant-guests-solaris11/cap/configure_networks.rb
|
113
|
+
- lib/vagrant-guests-solaris11/cap/halt.rb
|
114
|
+
- lib/vagrant-guests-solaris11/cap/mount_virtualbox_shared_folder.rb
|
115
|
+
- lib/vagrant-guests-solaris11/guest.rb
|
116
|
+
- lib/vagrant-guests-solaris11/plugin.rb
|
117
|
+
- spec/cap/change_host_name_spec.rb
|
118
|
+
- spec/cap/halt_spec.rb
|
119
|
+
- spec/guest_spec.rb
|
120
|
+
- spec/plugin_spec.rb
|
121
|
+
- spec/spec_helper.rb
|
122
|
+
- vagrant-solaris11.gemspec
|
123
|
+
homepage: https://github.com/janth/vagrant-guests-solaris11
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata: {}
|
127
|
+
post_install_message:
|
128
|
+
rdoc_options: []
|
129
|
+
require_paths:
|
130
|
+
- lib
|
131
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
requirements:
|
138
|
+
- - ! '>='
|
139
|
+
- !ruby/object:Gem::Version
|
140
|
+
version: 1.3.6
|
141
|
+
requirements: []
|
142
|
+
rubyforge_project: vagrant-solaris11
|
143
|
+
rubygems_version: 2.0.7
|
144
|
+
signing_key:
|
145
|
+
specification_version: 4
|
146
|
+
summary: Enables Vagrant to manage Oracle Solaris 11 guests.
|
147
|
+
test_files:
|
148
|
+
- spec/cap/change_host_name_spec.rb
|
149
|
+
- spec/cap/halt_spec.rb
|
150
|
+
- spec/guest_spec.rb
|
151
|
+
- spec/plugin_spec.rb
|
152
|
+
- spec/spec_helper.rb
|