Re-import with 1-level submodule structure
This commit is contained in:
commit
0a1de10624
78
.gitmodules
vendored
Normal file
78
.gitmodules
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
[submodule "deployment/puppet/apt"]
|
||||||
|
path = deployment/puppet/apt
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/apt.git
|
||||||
|
[submodule "deployment/puppet/common"]
|
||||||
|
path = deployment/puppet/common
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/common.git
|
||||||
|
[submodule "deployment/puppet/concat"]
|
||||||
|
path = deployment/puppet/concat
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/concat.git
|
||||||
|
[submodule "deployment/puppet/galera"]
|
||||||
|
path = deployment/puppet/galera
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/galera.git
|
||||||
|
[submodule "deployment/puppet/git"]
|
||||||
|
path = deployment/puppet/git
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/git.git
|
||||||
|
[submodule "deployment/puppet/glance"]
|
||||||
|
path = deployment/puppet/glance
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/glance.git
|
||||||
|
[submodule "deployment/puppet/haproxy"]
|
||||||
|
path = deployment/puppet/haproxy
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/haproxy.git
|
||||||
|
[submodule "deployment/puppet/horizon"]
|
||||||
|
path = deployment/puppet/horizon
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/horizon.git
|
||||||
|
[submodule "deployment/puppet/keepalived"]
|
||||||
|
path = deployment/puppet/keepalived
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/keepalived.git
|
||||||
|
[submodule "deployment/puppet/keystone"]
|
||||||
|
path = deployment/puppet/keystone
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/keystone.git
|
||||||
|
[submodule "deployment/puppet/memcached"]
|
||||||
|
path = deployment/puppet/memcached
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/memcached.git
|
||||||
|
[submodule "deployment/puppet/mmm"]
|
||||||
|
path = deployment/puppet/mmm
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/mmm.git
|
||||||
|
[submodule "deployment/puppet/mysql"]
|
||||||
|
path = deployment/puppet/mysql
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/mysql.git
|
||||||
|
[submodule "deployment/puppet/nova"]
|
||||||
|
path = deployment/puppet/nova
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/nova.git
|
||||||
|
[submodule "deployment/puppet/openstack"]
|
||||||
|
path = deployment/puppet/openstack
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/openstack.git
|
||||||
|
[submodule "deployment/puppet/rabbitmq"]
|
||||||
|
path = deployment/puppet/rabbitmq
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/rabbitmq.git
|
||||||
|
[submodule "deployment/puppet/rsync"]
|
||||||
|
path = deployment/puppet/rsync
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/rsync.git
|
||||||
|
[submodule "deployment/puppet/ssh"]
|
||||||
|
path = deployment/puppet/ssh
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/ssh.git
|
||||||
|
[submodule "deployment/puppet/stdlib"]
|
||||||
|
path = deployment/puppet/stdlib
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/stdlib.git
|
||||||
|
[submodule "deployment/puppet/swift"]
|
||||||
|
path = deployment/puppet/swift
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/swift.git
|
||||||
|
[submodule "deployment/puppet/sysctl"]
|
||||||
|
path = deployment/puppet/sysctl
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/sysctl.git
|
||||||
|
[submodule "deployment/puppet/vcsrepo"]
|
||||||
|
path = deployment/puppet/vcsrepo
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/vcsrepo.git
|
||||||
|
[submodule "deployment/puppet/xinetd"]
|
||||||
|
path = deployment/puppet/xinetd
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/xinetd.git
|
||||||
|
[submodule "deployment/puppet/lvm"]
|
||||||
|
path = deployment/puppet/lvm
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/lvm.git
|
||||||
|
[submodule "deployment/puppet/network"]
|
||||||
|
path = deployment/puppet/network
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/network.git
|
||||||
|
[submodule "deployment/puppet/selinux"]
|
||||||
|
path = deployment/puppet/selinux
|
||||||
|
url = gitolite@gitolite.mirantis.com:fuel/deployment/puppet/selinux.git
|
1
deployment/puppet/apt
Submodule
1
deployment/puppet/apt
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit bc4700f09231d08ba2497793c9f12f7192f0ddfe
|
1
deployment/puppet/common
Submodule
1
deployment/puppet/common
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 2fd274e129dee50dcbbc3441fd4a9a38258d7e83
|
1
deployment/puppet/concat
Submodule
1
deployment/puppet/concat
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 1882100b12a703121976c9162b9691cc872f893d
|
@ -0,0 +1,105 @@
|
|||||||
|
Puppet::Type.type(:firewall).provide(:lokkit) do
|
||||||
|
desc 'Use lokkit utility to manage iptables.'
|
||||||
|
|
||||||
|
commands :lokkit => '/usr/sbin/lokkit'
|
||||||
|
commands :iptables => '/sbin/iptables'
|
||||||
|
|
||||||
|
def self.prefetch(resource)
|
||||||
|
# rebuild the cahce for every puppet run
|
||||||
|
@iptables_hash = build_iptables_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.iptables_hash
|
||||||
|
@iptables_hash ||= build_iptables_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def iptables_hash
|
||||||
|
self.class.iptables_hash
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.instances
|
||||||
|
iptables_hash.collect do |k, v|
|
||||||
|
new(:name => k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.build_iptables_hash
|
||||||
|
hash = {}
|
||||||
|
File.new('/etc/sysconfig/iptables').readlines.each do |line|
|
||||||
|
if line =~ /^-A INPUT.*--dport (\d+).*-j ACCEPT$/
|
||||||
|
hash[$1] = 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
hash
|
||||||
|
end
|
||||||
|
|
||||||
|
# def ensure
|
||||||
|
# iptables_config = File.new('/etc/sysconfig/iptables')
|
||||||
|
# denied = iptables_config.grep(/^-A INPUT.*--dport #{port}.*-j ACCEPT$/).empty?
|
||||||
|
# notice("*** denied: #{denied}")
|
||||||
|
# denied ? :deny : :allow
|
||||||
|
# end
|
||||||
|
|
||||||
|
def exists?
|
||||||
|
iptables_config = File.new('/etc/sysconfig/iptables')
|
||||||
|
denied = iptables_config.grep(/^-A INPUT.*--dport #{port}.*-j ACCEPT$/).empty?
|
||||||
|
#notice("*** denied: #{denied}")
|
||||||
|
#denied ? :deny : :allow
|
||||||
|
!denied
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def create
|
||||||
|
notice("*** allow: #{port}")
|
||||||
|
# port_proto = @resource[:name] + ':' + @resource[:proto]
|
||||||
|
port_proto = @resource[:name] + ':tcp'
|
||||||
|
# if @resource[:port]
|
||||||
|
lokkit '--port', port_proto
|
||||||
|
# else
|
||||||
|
# lokkit '--service', @resource[:name]
|
||||||
|
# end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
notice("*** deny: #{port}")
|
||||||
|
iptables_new = []
|
||||||
|
# File.new('/etc/sysconfig/iptables').readlines.each do |line|
|
||||||
|
# unless line =~ /^-A INPUT.*--dport #{port}.*-j ACCEPT$/
|
||||||
|
# iptables_new << line
|
||||||
|
# notice("*** deny: #{line}")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
|
||||||
|
File.open("/etc/sysconfig/iptables", "r") do |infile|
|
||||||
|
while (line = infile.gets)
|
||||||
|
unless line =~ /^-A INPUT.*--dport #{port}.*-j ACCEPT$/
|
||||||
|
iptables_new << line
|
||||||
|
notice("*** deny: #{line}")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# File.new('/etc/sysconfig/iptables', 'w').write iptables_new.join
|
||||||
|
File.open('/etc/sysconfig/iptables', 'w') {|f| f.write(iptables_new.join) }
|
||||||
|
|
||||||
|
iptables '-D', 'INPUT', '-m', 'state', '--state', 'NEW', '-m', 'tcp',
|
||||||
|
'-p', 'tcp', '--dport', port, '-j', 'ACCEPT'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
# def port
|
||||||
|
# if @resource[:port]
|
||||||
|
# return @resource[:port].split(':')[0]
|
||||||
|
# end
|
||||||
|
# name = @resource[:name]
|
||||||
|
# services = File.new('/etc/services').readlines.grep /^#{name}\s/
|
||||||
|
# raise Puppet::Error, "Cannot find #{name} service" if services.empty?
|
||||||
|
# services[0].split[1].split('/')[0]
|
||||||
|
# end
|
||||||
|
|
||||||
|
def port
|
||||||
|
@resource[:name]
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
39
deployment/puppet/firewall/lib/puppet/type/firewall.rb
Normal file
39
deployment/puppet/firewall/lib/puppet/type/firewall.rb
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
Puppet::Type.newtype(:firewall) do
|
||||||
|
@doc = 'High level iptables management.'
|
||||||
|
|
||||||
|
ensurable do
|
||||||
|
defaultto(:present)
|
||||||
|
newvalue(:present) do
|
||||||
|
provider.create
|
||||||
|
end
|
||||||
|
newvalue(:absent) do
|
||||||
|
provider.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# newproperty(:ensure) do
|
||||||
|
# desc 'Is specified port allowed or denied.'
|
||||||
|
|
||||||
|
# newvalue(:allow) do
|
||||||
|
# provider.allow
|
||||||
|
# end
|
||||||
|
|
||||||
|
# newvalue(:deny) do
|
||||||
|
# provider.deny
|
||||||
|
# end
|
||||||
|
|
||||||
|
# defaultto :deny
|
||||||
|
# end
|
||||||
|
|
||||||
|
newparam(:name, :isnamevar => true) do
|
||||||
|
desc 'Network service name.'
|
||||||
|
end
|
||||||
|
|
||||||
|
# newparam(:port) do
|
||||||
|
# desc '<port>:<protocol>'
|
||||||
|
# end
|
||||||
|
# newparam(:proto) do
|
||||||
|
# desc 'Network protocol name'
|
||||||
|
# end
|
||||||
|
|
||||||
|
end
|
7
deployment/puppet/firewall/manifests/allow.pp
Normal file
7
deployment/puppet/firewall/manifests/allow.pp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Definition: firewall::allow
|
||||||
|
#
|
||||||
|
define firewall::allow () {
|
||||||
|
|
||||||
|
firewall { $title: ensure => present }
|
||||||
|
|
||||||
|
}
|
30
deployment/puppet/firewall/manifests/init.pp
Normal file
30
deployment/puppet/firewall/manifests/init.pp
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
class firewall {
|
||||||
|
|
||||||
|
case $::osfamily {
|
||||||
|
'RedHat': {
|
||||||
|
firewall::allow {[
|
||||||
|
22, # ssh
|
||||||
|
80, # http
|
||||||
|
3306, # mysql
|
||||||
|
4567, # mysql/galera
|
||||||
|
5000, # keystone/public
|
||||||
|
35357, # keystone/admin
|
||||||
|
9292, # glance/api
|
||||||
|
9191, # glance/reg
|
||||||
|
8773, # nova/api/ec2
|
||||||
|
8774, # nova/api/compute
|
||||||
|
8775, # nova/api/metadata
|
||||||
|
8776, # nova/api/volume
|
||||||
|
6080, # nova/vncproxy
|
||||||
|
4369, # erlang/epmd
|
||||||
|
5672, # erlang/rabbitmq
|
||||||
|
11211, # memcached
|
||||||
|
]: }
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
warning("Unsupported platform: ${::operatingsystem}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
1
deployment/puppet/galera
Submodule
1
deployment/puppet/galera
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 84da0b4940f71a2e61db6da5c831639dfb0b61ef
|
1
deployment/puppet/git
Submodule
1
deployment/puppet/git
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a91aaa5256b12f8d523d0f9fa5a9927a480ddca2
|
1
deployment/puppet/glance
Submodule
1
deployment/puppet/glance
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 87fc75fe6ddcaef80cc02ccb4ddcc98d4a3f34e1
|
1
deployment/puppet/haproxy
Submodule
1
deployment/puppet/haproxy
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b2ac3f13689df400f4a8f037a273b9cb255cc744
|
1
deployment/puppet/horizon
Submodule
1
deployment/puppet/horizon
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 59780ae6bf73f65b7c9e24ca505cbda9cf544761
|
1
deployment/puppet/keepalived
Submodule
1
deployment/puppet/keepalived
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e0ca9d52762d7190ffb4d9b3b58d9c2cf7b4b1ec
|
1
deployment/puppet/keystone
Submodule
1
deployment/puppet/keystone
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 97e3b4a1d61bf1662cdff4cd7f17e6c7c565d388
|
1
deployment/puppet/lvm
Submodule
1
deployment/puppet/lvm
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit b3b5fefac8c51ca9a1ba6e01a69b3cdbfe4c383f
|
1
deployment/puppet/memcached
Submodule
1
deployment/puppet/memcached
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 8d7ad19748a4e2990bed49d4bd20284d841ef9de
|
1
deployment/puppet/mmm
Submodule
1
deployment/puppet/mmm
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit e4227e8417590b6c668eef737c80d36372f066bd
|
1
deployment/puppet/mysql
Submodule
1
deployment/puppet/mysql
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit c77fff5b7dfe4b555a034be80e24b0a8140a0ef6
|
1
deployment/puppet/network
Submodule
1
deployment/puppet/network
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit f84e13152a3f45f0c2ddf25b0a8e68a4454c09ab
|
1
deployment/puppet/nova
Submodule
1
deployment/puppet/nova
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit d100262fa7678442efad258dbfa1718e097bbc43
|
11
deployment/puppet/ntpd/Modulefile
Normal file
11
deployment/puppet/ntpd/Modulefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
name 'sarah-ntpd-service'
|
||||||
|
version ''
|
||||||
|
source ''
|
||||||
|
author 'sarah'
|
||||||
|
license ''
|
||||||
|
summary ''
|
||||||
|
description ''
|
||||||
|
project_page ''
|
||||||
|
|
||||||
|
## Add dependencies, if any:
|
||||||
|
# dependency 'username/name', '>= 1.2.0'
|
3
deployment/puppet/ntpd/README
Normal file
3
deployment/puppet/ntpd/README
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ntpd-service
|
||||||
|
|
||||||
|
This is the ntpd-service module.
|
26
deployment/puppet/ntpd/manifests/init.pp
Normal file
26
deployment/puppet/ntpd/manifests/init.pp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#
|
||||||
|
# This module manages ntpd-service
|
||||||
|
#
|
||||||
|
|
||||||
|
class ntpd {
|
||||||
|
|
||||||
|
case $::osfamily {
|
||||||
|
'RedHat': {
|
||||||
|
$package_name = 'ntp'
|
||||||
|
$service_name = 'ntpd'
|
||||||
|
}
|
||||||
|
'Debian': {
|
||||||
|
$package_name = 'openntpd'
|
||||||
|
$service_name = 'openntpd'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
package { $package_name: ensure => present }
|
||||||
|
|
||||||
|
service { $service_name:
|
||||||
|
enable => true,
|
||||||
|
ensure => running,
|
||||||
|
require => Package[$package_name],
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
19
deployment/puppet/ntpd/metadata.json
Normal file
19
deployment/puppet/ntpd/metadata.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "sarah-ntpd-service",
|
||||||
|
"author": "sarah",
|
||||||
|
"description": "",
|
||||||
|
"license": "",
|
||||||
|
"project_page": "",
|
||||||
|
"source": "",
|
||||||
|
"summary": "",
|
||||||
|
"version": "",
|
||||||
|
"checksums": {
|
||||||
|
"Modulefile": "dd9795f80dd7398cc68277a0d0641d40",
|
||||||
|
"README": "61ceb295dda5799e5f24d8aa1abf2e0a",
|
||||||
|
"manifests/init.pp": "f71acd452188d256dc6b01d1e566e624",
|
||||||
|
"spec/spec.opts": "a600ded995d948e393fbe2320ba8e51c",
|
||||||
|
"spec/spec_helper.rb": "ca19ec4f451ebc7fdb035b52eae6e909",
|
||||||
|
"tests/init.pp": "d257385cf671b066bcd8bab5d1b63a0b"
|
||||||
|
},
|
||||||
|
"dependencies": []
|
||||||
|
}
|
6
deployment/puppet/ntpd/spec/spec.opts
Normal file
6
deployment/puppet/ntpd/spec/spec.opts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--format
|
||||||
|
s
|
||||||
|
--colour
|
||||||
|
--loadby
|
||||||
|
mtime
|
||||||
|
--backtrace
|
18
deployment/puppet/ntpd/spec/spec_helper.rb
Normal file
18
deployment/puppet/ntpd/spec/spec_helper.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
require 'pathname'
|
||||||
|
dir = Pathname.new(__FILE__).parent
|
||||||
|
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
|
||||||
|
|
||||||
|
require 'mocha'
|
||||||
|
require 'puppet'
|
||||||
|
gem 'rspec', '=1.2.9'
|
||||||
|
require 'spec/autorun'
|
||||||
|
|
||||||
|
Spec::Runner.configure do |config|
|
||||||
|
config.mock_with :mocha
|
||||||
|
end
|
||||||
|
|
||||||
|
# We need this because the RAL uses 'should' as a method. This
|
||||||
|
# allows us the same behaviour but with a different method name.
|
||||||
|
class Object
|
||||||
|
alias :must :should
|
||||||
|
end
|
1
deployment/puppet/ntpd/tests/init.pp
Normal file
1
deployment/puppet/ntpd/tests/init.pp
Normal file
@ -0,0 +1 @@
|
|||||||
|
include ntpd
|
1
deployment/puppet/openstack
Submodule
1
deployment/puppet/openstack
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a725b446c3d6bab6afa4a0e4bf351434360666b2
|
1
deployment/puppet/rabbitmq
Submodule
1
deployment/puppet/rabbitmq
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit ad041bd07785cb52e448065fa9d0a7125a780e73
|
1
deployment/puppet/rsync
Submodule
1
deployment/puppet/rsync
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 72c9acc700806ee37e181cb24bbe412e54a87969
|
1
deployment/puppet/selinux
Submodule
1
deployment/puppet/selinux
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit a14fb5e9c3005a07d4d62125b0bfd83d57bd0c07
|
1
deployment/puppet/ssh
Submodule
1
deployment/puppet/ssh
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit ba8d8e20706d0e040478ee7c5e05885b65dd1921
|
1
deployment/puppet/stdlib
Submodule
1
deployment/puppet/stdlib
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 20f3894e397ad5b7f947383a2e763f3570181966
|
1
deployment/puppet/swift
Submodule
1
deployment/puppet/swift
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 1d3d94a6222779c8ec1c422a3f7301c2802b74c4
|
1
deployment/puppet/sysctl
Submodule
1
deployment/puppet/sysctl
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 4459df2e94db1327139594bb5ee8747bab33f323
|
1
deployment/puppet/vcsrepo
Submodule
1
deployment/puppet/vcsrepo
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 246805a99c9fe57045e21d5614d326ea336f9992
|
1
deployment/puppet/xinetd
Submodule
1
deployment/puppet/xinetd
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 5990cb023ef263b14678136d36d9d39fa84a3859
|
0
fuel_test/__init__.py
Normal file
0
fuel_test/__init__.py
Normal file
28
fuel_test/base.py
Normal file
28
fuel_test/base.py
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import unittest
|
||||||
|
from devops.helpers import ssh
|
||||||
|
from ci import get_environment
|
||||||
|
from root import root
|
||||||
|
|
||||||
|
class RecipeTestCase(unittest.TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.environment = get_environment()
|
||||||
|
master = self.environment.node['master']
|
||||||
|
self.revert_snapshot()
|
||||||
|
self.remote = ssh(master.ip_address, username='root', password='r00tme')
|
||||||
|
self.remote.reconnect()
|
||||||
|
self.upload_recipes()
|
||||||
|
|
||||||
|
def upload_recipes(self):
|
||||||
|
recipes_dir = root('fuel','deployment','puppet')
|
||||||
|
remote_dir = "/etc/puppet/modules/"
|
||||||
|
self.remote.mkdir(remote_dir)
|
||||||
|
self.remote.upload(recipes_dir, remote_dir)
|
||||||
|
|
||||||
|
def revert_snapshot(self):
|
||||||
|
try:
|
||||||
|
for node in self.environment.nodes:
|
||||||
|
node.restore_snapshot('blank')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
178
fuel_test/ci.py
Normal file
178
fuel_test/ci.py
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
import logging
|
||||||
|
import traceback
|
||||||
|
import devops
|
||||||
|
from devops.model import Environment, Network, Node, Disk, Interface
|
||||||
|
from devops.helpers import tcp_ping, wait, ssh, http_server, os
|
||||||
|
from root import root
|
||||||
|
|
||||||
|
logger = logging.getLogger('ci')
|
||||||
|
|
||||||
|
class Ci:
|
||||||
|
hostname = 'nailgun'
|
||||||
|
domain = 'mirantis.com'
|
||||||
|
|
||||||
|
def __init__(self, image=None):
|
||||||
|
self.base_image = image
|
||||||
|
self.environment = None
|
||||||
|
try:
|
||||||
|
self.environment = devops.load('recipes')
|
||||||
|
logger.info("Successfully loaded existing environment")
|
||||||
|
except Exception, e:
|
||||||
|
logger.error("Failed to load existing recipes environment: " + str(e) + "\n" + traceback.format_exc())
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_environment(self):
|
||||||
|
return self.environment
|
||||||
|
|
||||||
|
def add_epel_repo(self, remote):
|
||||||
|
remote.sudo.ssh.execute('rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm')
|
||||||
|
|
||||||
|
def add_puppetlab_repo(self, remote):
|
||||||
|
remote.sudo.ssh.execute('rpm -ivh http://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-5.noarch.rpm')
|
||||||
|
|
||||||
|
def setup_puppet_client_yum(self, remote):
|
||||||
|
self.add_puppetlab_repo(remote)
|
||||||
|
remote.sudo.ssh.execute('yum -y install puppet')
|
||||||
|
|
||||||
|
def start_puppet_master(self, remote):
|
||||||
|
remote.sudo.ssh.execute('puppet resource service puppetmaster ensure=running enable=true')
|
||||||
|
|
||||||
|
def start_puppet_agent(self, remote):
|
||||||
|
remote.sudo.ssh.execute('puppet resource service puppet ensure=running enable=true')
|
||||||
|
|
||||||
|
def sign_all_node_certificates(self, remote):
|
||||||
|
remote.sudo.ssh.execute('puppet cert sign --all')
|
||||||
|
|
||||||
|
def setup_puppet_master_yum(self, remote):
|
||||||
|
self.add_puppetlab_repo(remote)
|
||||||
|
remote.sudo.ssh.execute('yum -y install puppet-server')
|
||||||
|
|
||||||
|
def change_host_name(self, remote, short, long):
|
||||||
|
remote.sudo.ssh.execute('hostname %s' % short)
|
||||||
|
self.add_to_hosts(remote, '127.0.0.1', short, long)
|
||||||
|
self.add_to_hosts(remote, '::1', short, long)
|
||||||
|
|
||||||
|
def add_to_hosts(self, remote, ip, short, long):
|
||||||
|
remote.sudo.ssh.execute('echo %s %s %s >> /etc/hosts' % (ip, short, long))
|
||||||
|
|
||||||
|
def get_environment_or_create(self):
|
||||||
|
if self.get_environment():
|
||||||
|
return self.get_environment()
|
||||||
|
self.setup_environment()
|
||||||
|
return self.environment
|
||||||
|
|
||||||
|
def describe_node(self, name, networks):
|
||||||
|
node = Node(name)
|
||||||
|
node.memory = 1024
|
||||||
|
node.vnc = True
|
||||||
|
for network in networks:
|
||||||
|
node.interfaces.append(Interface(network))
|
||||||
|
node.disks.append(Disk(base_image=self.base_image, format='qcow2'))
|
||||||
|
node.boot = ['disk']
|
||||||
|
return node
|
||||||
|
|
||||||
|
def describe_environment(self):
|
||||||
|
environment = Environment('recipes')
|
||||||
|
private = Network(name='private', dhcp_server=True)
|
||||||
|
environment.networks.append(private)
|
||||||
|
public = Network(name='public', dhcp_server=True)
|
||||||
|
environment.networks.append(public)
|
||||||
|
bridged = Network(name='bridged', dhcp_server=False)
|
||||||
|
environment.networks.append(bridged)
|
||||||
|
master = self.describe_node('master', [private, public, bridged])
|
||||||
|
environment.nodes.append(master)
|
||||||
|
client = self.describe_node('client', [private, public, bridged])
|
||||||
|
environment.nodes.append(client)
|
||||||
|
return environment
|
||||||
|
|
||||||
|
def setup_environment(self):
|
||||||
|
if not self.base_image:
|
||||||
|
raise Exception("Base image path is missing while trying to build recipes environment")
|
||||||
|
|
||||||
|
logger.info("Building recipes environment")
|
||||||
|
environment = self.describe_environment()
|
||||||
|
self.environment = environment
|
||||||
|
# todo environment should be saved before build
|
||||||
|
try:
|
||||||
|
devops.build(environment)
|
||||||
|
except :
|
||||||
|
devops.destroy(environment)
|
||||||
|
return
|
||||||
|
|
||||||
|
devops.save(environment)
|
||||||
|
logger.info("Environment has been saved")
|
||||||
|
logger.info("Starting test nodes ...")
|
||||||
|
for node in environment.nodes:
|
||||||
|
node.start()
|
||||||
|
for node in environment.nodes:
|
||||||
|
logger.info("Waiting ssh... %s" % node.ip_address)
|
||||||
|
wait(lambda: tcp_ping(node.ip_address, 22), timeout=1800)
|
||||||
|
for node in environment.nodes:
|
||||||
|
remote = ssh(node.ip_address, username='root', password='r00tme')
|
||||||
|
remote.reconnect()
|
||||||
|
self.change_host_name(remote, node.name, node.name)
|
||||||
|
logger.info("Renamed %s" % node.name)
|
||||||
|
master_node = environment.node['master']
|
||||||
|
mremote = ssh(master_node.ip_address, username='root', password='r00tme')
|
||||||
|
mremote.reconnect()
|
||||||
|
self.setup_puppet_master_yum(mremote)
|
||||||
|
with os.popen(root('fuel', 'fuel-test', 'puppet.master.config')) as f:
|
||||||
|
master_config = f.read()
|
||||||
|
self.write_config(mremote, '/etc/puppet/puppet.conf', master_config)
|
||||||
|
self.start_puppet_master(mremote)
|
||||||
|
with os.popen(root('fuel', 'fuel-test', 'puppet.agent.config')) as f:
|
||||||
|
agent_config = f.read()
|
||||||
|
for node in environment.nodes:
|
||||||
|
remote = ssh(node.ip_address, username='root', password='r00tme')
|
||||||
|
remote.reconnect()
|
||||||
|
if node.name != 'master':
|
||||||
|
self.add_to_hosts(remote, master_node.ip_address, 'master', 'master')
|
||||||
|
self.setup_puppet_client_yum(remote)
|
||||||
|
self.write_config(remote, '/etc/puppet/puppet.conf', agent_config)
|
||||||
|
self.start_puppet_agent(remote)
|
||||||
|
# logger.info("Setting up repository configuration")
|
||||||
|
# self.configure_repository(remote)
|
||||||
|
self.sign_all_node_certificates(mremote)
|
||||||
|
for node in environment.nodes:
|
||||||
|
logger.info("Creating snapshot 'blank'")
|
||||||
|
node.save_snapshot('empty')
|
||||||
|
logger.info("Test node is ready at %s" % node.ip_address)
|
||||||
|
|
||||||
|
def destroy_environment(self):
|
||||||
|
if self.environment:
|
||||||
|
devops.destroy(self.environment)
|
||||||
|
|
||||||
|
def write_config(self, remote, path, text):
|
||||||
|
file = remote.open(path, 'w')
|
||||||
|
file.write(text)
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
def configure_repository(self, remote):
|
||||||
|
repo = ("[mirantis]\n"
|
||||||
|
"name=Mirantis repository\n"
|
||||||
|
"baseurl=http://%s:%d\n"
|
||||||
|
"enabled=1\n"
|
||||||
|
"gpgcheck=0\n") % (
|
||||||
|
self.environment.networks[0].ip_addresses[1],
|
||||||
|
self.repository_server.port)
|
||||||
|
self.write_config(remote,'/etc/yum.repos.d/mirantis.repo', repo)
|
||||||
|
remote.execute('yum makecache')
|
||||||
|
|
||||||
|
def start_rpm_repository(self):
|
||||||
|
self.repository_server = http_server(
|
||||||
|
root("build", "packages", "centos", "Packages")
|
||||||
|
)
|
||||||
|
|
||||||
|
def shutdown_rpm_repository(self):
|
||||||
|
if hasattr(self, 'repository_server'):
|
||||||
|
self.repository_server.stop()
|
||||||
|
|
||||||
|
def get_environment_or_create(self, image=None):
|
||||||
|
ci = Ci(image)
|
||||||
|
return ci.get_environment_or_create()
|
||||||
|
|
||||||
|
def get_environment():
|
||||||
|
ci = Ci()
|
||||||
|
my_environment = ci.describe_environment()
|
||||||
|
my_environment.nodes[0].interfaces[0].ip_addresses = '172.18.8.56'
|
||||||
|
return ci.get_environment() or my_environment
|
63
fuel_test/integration_test.py
Normal file
63
fuel_test/integration_test.py
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
import logging
|
||||||
|
import argparse
|
||||||
|
from nose.plugins.manager import PluginManager
|
||||||
|
from nose.plugins.xunit import Xunit
|
||||||
|
from ci import Ci
|
||||||
|
|
||||||
|
def get_params():
|
||||||
|
parser = argparse.ArgumentParser(description="Integration test suite")
|
||||||
|
parser.add_argument("-i", "--image", dest="image",
|
||||||
|
help="iso image path or http://url")
|
||||||
|
parser.add_argument("-l", "--level", dest="log_level", type=str,
|
||||||
|
help="log level", choices=["DEBUG", "INFO", "WARNING", "ERROR"],
|
||||||
|
default="INFO", metavar="LEVEL")
|
||||||
|
parser.add_argument('command', choices=('setup', 'destroy', 'test'), default='test',
|
||||||
|
help="command to execute")
|
||||||
|
parser.add_argument('arguments', nargs=argparse.REMAINDER, help='arguments for nose testing framework')
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def nose_runner(params):
|
||||||
|
import nose
|
||||||
|
import nose.config
|
||||||
|
|
||||||
|
nc = nose.config.Config()
|
||||||
|
nc.verbosity = 3
|
||||||
|
nc.plugins = PluginManager(plugins=[Xunit()])
|
||||||
|
nc.configureWhere(os.path.join(os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
params.test_suite))
|
||||||
|
nose.main(config=nc, argv=[
|
||||||
|
__file__,
|
||||||
|
"--with-xunit",
|
||||||
|
"--xunit-file=nosetests.xml"
|
||||||
|
] + params.arguments)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
|
||||||
|
params = get_params()
|
||||||
|
|
||||||
|
numeric_level = getattr(logging, params.log_level.upper())
|
||||||
|
logging.basicConfig(level=numeric_level)
|
||||||
|
logger = logging.getLogger()
|
||||||
|
logger.setLevel(numeric_level+1)
|
||||||
|
|
||||||
|
ci = Ci(params.image)
|
||||||
|
|
||||||
|
if params.command == 'setup':
|
||||||
|
result = ci.get_environment_or_create()
|
||||||
|
elif params.command == 'destroy':
|
||||||
|
result = ci.destroy_environment()
|
||||||
|
else:
|
||||||
|
nose_runner(params)
|
||||||
|
result = True
|
||||||
|
|
||||||
|
if not result:
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|
30
fuel_test/puppet.agent.conf
Normal file
30
fuel_test/puppet.agent.conf
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[main]
|
||||||
|
# The Puppet log directory.
|
||||||
|
# The default value is '$vardir/log'.
|
||||||
|
logdir = /var/log/puppet
|
||||||
|
|
||||||
|
# Where Puppet PID files are kept.
|
||||||
|
# The default value is '$vardir/run'.
|
||||||
|
rundir = /var/run/puppet
|
||||||
|
|
||||||
|
# Where SSL certificates are kept.
|
||||||
|
# The default value is '$confdir/ssl'.
|
||||||
|
ssldir = $vardir/ssl
|
||||||
|
|
||||||
|
[agent]
|
||||||
|
# The file in which puppetd stores a list of the classes
|
||||||
|
# associated with the retrieved configuratiion. Can be loaded in
|
||||||
|
# the separate ``puppet`` executable using the ``--loadclasses``
|
||||||
|
# option.
|
||||||
|
# The default value is '$confdir/classes.txt'.
|
||||||
|
classfile = $vardir/classes.txt
|
||||||
|
|
||||||
|
# Where puppetd caches the local configuration. An
|
||||||
|
# extension indicating the cache format is added automatically.
|
||||||
|
# The default value is '$confdir/localconfig'.
|
||||||
|
localconfig = $vardir/localconfig
|
||||||
|
|
||||||
|
server = master
|
||||||
|
pluginsync = true
|
||||||
|
|
||||||
|
|
25
fuel_test/puppet.master.config
Normal file
25
fuel_test/puppet.master.config
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
[main]
|
||||||
|
# The Puppet log directory.
|
||||||
|
# The default value is '$vardir/log'.
|
||||||
|
logdir = /var/log/puppet
|
||||||
|
|
||||||
|
# Where Puppet PID files are kept.
|
||||||
|
# The default value is '$vardir/run'.
|
||||||
|
rundir = /var/run/puppet
|
||||||
|
|
||||||
|
# Where SSL certificates are kept.
|
||||||
|
# The default value is '$confdir/ssl'.
|
||||||
|
ssldir = $vardir/ssl
|
||||||
|
|
||||||
|
[agent]
|
||||||
|
# The file in which puppetd stores a list of the classes
|
||||||
|
# associated with the retrieved configuratiion. Can be loaded in
|
||||||
|
# the separate ``puppet`` executable using the ``--loadclasses``
|
||||||
|
# option.
|
||||||
|
# The default value is '$confdir/classes.txt'.
|
||||||
|
classfile = $vardir/classes.txt
|
||||||
|
|
||||||
|
# Where puppetd caches the local configuration. An
|
||||||
|
# extension indicating the cache format is added automatically.
|
||||||
|
# The default value is '$confdir/localconfig'.
|
||||||
|
localconfig = $vardir/localconfig
|
6
fuel_test/root.py
Normal file
6
fuel_test/root.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import os
|
||||||
|
here = lambda * x: os.path.join(os.path.abspath(os.path.dirname(__file__)), *x)
|
||||||
|
|
||||||
|
REPOSITORY_ROOT = here('../..')
|
||||||
|
|
||||||
|
root = lambda * x: os.path.join(os.path.abspath(REPOSITORY_ROOT), *x)
|
29
fuel_test/test_apply_noop.py
Normal file
29
fuel_test/test_apply_noop.py
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import logging
|
||||||
|
from base import RecipeTestCase
|
||||||
|
|
||||||
|
logger = logging.getLogger('test_recepts')
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class MyTestCase(RecipeTestCase):
|
||||||
|
|
||||||
|
def parse_out(self, out):
|
||||||
|
errors = []
|
||||||
|
warnings = []
|
||||||
|
for line in out:
|
||||||
|
logger.info(line)
|
||||||
|
if line.find('error:') !=-1:
|
||||||
|
errors.append(line)
|
||||||
|
if line.find('warning:') !=-1:
|
||||||
|
warnings.append(line)
|
||||||
|
return errors, warnings
|
||||||
|
|
||||||
|
def test_apply_all_modules_with_noop(self):
|
||||||
|
result = self.remote.execute("for i in `find /etc/puppet/modules/ | grep tests/.*pp`; do puppet apply --modulepath=/etc/puppet/modules/puppet/ --noop $i ; done")
|
||||||
|
self.assertEqual([], result['stderr'], result['stderr'])
|
||||||
|
errors, warnings = self.parse_out(result['stdout'])
|
||||||
|
self.assertEqual([], errors, errors)
|
||||||
|
self.assertEqual([], warnings, warnings)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
20
pull-all.sh
Executable file
20
pull-all.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# If we're not on master anywhere, pulling master doesn't make sense
|
||||||
|
echo Checking if all submodules are on branch master - otherwise git checkout master manually
|
||||||
|
git submodule foreach -q --recursive "git branch | grep -q '* master'"
|
||||||
|
|
||||||
|
# If we have uncommitted changes anywhere, they'll be lost.
|
||||||
|
echo Checking if submodules don\'t have uncommitted changes - otherwise commit/push manually
|
||||||
|
pushd deployment/puppet
|
||||||
|
git submodule foreach -q --recursive 'if (git status -s | grep .); then echo You have uncommitted changes in $path, they would be lost; return 1; fi'
|
||||||
|
popd
|
||||||
|
|
||||||
|
# If we have local unpushed changes, they'll be lost too.
|
||||||
|
echo Checking if submodules don\'t have unpushed changes - otherwise pull/push submodule manually
|
||||||
|
git submodule foreach -q --recursive 'git rev-parse origin/master | grep -q $(git rev-parse master)'
|
||||||
|
|
||||||
|
git pull
|
||||||
|
git submodule update --init --recursive --merge
|
||||||
|
|
35
push-all.sh
Executable file
35
push-all.sh
Executable file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo Checking for uncommitted changes in submodules
|
||||||
|
pushd deployment/puppet
|
||||||
|
git submodule foreach -q --recursive 'if (git status -s | grep .); then echo You have uncommitted changes in $path; return 1; fi'
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Repeated to compensate for ssh connection resets :(
|
||||||
|
echo Checking if push will not conflict in submodules
|
||||||
|
git submodule foreach -q --recursive 'echo $path; git push -q --dry-run origin master || git push -q --dry-run origin master'
|
||||||
|
|
||||||
|
changed=0
|
||||||
|
pushd deployment/puppet
|
||||||
|
subrepos=""
|
||||||
|
for subrepo in `git submodule status | grep '^+' | awk '{print $2}'`
|
||||||
|
do
|
||||||
|
subrepos="$subrepo $subrepos"
|
||||||
|
changed=1
|
||||||
|
pushd $subrepo
|
||||||
|
git push origin master
|
||||||
|
popd
|
||||||
|
done
|
||||||
|
if [ "$changed" == "1" ]
|
||||||
|
then
|
||||||
|
git commit -m "Updated submodules: $subrepos" $subrepos
|
||||||
|
git push origin master
|
||||||
|
fi
|
||||||
|
popd
|
||||||
|
if [ "$changed" == "1" ]
|
||||||
|
then
|
||||||
|
git commit -m "Updated submodules: deployment/puppet/$subrepos" deployment/puppet
|
||||||
|
fi
|
||||||
|
git push origin master
|
Loading…
Reference in New Issue
Block a user