Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable NetworkManager in RHEL for Bridge interfaces and some RHEL testing improvements #61

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
driver_plugin: vagrant
platforms:
- name: centos-6.5
- name: centos-6.6
- name: ubuntu-12.04
driver_config:
box: precise-64-lxc-preseed
box_url: http://vagrant.hw-ops.com/precise-64-lxc-preseed.box
- name: ubuntu-14.10
# driver_config:
# box: precise-64-lxc-preseed
# box_url: http://vagrant.hw-ops.com/precise-64-lxc-preseed.box
# box: precise-64
# box_url: https://github.com/downloads/chrisroberts/vagrant-boxes/precise-64.box
# box: opscode-ubuntu-12.04
Expand Down
3 changes: 2 additions & 1 deletion Cheffile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ site 'http://community.opscode.com/api/v1'

cookbook 'lxc', path: './'
cookbook 'apt'
cookbook 'lxc-test', path: 'test/cookbooks/lxc-test'
cookbook 'yum-epel'
cookbook 'lxc-test', path: 'test/cookbooks/lxc-test'
5 changes: 3 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
source "https://rubygems.org"

ruby '2.1.5'

gem 'librarian-chef'
gem 'vagrant', :git => 'git://github.com/mitchellh/vagrant', :tag => 'v1.3.4'
gem 'kitchen-vagrant'
gem 'test-kitchen', git: 'git://github.com/opscode/test-kitchen.git', branch: 'b934b45db306389a9ed42eae5375a4814aaf4cfe'
gem 'test-kitchen'
150 changes: 71 additions & 79 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,111 +1,103 @@
GIT
remote: git://github.com/mitchellh/vagrant
revision: 0ac2a87388419b989c3c0d0318cc97df3b0ed27d
tag: v1.3.4
specs:
vagrant (1.3.4)
childprocess (~> 0.3.7)
erubis (~> 2.7.0)
i18n (~> 0.6.0)
log4r (~> 1.1.9)
net-scp (~> 1.1.0)
net-ssh (~> 2.6.6)

GIT
remote: git://github.com/opscode/test-kitchen.git
revision: b934b45db306389a9ed42eae5375a4814aaf4cfe
branch: b934b45db306389a9ed42eae5375a4814aaf4cfe
specs:
test-kitchen (1.0.0.dev)
celluloid
mixlib-shellout
net-scp
net-ssh
pry
safe_yaml (~> 0.9.5)
thor

GEM
remote: https://rubygems.org/
specs:
archive-tar-minitar (0.5.2)
celluloid (0.15.2)
timers (~> 1.1.0)
chef (11.6.2)
chef (12.0.3)
chef-zero (~> 3.2)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
ffi-yajl (~> 1.2)
highline (~> 1.6, >= 1.6.9)
json (>= 1.4.4, <= 1.7.7)
mixlib-authentication (~> 1.3)
mixlib-cli (~> 1.3)
mixlib-config (~> 1.1, >= 1.1.2)
mixlib-cli (~> 1.4)
mixlib-config (~> 2.0)
mixlib-log (~> 1.3)
mixlib-shellout (~> 1.1)
mixlib-shellout (>= 2.0.0.rc.0, < 3.0)
net-ssh (~> 2.6)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0, < 7.0.0)
rest-client (>= 1.0.4, < 1.7.0)
yajl-ruby (~> 1.1)
childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11)
coderay (1.0.9)
net-ssh-multi (~> 1.1)
ohai (~> 8.0)
plist (~> 3.1.0)
pry (~> 0.9)
chef-zero (3.2.1)
ffi-yajl (~> 1.1)
hashie (~> 2.0)
mixlib-log (~> 1.3)
rack
uuidtools (~> 2.1)
coderay (1.1.0)
diff-lcs (1.2.5)
erubis (2.7.0)
ffi (1.9.0)
highline (1.6.19)
i18n (0.6.5)
ffi (1.9.6)
ffi-yajl (1.3.1)
ffi (~> 1.5)
libyajl2 (~> 1.2)
hashie (2.1.2)
highline (1.6.21)
ipaddress (0.8.0)
json (1.7.7)
kitchen-vagrant (0.11.1)
test-kitchen (~> 1.0.0.beta.3)
librarian (0.1.1)
kitchen-vagrant (0.15.0)
test-kitchen (~> 1.0)
librarian (0.1.2)
highline
thor (~> 0.15)
librarian-chef (0.0.2)
archive-tar-minitar (>= 0.5.2)
librarian-chef (0.0.4)
chef (>= 0.10)
librarian (~> 0.1.0)
log4r (1.1.10)
minitar (>= 0.5.2)
libyajl2 (1.2.0)
method_source (0.8.2)
mime-types (1.25)
mime-types (1.25.1)
minitar (0.5.4)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-cli (1.5.0)
mixlib-config (2.1.0)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0)
net-scp (1.1.2)
mixlib-shellout (2.0.1)
net-dhcp (1.3.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (2.6.8)
net-ssh (2.9.2)
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
ohai (6.18.0)
net-ssh-multi (1.2.0)
net-ssh (>= 2.6.5)
net-ssh-gateway (>= 1.2.0)
ohai (8.0.1)
ffi (~> 1.9)
ffi-yajl (~> 1.1)
ipaddress
mime-types (~> 1.16)
mixlib-cli
mixlib-config
mixlib-config (~> 2.0)
mixlib-log
mixlib-shellout
systemu
yajl-ruby
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
mixlib-shellout (~> 2.0)
net-dhcp
rake (~> 10.1)
systemu (~> 2.6.4)
wmi-lite (~> 1.0)
plist (3.1.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rest-client (1.6.7)
mime-types (>= 1.16)
safe_yaml (0.9.7)
slop (3.4.6)
systemu (2.5.2)
thor (0.18.1)
timers (1.1.0)
yajl-ruby (1.1.0)
rack (1.6.0)
rake (10.4.2)
safe_yaml (1.0.4)
slop (3.6.0)
systemu (2.6.4)
test-kitchen (1.3.1)
mixlib-shellout (>= 1.2, < 3.0)
net-scp (~> 1.1)
net-ssh (~> 2.7)
safe_yaml (~> 1.0)
thor (~> 0.18)
thor (0.19.1)
uuidtools (2.1.5)
wmi-lite (1.0.0)

PLATFORMS
ruby

DEPENDENCIES
kitchen-vagrant
librarian-chef
test-kitchen!
vagrant!
test-kitchen
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
default[:lxc][:addr] = '10.0.4.1'
default[:lxc][:netmask] = '255.255.255.0'
default[:lxc][:network] = '10.0.4.0/24'
default[:lxc][:nm_controlled] = 'no'
default[:lxc][:dhcp_range] = '10.0.4.2,10.0.4.254'
default[:lxc][:dhcp_max] = '253'
default[:lxc][:shutdown_timeout] = 120
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Chef driven Linux Containers'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.0.0'
version '2.0.1'

suggests 'omnibus_updater'
suggests 'bridger'
Expand Down
33 changes: 18 additions & 15 deletions recipes/rhel_bridge.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,32 @@
action [:enable, :start]
end

execute 'create lxcbr0' do
command 'brctl addbr lxcbr0'
not_if 'brctl showmacs lxcbr0'
bridge_name = node[:lxc][:bridge]

execute "create #{bridge_name}" do
command "brctl addbr #{bridge_name}"
not_if "brctl showmacs #{bridge_name}"
end

file '/etc/sysconfig/network-scripts/ifcfg-lxcbr0' do
file "/etc/sysconfig/network-scripts/ifcfg-#{bridge_name}" do
content lazy{
{
:device => 'lxcbr0',
:device => bridge_name,
:type => 'Bridge',
:bootproto => 'static',
:ipaddr => node[:lxc][:default_config][:lxc_addr],
:netmask => '255.255.255.0'
:ipaddr => node[:lxc][:addr],
:netmask => node[:lxc][:netmask],
:nm_controlled=> node[:lxc][:nm_controlled]
}.map do |k,v|
"#{k.to_s.upcase}=#{v.inspect}"
end.join("\n")
}
mode 0644
notifies :run, 'execute[enable lxcbr0]', :immediately
notifies :run, "execute[enable #{bridge_name}]", :immediately
end

execute 'enable lxcbr0' do
command 'ifup lxcbr0'
execute "enable #{bridge_name}" do
command "ifup #{bridge_name}"
action :nothing
end

Expand All @@ -52,7 +55,7 @@
':PREROUTING ACCEPT [0:0]',
':OUTPUT ACCEPT [0:0]',
':POSTROUTING ACCEPT [0:0]',
"-A POSTROUTING -s #{node[:lxc][:default_config][:lxc_network]} ! -d #{node[:lxc][:default_config][:lxc_network]} -j MASQUERADE",
"-A POSTROUTING -s #{node[:lxc][:network]} ! -d #{node[:lxc][:network]} -j MASQUERADE",
'COMMIT',
''
].join("\n")
Expand Down Expand Up @@ -94,11 +97,11 @@
file '/etc/dnsmasq.conf' do
content lazy{
{
'listen-address' => node[:lxc][:default_config][:lxc_addr],
'interface' => 'lxcbr0',
'listen-address' => node[:lxc][:addr],
'interface' => bridge_name,
'except-interface' => 'lo',
'bind-interfaces' => true,
'dhcp-range' => "#{node[:lxc][:default_config][:lxc_dhcp_range]}"
'dhcp-range' => "#{node[:lxc][:dhcp_range]}"
}.map do |k,v|
if(v == true)
k
Expand All @@ -118,7 +121,7 @@
file '/etc/lxc/default.conf' do
content [
'lxc.network.type = veth',
'lxc.network.link = lxcbr0',
"lxc.network.link = #{bridge_name}",
'lxc.network.flags = up',
''
].join("\n")
Expand Down
1 change: 1 addition & 0 deletions test/cookbooks/lxc-test/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@

depends 'lxc'
depends 'apt'
depends 'yum-epel'
depends 'minitest-handler'
10 changes: 9 additions & 1 deletion test/cookbooks/lxc-test/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
include_recipe 'minitest-handler'
include_recipe 'apt'

if(node.platform_family?(:debian))
include_recipe 'apt'
end

if(node.platform_family?(:rhel))
include_recipe 'yum-epel'
end

include_recipe 'lxc'