vagrant-cumulus 0.1
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 +7 -0
- data/.gitignore +4 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +153 -0
- data/LICENSE.txt +22 -0
- data/README.md +36 -0
- data/Rakefile +3 -0
- data/lib/vagrant-cumulus.rb +21 -0
- data/lib/vagrant-cumulus/cap/change_host_name.rb +100 -0
- data/lib/vagrant-cumulus/cap/configure_networks.rb +65 -0
- data/lib/vagrant-cumulus/guest.rb +10 -0
- data/lib/vagrant-cumulus/plugin.rb +35 -0
- data/lib/vagrant-cumulus/version.rb +5 -0
- data/templates/guests/cumulus/network_dhcp.erb +13 -0
- data/templates/guests/cumulus/network_static.erb +8 -0
- data/vagrant-cumulus.gemspec +23 -0
- metadata +88 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 41553c80d4efcb5de885ab4f09ff684e5291a4b9
|
|
4
|
+
data.tar.gz: 0c6c7b8ad0909964c6d52aa4cc7a71027da14524
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: cf81a470a3417c5ad0804d264e945177767c059e50db1753269b715d8a64642af0ef121f1e0185490b8f9f66b375fa1db25b31a06f915e27cb02d9e868bc540f
|
|
7
|
+
data.tar.gz: 9605980fe129323dcf9848f0fc63bac12f8d32ccae2bfcb5958f40583b2172078052780f10afd33a8fcea82dafff11670e12aa4d2acb6579fc694f4ae4e77641
|
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
source 'https://rubygems.org'
|
|
2
|
+
|
|
3
|
+
group :development do
|
|
4
|
+
# We depend on Vagrant for development, but we don't add it as a
|
|
5
|
+
# gem dependency because we expect to be installed within the
|
|
6
|
+
# Vagrant environment itself using `vagrant plugin`.
|
|
7
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
|
8
|
+
gem "rake"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
group :plugins do
|
|
12
|
+
gem "vagrant-cumulus", path: "."
|
|
13
|
+
end
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: git://github.com/mitchellh/vagrant.git
|
|
3
|
+
revision: e64cef9d31a22ea9ca007a16b8af8e97abf13904
|
|
4
|
+
specs:
|
|
5
|
+
vagrant (1.7.2)
|
|
6
|
+
bundler (>= 1.5.2, < 1.8.0)
|
|
7
|
+
childprocess (~> 0.5.0)
|
|
8
|
+
erubis (~> 2.7.0)
|
|
9
|
+
hashicorp-checkpoint (~> 0.1.1)
|
|
10
|
+
i18n (>= 0.6.0, <= 0.8.0)
|
|
11
|
+
listen (~> 2.8.0)
|
|
12
|
+
log4r (~> 1.1.9, < 1.1.11)
|
|
13
|
+
net-scp (~> 1.1.0)
|
|
14
|
+
net-sftp (~> 2.1)
|
|
15
|
+
net-ssh (>= 2.6.6, < 2.10.0)
|
|
16
|
+
nokogiri (= 1.6.3.1)
|
|
17
|
+
rb-kqueue (~> 0.2.0)
|
|
18
|
+
rest-client (>= 1.6.0, < 2.0)
|
|
19
|
+
wdm (~> 0.1.0)
|
|
20
|
+
winrm (~> 1.3)
|
|
21
|
+
winrm-fs (~> 0.2.0)
|
|
22
|
+
|
|
23
|
+
PATH
|
|
24
|
+
remote: .
|
|
25
|
+
specs:
|
|
26
|
+
vagrant-cumulus (0.1)
|
|
27
|
+
|
|
28
|
+
GEM
|
|
29
|
+
remote: https://rubygems.org/
|
|
30
|
+
specs:
|
|
31
|
+
builder (3.2.2)
|
|
32
|
+
celluloid (0.17.0)
|
|
33
|
+
bundler
|
|
34
|
+
celluloid-essentials
|
|
35
|
+
celluloid-extras
|
|
36
|
+
celluloid-fsm
|
|
37
|
+
celluloid-pool
|
|
38
|
+
celluloid-supervision
|
|
39
|
+
dotenv
|
|
40
|
+
nenv
|
|
41
|
+
rspec-logsplit (>= 0.1.2)
|
|
42
|
+
timers (~> 4.0.0)
|
|
43
|
+
celluloid-essentials (0.20.0)
|
|
44
|
+
bundler
|
|
45
|
+
dotenv
|
|
46
|
+
nenv
|
|
47
|
+
rspec-logsplit (>= 0.1.2)
|
|
48
|
+
timers (~> 4.0.0)
|
|
49
|
+
celluloid-extras (0.20.0)
|
|
50
|
+
bundler
|
|
51
|
+
dotenv
|
|
52
|
+
nenv
|
|
53
|
+
rspec-logsplit (>= 0.1.2)
|
|
54
|
+
timers (~> 4.0.0)
|
|
55
|
+
celluloid-fsm (0.20.0)
|
|
56
|
+
bundler
|
|
57
|
+
dotenv
|
|
58
|
+
nenv
|
|
59
|
+
rspec-logsplit (>= 0.1.2)
|
|
60
|
+
timers (~> 4.0.0)
|
|
61
|
+
celluloid-pool (0.20.0)
|
|
62
|
+
bundler
|
|
63
|
+
dotenv
|
|
64
|
+
nenv
|
|
65
|
+
rspec-logsplit (>= 0.1.2)
|
|
66
|
+
timers (~> 4.0.0)
|
|
67
|
+
celluloid-supervision (0.20.0)
|
|
68
|
+
bundler
|
|
69
|
+
dotenv
|
|
70
|
+
nenv
|
|
71
|
+
rspec-logsplit (>= 0.1.2)
|
|
72
|
+
timers (~> 4.0.0)
|
|
73
|
+
childprocess (0.5.6)
|
|
74
|
+
ffi (~> 1.0, >= 1.0.11)
|
|
75
|
+
domain_name (0.5.24)
|
|
76
|
+
unf (>= 0.0.5, < 1.0.0)
|
|
77
|
+
dotenv (2.0.2)
|
|
78
|
+
erubis (2.7.0)
|
|
79
|
+
ffi (1.9.10)
|
|
80
|
+
gssapi (1.2.0)
|
|
81
|
+
ffi (>= 1.0.1)
|
|
82
|
+
gyoku (1.3.1)
|
|
83
|
+
builder (>= 2.1.2)
|
|
84
|
+
hashicorp-checkpoint (0.1.4)
|
|
85
|
+
hitimes (1.2.2)
|
|
86
|
+
http-cookie (1.0.2)
|
|
87
|
+
domain_name (~> 0.5)
|
|
88
|
+
httpclient (2.6.0.1)
|
|
89
|
+
i18n (0.7.0)
|
|
90
|
+
listen (2.8.6)
|
|
91
|
+
celluloid (>= 0.15.2)
|
|
92
|
+
rb-fsevent (>= 0.9.3)
|
|
93
|
+
rb-inotify (>= 0.9)
|
|
94
|
+
little-plugger (1.1.3)
|
|
95
|
+
log4r (1.1.10)
|
|
96
|
+
logging (1.8.2)
|
|
97
|
+
little-plugger (>= 1.1.3)
|
|
98
|
+
multi_json (>= 1.8.4)
|
|
99
|
+
mime-types (2.6.1)
|
|
100
|
+
mini_portile (0.6.0)
|
|
101
|
+
multi_json (1.11.2)
|
|
102
|
+
nenv (0.2.0)
|
|
103
|
+
net-scp (1.1.2)
|
|
104
|
+
net-ssh (>= 2.6.5)
|
|
105
|
+
net-sftp (2.1.2)
|
|
106
|
+
net-ssh (>= 2.6.5)
|
|
107
|
+
net-ssh (2.9.2)
|
|
108
|
+
netrc (0.10.3)
|
|
109
|
+
nokogiri (1.6.3.1)
|
|
110
|
+
mini_portile (= 0.6.0)
|
|
111
|
+
nori (2.6.0)
|
|
112
|
+
rake (10.3.2)
|
|
113
|
+
rb-fsevent (0.9.5)
|
|
114
|
+
rb-inotify (0.9.5)
|
|
115
|
+
ffi (>= 0.5.0)
|
|
116
|
+
rb-kqueue (0.2.4)
|
|
117
|
+
ffi (>= 0.5.0)
|
|
118
|
+
rest-client (1.8.0)
|
|
119
|
+
http-cookie (>= 1.0.2, < 2.0)
|
|
120
|
+
mime-types (>= 1.16, < 3.0)
|
|
121
|
+
netrc (~> 0.7)
|
|
122
|
+
rspec-logsplit (0.1.3)
|
|
123
|
+
rubyntlm (0.4.0)
|
|
124
|
+
rubyzip (1.1.7)
|
|
125
|
+
timers (4.0.1)
|
|
126
|
+
hitimes
|
|
127
|
+
unf (0.1.4)
|
|
128
|
+
unf_ext
|
|
129
|
+
unf_ext (0.0.7.1)
|
|
130
|
+
uuidtools (2.1.5)
|
|
131
|
+
wdm (0.1.0)
|
|
132
|
+
winrm (1.3.3)
|
|
133
|
+
builder (>= 2.1.2)
|
|
134
|
+
gssapi (~> 1.2)
|
|
135
|
+
gyoku (~> 1.0)
|
|
136
|
+
httpclient (~> 2.2, >= 2.2.0.2)
|
|
137
|
+
logging (~> 1.6, >= 1.6.1)
|
|
138
|
+
nori (~> 2.0)
|
|
139
|
+
rubyntlm (~> 0.4.0)
|
|
140
|
+
uuidtools (~> 2.1.2)
|
|
141
|
+
winrm-fs (0.2.0)
|
|
142
|
+
erubis (~> 2.7)
|
|
143
|
+
logging (~> 1.6, >= 1.6.1)
|
|
144
|
+
rubyzip (~> 1.1)
|
|
145
|
+
winrm (~> 1.3.0)
|
|
146
|
+
|
|
147
|
+
PLATFORMS
|
|
148
|
+
ruby
|
|
149
|
+
|
|
150
|
+
DEPENDENCIES
|
|
151
|
+
rake
|
|
152
|
+
vagrant!
|
|
153
|
+
vagrant-cumulus!
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2015 Dinesh Dutt
|
|
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
|
+
# Vagrant::Cumulus
|
|
2
|
+
|
|
3
|
+
This is a [Vagrant](http://www.vagrantup.com) 1.7+ plugin that adds a Cumulus Linux guest to Vagrant, allowing for OS detection and network configuration. Cumulus Linux is based off Debian, and so why need a plugin, you ask. Cumulus Linux names its front panel ports swp* instead of eth*, reserving eth0 for the management interface name. This foils interface configuration. Furthermore, Cumulus Linux ships with ifupdown2, a vastly improved, scalable and feature-rich improvement to the venerable ifupdown module in Debian for configuring interfaces. This plugin therefore exploits these differences of Cumulus Linux from Debian, leaving the rest to the Debian plugin.
|
|
4
|
+
|
|
5
|
+
> **NOTE:** This plugin requires Vagrant 1.7+,
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
* Detect Cumulus Linux
|
|
10
|
+
* Configure network interfaces, including management and front panel ports
|
|
11
|
+
* Use ifupdown2 instead of ifupdown for interface configuration
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Install using standard Vagrant 1.7+ plugin installation methods. The fastest way to get started is to use the standard Vagrant Cloud images:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
$ vagrant plugin install vagrant-cumulus
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
... (create a Vagrant environment in a directory):
|
|
24
|
+
$ vagrant init CumulusVX
|
|
25
|
+
...
|
|
26
|
+
$ vagrant up
|
|
27
|
+
```
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
## Contributing
|
|
31
|
+
|
|
32
|
+
1. Fork it ( https://github.com/[my-github-username]/vagrant-cumulus/fork )
|
|
33
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
34
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
35
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
36
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# lib/vagrant-cumulus.rb
|
|
2
|
+
|
|
3
|
+
require 'bundler'
|
|
4
|
+
|
|
5
|
+
begin
|
|
6
|
+
require 'vagrant'
|
|
7
|
+
rescue LoadError
|
|
8
|
+
Bundler.require(:default, :development)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'vagrant-cumulus/plugin'
|
|
12
|
+
|
|
13
|
+
module VagrantPlugins
|
|
14
|
+
module GuestCumulus
|
|
15
|
+
# This returns the path to the source of this plugin.
|
|
16
|
+
def self.source_root
|
|
17
|
+
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
module VagrantPlugins
|
|
2
|
+
module GuestCumulus
|
|
3
|
+
module Cap
|
|
4
|
+
class ChangeHostName
|
|
5
|
+
def self.change_host_name(machine, name)
|
|
6
|
+
new(machine, name).change!
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
attr_reader :machine, :new_hostname
|
|
10
|
+
|
|
11
|
+
def initialize(machine, new_hostname)
|
|
12
|
+
@machine = machine
|
|
13
|
+
@new_hostname = new_hostname
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def change!
|
|
17
|
+
return unless should_change?
|
|
18
|
+
|
|
19
|
+
update_etc_hostname
|
|
20
|
+
update_etc_hosts
|
|
21
|
+
refresh_hostname_service
|
|
22
|
+
update_mailname
|
|
23
|
+
renew_dhcp
|
|
24
|
+
restart_lldp
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def should_change?
|
|
28
|
+
new_hostname != current_hostname
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def current_hostname
|
|
32
|
+
@current_hostname ||= get_current_hostname
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get_current_hostname
|
|
36
|
+
hostname = ""
|
|
37
|
+
sudo "hostname -f" do |type, data|
|
|
38
|
+
hostname = data.chomp if type == :stdout && hostname.empty?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
hostname
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def update_etc_hostname
|
|
45
|
+
sudo("echo '#{short_hostname}' > /etc/hostname")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# /etc/hosts should resemble:
|
|
49
|
+
# 127.0.0.1 localhost
|
|
50
|
+
# 127.0.1.1 host.fqdn.com host.fqdn host
|
|
51
|
+
def update_etc_hosts
|
|
52
|
+
if test("grep '#{current_hostname}' /etc/hosts")
|
|
53
|
+
# Current hostname entry is in /etc/hosts
|
|
54
|
+
ip_address = '([0-9]{1,3}\.){3}[0-9]{1,3}'
|
|
55
|
+
search = "^(#{ip_address})\\s+#{Regexp.escape(current_hostname)}(\\s.*)?$"
|
|
56
|
+
replace = "\\1 #{fqdn} #{short_hostname}"
|
|
57
|
+
expression = ['s', search, replace, 'g'].join('@')
|
|
58
|
+
|
|
59
|
+
sudo("sed -ri '#{expression}' /etc/hosts")
|
|
60
|
+
else
|
|
61
|
+
# Current hostname entry isn't in /etc/hosts, just append it
|
|
62
|
+
sudo("echo '127.0.1.1 #{fqdn} #{short_hostname}' >>/etc/hosts")
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def refresh_hostname_service
|
|
67
|
+
sudo("hostname -F /etc/hostname")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def update_mailname
|
|
71
|
+
sudo("hostname --fqdn > /etc/mailname")
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def renew_dhcp
|
|
75
|
+
sudo("ifdown -a; ifup -a; ifup eth0")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def restart_lldp
|
|
79
|
+
sudo("service lldpd restart")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def fqdn
|
|
83
|
+
new_hostname
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def short_hostname
|
|
87
|
+
new_hostname.split('.').first
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def sudo(cmd, &block)
|
|
91
|
+
machine.communicate.sudo(cmd, &block)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def test(cmd)
|
|
95
|
+
machine.communicate.test(cmd)
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require 'set'
|
|
2
|
+
require 'tempfile'
|
|
3
|
+
require "vagrant/util/template_renderer"
|
|
4
|
+
require_relative "../version"
|
|
5
|
+
|
|
6
|
+
module VagrantPlugins
|
|
7
|
+
module GuestCumulus
|
|
8
|
+
module Cap
|
|
9
|
+
# Configure Cumulus Linux mgmt and front panel ports
|
|
10
|
+
class ConfigureNetworks
|
|
11
|
+
include Vagrant::Util
|
|
12
|
+
|
|
13
|
+
def self.vm_network_config(machine, interface)
|
|
14
|
+
machine.config.vm.networks[interface-1]
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.configure_networks(machine, networks)
|
|
18
|
+
machine.communicate.tap do |comm|
|
|
19
|
+
# First, remove any previous network modifications
|
|
20
|
+
# from the interface file.
|
|
21
|
+
comm.sudo("sed -e '/^#VAGRANT-BEGIN/,$ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces.pre")
|
|
22
|
+
comm.sudo("sed -ne '/^#VAGRANT-END/,$ p' /etc/network/interfaces | tail -n +2 > /tmp/vagrant-network-interfaces.post")
|
|
23
|
+
|
|
24
|
+
# Accumulate the configurations to add to the interfaces file as
|
|
25
|
+
# well as what interfaces we're actually configuring since we use that
|
|
26
|
+
# later.
|
|
27
|
+
interfaces = Set.new
|
|
28
|
+
entries = []
|
|
29
|
+
networks.each do |network|
|
|
30
|
+
interfaces.add(network[:interface])
|
|
31
|
+
|
|
32
|
+
type, config = vm_network_config(machine, network[:interface])
|
|
33
|
+
if config[:cumulus__intname]
|
|
34
|
+
network[:name] = config[:cumulus__intname]
|
|
35
|
+
else
|
|
36
|
+
network[:name] = network[:interface] == 0 ? 'eth0' : "swp#{network[:interface]}"
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
entry = TemplateRenderer.render("guests/cumulus/network_#{network[:type]}",
|
|
40
|
+
options: network,
|
|
41
|
+
template_root: "#{VagrantPlugins::GuestCumulus.source_root}/templates")
|
|
42
|
+
|
|
43
|
+
entries << entry
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Perform the careful dance necessary to reconfigure
|
|
47
|
+
# the network interfaces
|
|
48
|
+
temp = Tempfile.new("vagrant")
|
|
49
|
+
temp.binmode
|
|
50
|
+
temp.write(entries.join("\n"))
|
|
51
|
+
temp.close
|
|
52
|
+
|
|
53
|
+
comm.upload(temp.path, "/tmp/vagrant-network-entry")
|
|
54
|
+
|
|
55
|
+
comm.sudo('cat /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post > /etc/network/interfaces')
|
|
56
|
+
comm.sudo('rm -f /tmp/vagrant-network-interfaces.pre /tmp/vagrant-network-entry /tmp/vagrant-network-interfaces.post')
|
|
57
|
+
|
|
58
|
+
# ifreload will reload the interfaces correctly
|
|
59
|
+
comm.sudo("/sbin/ifreload -a")
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'vagrant'
|
|
3
|
+
rescue LoadError
|
|
4
|
+
raise 'The vagrant-cumulus plugin must be run within Vagrant'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
|
8
|
+
# this into an early Vagrant version.
|
|
9
|
+
if Vagrant::VERSION < '1.7.0'
|
|
10
|
+
fail 'The vagrant-cumulus plugin is only compatible with Vagrant 1.7+'
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
module VagrantPlugins
|
|
14
|
+
module GuestCumulus
|
|
15
|
+
class Plugin < Vagrant.plugin("2")
|
|
16
|
+
name "Cumulus guest"
|
|
17
|
+
description "Cumulus Linux guest support."
|
|
18
|
+
|
|
19
|
+
guest("cumulus", "debian") do
|
|
20
|
+
require_relative "guest"
|
|
21
|
+
Guest
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
guest_capability("cumulus", "configure_networks") do
|
|
25
|
+
require_relative "cap/configure_networks"
|
|
26
|
+
Cap::ConfigureNetworks
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
guest_capability("cumulus", "change_host_name") do
|
|
30
|
+
require_relative "cap/change_host_name"
|
|
31
|
+
Cap::ChangeHostName
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#VAGRANT-BEGIN
|
|
2
|
+
# The contents below are automatically generated by Vagrant. Do not modify.
|
|
3
|
+
auto <%= options[:name] %>
|
|
4
|
+
iface <%= options[:name] %> inet dhcp
|
|
5
|
+
<% if !options[:use_dhcp_assigned_default_route] %>
|
|
6
|
+
post-up route del default dev $IFACE table mgmt || true
|
|
7
|
+
<% else %>
|
|
8
|
+
# We need to disable eth0, see GH-2648
|
|
9
|
+
post-up route del default dev eth0 table mgmt
|
|
10
|
+
post-up dhclient $IFACE
|
|
11
|
+
pre-down route add default dev eth0 table mgmt
|
|
12
|
+
<% end %>
|
|
13
|
+
#VAGRANT-END
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'vagrant-cumulus/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "vagrant-cumulus"
|
|
8
|
+
spec.version = VagrantPlugins::GuestCumulus::VERSION
|
|
9
|
+
spec.authors = ["Dinesh Dutt"]
|
|
10
|
+
spec.email = ["ddutt@cumulusnetworks.com"]
|
|
11
|
+
spec.summary = %q{Guest capabilities for Cumulus Linux}
|
|
12
|
+
spec.description = %q{Primarily to rename interfaces to match Cumulus Linux front panel port names}
|
|
13
|
+
spec.homepage = ""
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: vagrant-cumulus
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: '0.1'
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dinesh Dutt
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2015-07-17 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: '1.5'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.5'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
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
|
+
description: Primarily to rename interfaces to match Cumulus Linux front panel port
|
|
42
|
+
names
|
|
43
|
+
email:
|
|
44
|
+
- ddutt@cumulusnetworks.com
|
|
45
|
+
executables: []
|
|
46
|
+
extensions: []
|
|
47
|
+
extra_rdoc_files: []
|
|
48
|
+
files:
|
|
49
|
+
- ".gitignore"
|
|
50
|
+
- Gemfile
|
|
51
|
+
- Gemfile.lock
|
|
52
|
+
- LICENSE.txt
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
55
|
+
- lib/vagrant-cumulus.rb
|
|
56
|
+
- lib/vagrant-cumulus/cap/change_host_name.rb
|
|
57
|
+
- lib/vagrant-cumulus/cap/configure_networks.rb
|
|
58
|
+
- lib/vagrant-cumulus/guest.rb
|
|
59
|
+
- lib/vagrant-cumulus/plugin.rb
|
|
60
|
+
- lib/vagrant-cumulus/version.rb
|
|
61
|
+
- templates/guests/cumulus/network_dhcp.erb
|
|
62
|
+
- templates/guests/cumulus/network_static.erb
|
|
63
|
+
- vagrant-cumulus.gemspec
|
|
64
|
+
homepage: ''
|
|
65
|
+
licenses:
|
|
66
|
+
- MIT
|
|
67
|
+
metadata: {}
|
|
68
|
+
post_install_message:
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
require_paths:
|
|
71
|
+
- lib
|
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
requirements: []
|
|
83
|
+
rubyforge_project:
|
|
84
|
+
rubygems_version: 2.2.2
|
|
85
|
+
signing_key:
|
|
86
|
+
specification_version: 4
|
|
87
|
+
summary: Guest capabilities for Cumulus Linux
|
|
88
|
+
test_files: []
|