vagrant-hivemind 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4c3b4c2537093dc19552e98f59d64035fc3db33a
4
+ data.tar.gz: 0c8d6696b1ef82cbf6f1195e069efca02c3daa2e
5
+ SHA512:
6
+ metadata.gz: 48dc022959f8fe55d220b0b4f3b517ef12d2ac435e331e93280886530856c137a50a2dbc623b347cafc7a9fc692c59954fae0025eab8402644fb572913e8bba4
7
+ data.tar.gz: 075b6dc55ae51b244eb8746273fae21a398415bb3527a3f5f0660f2151a14646b0168ba0c3854717ab77ec887f70f55026ccbcb2283c2c0aa3c9bbe826f9ba3a
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.1
4
+ before_install: gem install bundler -v 1.10.5
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-hivemind.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
8
+ gem "coveralls", require: false
9
+ end
10
+
11
+ group :plugins do
12
+ gem "vagrant-hivemind", path: "."
13
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Nap Ramirez
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # Hivemind Plugin for Vagrant
2
+
3
+ [![Build Status](https://travis-ci.org/napramirez/vagrant-hivemind.png?branch=master)](https://travis-ci.org/napramirez/vagrant-hivemind)
4
+ [![Coverage Status](https://coveralls.io/repos/napramirez/vagrant-hivemind/badge.png?branch=master&service=github)](https://coveralls.io/github/napramirez/vagrant-hivemind?branch=master)
5
+ [![Dependency Status](https://gemnasium.com/napramirez/vagrant-hivemind.png)](https://gemnasium.com/napramirez/vagrant-hivemind)
6
+
7
+ #### Use Vagrant without ever configuring a Vagrantfile!
8
+
9
+ A Vagrant plugin for users who want to use Vagrant, but don't want to be bothered with Vagrant configuration. This is ideal for developers who just want something up and running in seconds.
10
+
11
+
12
+ ## Features
13
+ #### Create VM's with the least amount of knowledge
14
+
15
+ Hivemind provides the simplest of options for defining a VM: hostname, RAM allocation, and VM type.
16
+
17
+ #### Use the leanest base boxes
18
+
19
+ Make use of properly crafted base boxes with disk space optimization in mind. There's a box for your every need: server boxes or desktop boxes.
20
+
21
+ #### Networking is simple
22
+
23
+ The VM's are automatically connected in a private network and hostnames are resolvable using a simple mapping.
24
+
25
+ ## Installation
26
+
27
+ An existing installation of [VirtualBox](https://www.virtualbox.org/) and [Vagrant](https://www.vagrantup.com/) is required.
28
+
29
+ Run the following command to install the plugin:
30
+
31
+ $ vagrant plugin install vagrant-hivemind
32
+
33
+ ## Quickstart
34
+
35
+ ##### Initialize the working directory: *the Hive!*
36
+
37
+ $ vagrant hivemind init
38
+
39
+ ##### Create a VM in the working directory: *a Drone in the Hive!*
40
+
41
+ $ vagrant hivemind spawn -n drone001
42
+
43
+ ##### Start a VM in the working directory: *get the Drone to work!*
44
+
45
+ $ vagrant hivemind up -n drone001
46
+
47
+ ##### For a list of available stuff:
48
+
49
+ $ vagrant hivemind --help
50
+
51
+ ## Configuration
52
+
53
+ Didn't I just say there's nothing to configure? No Vagrantfile, no Ruby config, no properties file!
54
+
55
+ ## Contributing
56
+
57
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/napramirez/vagrant-hivemind](https://github.com/napramirez/vagrant-hivemind). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
58
+
59
+
60
+ ## License
61
+
62
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
63
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+
6
+ Bundler::GemHelper.install_tasks
7
+
8
+ RSpec::Core::RakeTask.new(:spec)
9
+
10
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vagrant/hivemind"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
data/keys/id_rsa ADDED
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpQIBAAKCAQEAytPcZu2rMV7SSvkiUEVrR23d3G725WGnLtI8HNf28I9XA1zG
3
+ 5XvhcQRMNsh71hVsV3I2JmEJYhOLDVDH+DnFH3vT/Aesuc7MCR5F206Y9Gvqsfdd
4
+ n+kHzKnTuUwjwh2EkXyi02ejCJOih0c3d0OZ/Tn01FUrl8cliXwnDUqU/l+t328+
5
+ CQhC+/RoMrC59UgFFU2yd+6jl//Zdh7nORwFGisDRQmW7fMlx/g/GzhJK6FmnbQW
6
+ wYykwzLMhVgVOycNOEwKNsMES2byVgoQKQnvTOjRxHx2i/ZM5kcmXO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WD0qRYGI7zsA5zjlR49o5xvwE
23
+ WA/qqWI9TjTuxlCuKwqyUE+AVJnP23hQgHVYp1yMqXv4mOC9JuEV+vERcBXDznmH
24
+ gwznJAcCgYEAihOuwHdB7w9xzyxbXpg1ysu/pTq5pqID5ePsDyEPoWJFBDv0msT9
25
+ qc9/oaIMpHqq5BivHvKi3JCYbJe2pNHjqLU17G/GfSY1C2mMS7Lx3sv/CK5l/XRD
26
+ SxXVVblhr60mXKLYKLj9unD5rAxU6bbHjfR2q7qJpUfl7JbbqSe+2Dk=
27
+ -----END RSA PRIVATE KEY-----
data/keys/id_rsa.ppk ADDED
@@ -0,0 +1,26 @@
1
+ PuTTY-User-Key-File-2: ssh-rsa
2
+ Encryption: none
3
+ Comment: imported-openssh-key
4
+ Public-Lines: 6
5
+ AAAAB3NzaC1yc2EAAAADAQABAAABAQDK09xm7asxXtJK+SJQRWtHbd3cbvblYacu
6
+ 0jwc1/bwj1cDXMble+FxBEw2yHvWFWxXcjYmYQliE4sNUMf4OcUfe9P8B6y5zswJ
7
+ HkXbTpj0a+qx912f6QfMqdO5TCPCHYSRfKLTZ6MIk6KHRzd3Q5n9OfTUVSuXxyWJ
8
+ fCcNSpT+X63fbz4JCEL79GgysLn1SAUVTbJ37qOX/9l2Huc5HAUaKwNFCZbt8yXH
9
+ +D8bOEkroWadtBbBjKTDMsyFWBU7Jw04TAo2wwRLZvJWChApCe9M6NHEfHaL9kzm
10
+ RyZc64QrMNw9oy9Bu5/NavExPtUwXm9EuRvT29iccrjof/M5EgLB
11
+ Private-Lines: 14
12
+ AAABAQDBXQ8e9XAipiJXpYGoAzZOJ5i+gO9SKTHoOjdizCU4m365zuYze1GmnBFI
13
+ nQMqSsw55cFn/1Shsr37GMs7g1/BLx0ehfaOQW9VNg4lEJ5TTtq1hX01aUStQi59
14
+ 1e+1LMzoomjcoE3WbGEjFKr1QXZ56pnVH8lqbkoD81+LlVHL2ppij0q8P+fTTRx5
15
+ kCSOLWfaiFOcEZGin7n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kroWadtBbBjKTDMsyFWBU7Jw04TAo2wwRLZvJWChApCe9M6NHEfHaL9kzmRyZc64QrMNw9oy9Bu5/NavExPtUwXm9EuRvT29iccrjof/M5EgLB control@hivemind
@@ -0,0 +1,2 @@
1
+ require_relative "hivemind/version"
2
+ require_relative "hivemind/plugin"
@@ -0,0 +1,83 @@
1
+ require "optparse"
2
+
3
+ require "vagrant/hivemind/constants"
4
+ require "vagrant/hivemind/util"
5
+ require "vagrant/hivemind/host"
6
+
7
+ module Vagrant
8
+ module Hivemind
9
+ module Command
10
+ class Desc < Vagrant.plugin("2", :command)
11
+ include Vagrant::Hivemind::Constants
12
+ include Vagrant::Hivemind::Util
13
+
14
+ def self.synopsis
15
+ "Displays the settings of a Drone in the Hive"
16
+ end
17
+
18
+ def execute
19
+ options = {}
20
+
21
+ opts = OptionParser.new do |o|
22
+ o.banner = "Usage: vagrant hivemind desc [options]"
23
+ o.separator ""
24
+ o.separator "Options:"
25
+ o.separator ""
26
+
27
+ o.on("-n", "--hostname HOSTNAME", "The hostname of the Drone (REQUIRED)") do |n|
28
+ options[:hostname] = n
29
+ end
30
+
31
+ o.on("-d", "--directory DIRECTORY", "Specify the directory where '#{HIVE_FILE}' is located (default: current directory)") do |d|
32
+ options[:directory] = []
33
+ options[:directory] << d
34
+ end
35
+ end
36
+
37
+ argv = parse_options(opts)
38
+ return if !argv
39
+
40
+ unless options[:hostname]
41
+ @env.ui.info opts.help
42
+ return 0
43
+ end
44
+
45
+ root_path = Path.get_root_path_from_options options
46
+
47
+ unless HiveFile.exist? root_path
48
+ @env.ui.error "There is no Hive file in the working directory."
49
+ return 1
50
+ end
51
+
52
+ hosts = HiveFile.read_from root_path
53
+
54
+ unless hosts.values.map(&:hostname).include? options[:hostname]
55
+ @env.ui.error "The specified hostname does not exist!"
56
+ return 1
57
+ end
58
+
59
+ host = hosts[options[:hostname]]
60
+
61
+ @env.ui.info "Hostname : #{host.hostname}"
62
+ @env.ui.info "IP Address : #{host.ip_address}"
63
+ @env.ui.info "Control Machine : #{host.is_control ? 'Yes' : 'No'}"
64
+ @env.ui.info "Box Size : #{BOX_SIZES[host.box_size.to_sym][:name]} (#{BOX_SIZES[host.box_size.to_sym][:memory_in_mb]}MB)"
65
+ @env.ui.info "Box Type : #{BOX_TYPES[host.box_type.to_sym][:name]} (#{BOX_TYPES[host.box_type.to_sym][:box_id]})"
66
+ @env.ui.info "GUI Machine : #{BOX_TYPES[host.box_type.to_sym][:is_gui] ? 'Yes' : 'No'}"
67
+ @env.ui.info ""
68
+
69
+ if host.forwarded_ports and !host.forwarded_ports.empty?
70
+ @env.ui.info "Forwarded Ports"
71
+ host.forwarded_ports.each do |forwarded_port|
72
+ @env.ui.info "#{'%15.15s' % forwarded_port["guest_port"]} : #{forwarded_port["host_port"]}"
73
+ end
74
+ @env.ui.info ""
75
+ end
76
+
77
+ 0
78
+ end
79
+
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,77 @@
1
+ require "optparse"
2
+
3
+ require "vagrant/hivemind/constants"
4
+ require "vagrant/hivemind/util"
5
+ require "vagrant/hivemind/host"
6
+
7
+ module Vagrant
8
+ module Hivemind
9
+ module Command
10
+ class Halt < Vagrant.plugin("2", :command)
11
+ include Vagrant::Hivemind::Constants
12
+ include Vagrant::Hivemind::Util
13
+
14
+ def self.synopsis
15
+ "Stops a Drone in the Hive"
16
+ end
17
+
18
+ def execute
19
+ options = {}
20
+
21
+ opts = OptionParser.new do |o|
22
+ o.banner = "Usage: vagrant hivemind halt [options]"
23
+ o.separator ""
24
+ o.separator "Options:"
25
+ o.separator ""
26
+
27
+ o.on("-n", "--hostname HOSTNAME", "The hostname of the Drone (REQUIRED)") do |n|
28
+ options[:hostname] = n
29
+ end
30
+
31
+ o.on("-f", "--force", "Force shut down (equivalent of pulling power)") do |f|
32
+ options[:force] = f
33
+ end
34
+
35
+ o.on("-d", "--directory DIRECTORY", "Specify the directory where '#{HIVE_FILE}' is located (default: current directory)") do |d|
36
+ options[:directory] = []
37
+ options[:directory] << d
38
+ end
39
+ end
40
+
41
+ argv = parse_options(opts)
42
+ return if !argv
43
+
44
+ unless options[:hostname]
45
+ @env.ui.info opts.help
46
+ return 0
47
+ end
48
+
49
+ root_path = Path.get_root_path_from_options options
50
+
51
+ unless HiveFile.exist? root_path
52
+ @env.ui.error "There is no Hive file in the working directory."
53
+ return 1
54
+ end
55
+
56
+ hosts = HiveFile.read_from root_path
57
+
58
+ unless hosts.values.map(&:hostname).include? options[:hostname]
59
+ @env.ui.error "The specified hostname does not exist!"
60
+ return 1
61
+ end
62
+
63
+ host = hosts[options[:hostname]]
64
+
65
+ Vagrant::Hivemind::Util::Vagrantfile.generate_hivemind_vagrantfile @env, host, root_path
66
+
67
+ with_target_vms(options[:hostname]) do |vm|
68
+ vm.action(:halt, force_halt: options[:force])
69
+ end
70
+
71
+ 0
72
+ end
73
+
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,67 @@
1
+ require "optparse"
2
+
3
+ require "vagrant/hivemind/constants"
4
+ require "vagrant/hivemind/util"
5
+ require "vagrant/hivemind/host"
6
+
7
+ module Vagrant
8
+ module Hivemind
9
+ module Command
10
+ class Init < Vagrant.plugin("2", :command)
11
+ include Vagrant::Hivemind::Constants
12
+ include Vagrant::Hivemind::Util
13
+
14
+ def self.synopsis
15
+ "Initializes a new Hive by creating a '#{HIVE_FILE}'"
16
+ end
17
+
18
+ def execute
19
+ options = {}
20
+
21
+ OptionParser.new do |o|
22
+ o.banner = "Usage: vagrant hivemind init [options]"
23
+ o.separator ""
24
+ o.separator "Options:"
25
+ o.separator ""
26
+
27
+ o.on("-f", "--force", "Overwrite an existing '#{HIVE_FILE}' with a new one") do |f|
28
+ options[:force] = f
29
+ end
30
+
31
+ o.on("-d", "--directory DIRECTORY", "Specify the directory where '#{HIVE_FILE}' will be created (default: current directory)") do |d|
32
+ options[:directory] = []
33
+ options[:directory] << d
34
+ end
35
+ end.parse!
36
+
37
+ root_path = Path.get_root_path_from_options options
38
+
39
+ if HiveFile.exist? root_path
40
+ if options[:force]
41
+ write_new_hive_file root_path
42
+ @env.ui.info "The Hive file has been overwritten."
43
+ return 0
44
+ else
45
+ @env.ui.error "The Hive file already exists!"
46
+ return 1
47
+ end
48
+ end
49
+
50
+ write_new_hive_file root_path
51
+ @env.ui.info "The Hive file has been created in the working directory."
52
+
53
+ 0
54
+ end
55
+
56
+ private
57
+ def write_new_hive_file(path)
58
+ hosts = {
59
+ "control" => Vagrant::Hivemind::Host.control
60
+ }
61
+ HiveFile.write_to hosts, path
62
+ end
63
+
64
+ end
65
+ end
66
+ end
67
+ end