vagrant-atomic 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/lib/vagrant-atomic/guest.rb +7 -1
- data/lib/vagrant-atomic/plugin.rb +0 -5
- data/lib/vagrant-atomic/version.rb +1 -1
- metadata +12 -13
- data/lib/vagrant-atomic/cap/configure_networks.rb +0 -98
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ae89fcd9e176e407d8a9904de9aeccc22688e12
|
4
|
+
data.tar.gz: 75d69780dc27429a6011fffd193d07babbace82e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a30c23f402f5cdd2bdf46b35a70fdacd72053a282799a80b4e8b8aba8592039d5aa6f84d89170060c59b1e5bca1ddb4b5f6c9ef3b795d4644a3c7bbd2eb6125c
|
7
|
+
data.tar.gz: f782d0fbf06939c5675c6fec5838499da64733f49bdace3939208d006593484b2eda27d8bd66765728fe03ef36a3fbc8d0188964d6222f5fda64b6d201c2886b
|
data/.gitignore
CHANGED
data/lib/vagrant-atomic/guest.rb
CHANGED
@@ -4,7 +4,13 @@ module VagrantPlugins
|
|
4
4
|
module GuestAtomic
|
5
5
|
class Guest < Vagrant.plugin("2", :guest)
|
6
6
|
def detect?(machine)
|
7
|
-
|
7
|
+
# For now we use this non 100% bullet proof solution.
|
8
|
+
# Bugs issued to include word atomic in upstream releases
|
9
|
+
# Centos: http://bugs.centos.org/view.php?id=8288
|
10
|
+
# Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1200122
|
11
|
+
#
|
12
|
+
# machine.communicate.test("cat /etc/os-release | grep Atomic")
|
13
|
+
machine.communicate.test("which rpm-ostree")
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
@@ -20,11 +20,6 @@ module VagrantPlugins
|
|
20
20
|
Cap::ChangeHostName
|
21
21
|
end
|
22
22
|
|
23
|
-
guest_capability("atomic", "configure_networks") do
|
24
|
-
require_relative "cap/configure_networks"
|
25
|
-
Cap::ConfigureNetworks
|
26
|
-
end
|
27
|
-
|
28
23
|
guest_capability("atomic", "docker_daemon_running") do
|
29
24
|
require_relative "cap/docker"
|
30
25
|
Cap::Docker
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-atomic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Langdon White
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Enables the Project Atomic OS (http://projectatomic.io) as a guest for
|
15
15
|
vagrant. Tested with Fedora Atomic and RHEL Atomic
|
@@ -18,23 +18,22 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
-
- .
|
22
|
-
- CHANGELOG.md
|
23
|
-
- Gemfile
|
21
|
+
- vagrant-atomic.gemspec
|
24
22
|
- LICENSE
|
25
23
|
- README.md
|
26
|
-
- Rakefile
|
27
24
|
- Vagrantfile
|
28
25
|
- lib/vagrant-atomic.rb
|
26
|
+
- lib/vagrant-atomic/plugin.rb
|
27
|
+
- lib/vagrant-atomic/guest.rb
|
28
|
+
- lib/vagrant-atomic/cap/unregister.rb
|
29
|
+
- lib/vagrant-atomic/cap/register.rb
|
29
30
|
- lib/vagrant-atomic/cap/change_host_name.rb
|
30
|
-
- lib/vagrant-atomic/cap/configure_networks.rb
|
31
31
|
- lib/vagrant-atomic/cap/docker.rb
|
32
|
-
- lib/vagrant-atomic/cap/register.rb
|
33
|
-
- lib/vagrant-atomic/cap/unregister.rb
|
34
|
-
- lib/vagrant-atomic/guest.rb
|
35
|
-
- lib/vagrant-atomic/plugin.rb
|
36
32
|
- lib/vagrant-atomic/version.rb
|
37
|
-
-
|
33
|
+
- CHANGELOG.md
|
34
|
+
- Rakefile
|
35
|
+
- Gemfile
|
36
|
+
- .gitignore
|
38
37
|
homepage:
|
39
38
|
licenses:
|
40
39
|
- GPL-2.0
|
@@ -55,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
54
|
version: 1.3.6
|
56
55
|
requirements: []
|
57
56
|
rubyforge_project: vagrant-atomic
|
58
|
-
rubygems_version: 2.
|
57
|
+
rubygems_version: 2.0.14
|
59
58
|
signing_key:
|
60
59
|
specification_version: 4
|
61
60
|
summary: Enables the Project Atomic OS (http://projectatomic.io) as a guest for vagrant
|
@@ -1,98 +0,0 @@
|
|
1
|
-
require "set"
|
2
|
-
require "tempfile"
|
3
|
-
|
4
|
-
require "vagrant/util/retryable"
|
5
|
-
require "vagrant/util/template_renderer"
|
6
|
-
|
7
|
-
module VagrantPlugins
|
8
|
-
module GuestAtomic
|
9
|
-
module Cap
|
10
|
-
class ConfigureNetworks
|
11
|
-
extend Vagrant::Util::Retryable
|
12
|
-
include Vagrant::Util
|
13
|
-
|
14
|
-
def self.configure_networks(machine, networks)
|
15
|
-
network_scripts_dir = machine.guest.capability("network_scripts_dir")
|
16
|
-
|
17
|
-
virtual = false
|
18
|
-
interface_names = Array.new
|
19
|
-
machine.communicate.sudo("/usr/sbin/biosdevname; echo $?") do |_, result|
|
20
|
-
virtual = true if result.chomp == '4'
|
21
|
-
end
|
22
|
-
|
23
|
-
if virtual
|
24
|
-
machine.communicate.sudo("ls /sys/class/net | grep -v lo") do |_, result|
|
25
|
-
interface_names = result.split("\n")
|
26
|
-
end
|
27
|
-
|
28
|
-
interface_names = networks.map do |network|
|
29
|
-
"eth#{network[:interface]}"
|
30
|
-
end
|
31
|
-
else
|
32
|
-
machine.communicate.sudo("/usr/sbin/biosdevname -d | grep Kernel | cut -f2 -d: | sed -e 's/ //;'") do |_, result|
|
33
|
-
interface_names = result.split("\n")
|
34
|
-
end
|
35
|
-
|
36
|
-
interface_name_pairs = Array.new
|
37
|
-
interface_names.each do |interface_name|
|
38
|
-
machine.communicate.sudo("/usr/sbin/biosdevname --policy=all_ethN -i #{interface_name}") do |_, result|
|
39
|
-
interface_name_pairs.push([interface_name, result.gsub("\n", "")])
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
setting_interface_names = networks.map do |network|
|
44
|
-
"eth#{network[:interface]}"
|
45
|
-
end
|
46
|
-
|
47
|
-
interface_name_pairs.each do |interface_name, previous_interface_name|
|
48
|
-
if setting_interface_names.index(previous_interface_name) == nil
|
49
|
-
interface_names.delete(interface_name)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Accumulate the configurations to add to the interfaces file as well
|
55
|
-
# as what interfaces we're actually configuring since we use that later.
|
56
|
-
interfaces = Set.new
|
57
|
-
networks.each do |network|
|
58
|
-
interface = interface_names[network[:interface]-1]
|
59
|
-
interfaces.add(interface)
|
60
|
-
network[:device] = interface
|
61
|
-
|
62
|
-
# Remove any previous vagrant configuration in this network
|
63
|
-
# interface's configuration files.
|
64
|
-
machine.communicate.sudo("touch #{network_scripts_dir}/ifcfg-#{interface}")
|
65
|
-
machine.communicate.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-#{interface} > /tmp/vagrant-ifcfg-#{interface}")
|
66
|
-
machine.communicate.sudo("cat /tmp/vagrant-ifcfg-#{interface} > #{network_scripts_dir}/ifcfg-#{interface}")
|
67
|
-
machine.communicate.sudo("rm -f /tmp/vagrant-ifcfg-#{interface}")
|
68
|
-
|
69
|
-
# Render and upload the network entry file to a deterministic
|
70
|
-
# temporary location.
|
71
|
-
entry = TemplateRenderer.render("guests/atomic/network_#{network[:type]}",
|
72
|
-
options: network)
|
73
|
-
|
74
|
-
temp = Tempfile.new("vagrant")
|
75
|
-
temp.binmode
|
76
|
-
temp.write(entry)
|
77
|
-
temp.close
|
78
|
-
|
79
|
-
machine.communicate.upload(temp.path, "/tmp/vagrant-network-entry_#{interface}")
|
80
|
-
end
|
81
|
-
|
82
|
-
# Bring down all the interfaces we're reconfiguring. By bringing down
|
83
|
-
# each specifically, we avoid reconfiguring p7p (the NAT interface) so
|
84
|
-
# SSH never dies.
|
85
|
-
interfaces.each do |interface|
|
86
|
-
retryable(on: Vagrant::Errors::VagrantError, tries: 3, sleep: 2) do
|
87
|
-
machine.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-#{interface}")
|
88
|
-
machine.communicate.sudo("/sbin/ifdown #{interface}", error_check: true)
|
89
|
-
machine.communicate.sudo("/sbin/ifup #{interface}")
|
90
|
-
end
|
91
|
-
|
92
|
-
machine.communicate.sudo("rm -f /tmp/vagrant-network-entry_#{interface}")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|