vagrant-redhat7_eth_fix 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/mitchellh/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gem "vagrant-redhat7-eth-fix", path: "."
9
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 Wei Tie
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,31 @@
1
+ # VagrantPlugins::GuestRedhat7EthFix
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'vagrant-redhat7-eth-fix'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install vagrant-redhat7-eth-fix
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/TieWei/vagrant-redhat7-eth-fix/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,3 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,7 @@
1
+ require 'vagrant-redhat7_eth_fix/plugin'
2
+
3
+ module VagrantPlugins
4
+ module GuestRedhat7EthFix
5
+
6
+ end
7
+ end
@@ -0,0 +1,32 @@
1
+
2
+ module VagrantPlugins
3
+ module GuestRedhat7EthFix
4
+ class Flavor
5
+ def self.flavor(machine)
6
+ # Read the version file
7
+ output = ""
8
+ machine.communicate.sudo("cat /etc/redhat-release") do |type, data|
9
+ output += data if type == :stdout
10
+ end
11
+ output.chomp!
12
+
13
+ # Detect various flavors we care about
14
+ if output =~ /(CentOS|Red Hat Enterprise|Scientific) Linux( .+)? release 7/i
15
+ nics_string = ""
16
+ machine.communicate.sudo("ls -1 /sys/class/net/") do |type, data|
17
+ nics_string += data if type == :stdout
18
+ end
19
+ nics_string.chomp!
20
+ nics = nics_string.split("\n")
21
+ if nics.count{|nic| nic =~ /^eth\d+/i} > 0
22
+ return :rhel_7_eth
23
+ else
24
+ return :rhel_7
25
+ end
26
+ else
27
+ return :rhel
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module GuestRedhat7EthFix
5
+ class Guest < Vagrant.plugin('2', :guest)
6
+ def detect?(machine)
7
+ machine.communicate.test("cat /etc/redhat-release")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ require "vagrant"
2
+
3
+ module VagrantPlugins
4
+ module GuestRedhat7EthFix
5
+ class Plugin < Vagrant.plugin('2')
6
+ name "Redhat7 Eth Fix"
7
+ description "Fix Redhat 7 Non Consistent Nic Naming"
8
+
9
+ guest('rhel7_eth', 'redhat') do
10
+ require_relative 'guest'
11
+ Guest
12
+ end
13
+
14
+ guest_capability('rhel7_eth', 'flavor') do
15
+ require_relative "flavor"
16
+ Flavor
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module GuestRedhat7EthFix
3
+ VERSION = "0.0.1"
4
+ end
5
+ 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-redhat7_eth_fix/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-redhat7_eth_fix"
8
+ spec.version = VagrantPlugins::GuestRedhat7EthFix::VERSION
9
+ spec.authors = ["Wei Tie"]
10
+ spec.email = ["wtie@cisco.com"]
11
+ spec.summary = "Vagrant plugin for Redhat 7 using non consistent nic naming"
12
+ spec.description = "Vagrant plugin for Redhat 7 boot with net.ifnames=0 and biosdevname=0"
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.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-redhat7_eth_fix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Wei Tie
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-03-31 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.7'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.7'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '10.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '10.0'
46
+ description: Vagrant plugin for Redhat 7 boot with net.ifnames=0 and biosdevname=0
47
+ email:
48
+ - wtie@cisco.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - lib/vagrant-redhat7_eth_fix.rb
59
+ - lib/vagrant-redhat7_eth_fix/flavor.rb
60
+ - lib/vagrant-redhat7_eth_fix/guest.rb
61
+ - lib/vagrant-redhat7_eth_fix/plugin.rb
62
+ - lib/vagrant-redhat7_eth_fix/version.rb
63
+ - vagrant-redhat7-eth-fix.gemspec
64
+ homepage: ''
65
+ licenses:
66
+ - MIT
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
70
+ - lib
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ none: false
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubyforge_project:
85
+ rubygems_version: 1.8.23
86
+ signing_key:
87
+ specification_version: 3
88
+ summary: Vagrant plugin for Redhat 7 using non consistent nic naming
89
+ test_files: []