example code: python2 and python3 install modules, script generators and ctf vulnerability/challenge module wrappers

This commit is contained in:
ts
2018-08-03 15:32:13 +01:00
parent 990d15a4c9
commit a6ff9c508b
79 changed files with 3796 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
require 'spec_helper_acceptance'
describe 'python class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
class { 'python': }
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end
end

View File

@@ -0,0 +1,43 @@
require 'spec_helper_acceptance'
describe 'python class' do
context 'facts' do
install_python = <<-EOS
class { 'python' :
version => 'system',
pip => 'present',
virtualenv => 'present',
}
EOS
fact_notices = <<-EOS
notify{"pip_version: ${::pip_version}":}
notify{"system_python_version: ${::system_python_version}":}
notify{"python_version: ${::python_version}":}
notify{"virtualenv_version: ${::virtualenv_version}":}
EOS
it 'should output python facts when not installed' do
apply_manifest(fact_notices, :catch_failures => true) do |r|
expect(r.stdout).to match(/python_version: \S+/)
expect(r.stdout).to match(/pip_version: \S+/)
expect(r.stdout).to match(/virtualenv_version: \S+/)
expect(r.stdout).to match(/system_python_version: \S+/)
end
end
it 'sets up python' do
apply_manifest(install_python, :catch_failures => true)
end
it 'should output python facts when installed' do
apply_manifest(fact_notices, :catch_failures => true) do |r|
expect(r.stdout).to match(/python_version: \S+/)
expect(r.stdout).to match(/pip_version: \S+/)
expect(r.stdout).to match(/virtualenv_version: \S+/)
expect(r.stdout).to match(/system_python_version: \S+/)
end
end
end
end

View File

@@ -0,0 +1,10 @@
HOSTS:
centos-59-x64:
roles:
- master
platform: el-5-x86_64
box : centos-59-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-59-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: git

View File

@@ -0,0 +1,12 @@
HOSTS:
centos-64-x64:
roles:
- master
- database
- dashboard
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: pe

View File

@@ -0,0 +1,10 @@
HOSTS:
centos-65-x64:
roles:
- master
platform: el-6-x86_64
box : centos-65-x64-vbox436-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box
hypervisor : vagrant
CONFIG:
type: foss

View File

@@ -0,0 +1,10 @@
HOSTS:
debian-70rc1-x64:
roles:
- master
platform: debian-70rc1-x64
box : debian-70rc1-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss

View File

@@ -0,0 +1,11 @@
HOSTS:
debian-73-x64:
roles:
- master
platform: debian-7-amd64
box : debian-73-x64-virtualbox-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
hypervisor : vagrant
CONFIG:
log_level: debug
type: git

View File

@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-12042-x64:
roles:
- master
platform: ubuntu-server-12.04-amd64
box : ubuntu-server-12042-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
vagrant_ssh_port_random: true

View File

@@ -0,0 +1,10 @@
HOSTS:
ubuntu-server-10044-x64:
roles:
- master
platform: ubuntu-10.04-amd64
box : ubuntu-server-10044-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss

View File

@@ -0,0 +1,10 @@
HOSTS:
ubuntu-server-12042-x64:
roles:
- master
platform: ubuntu-12.04-amd64
box : ubuntu-server-12042-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss

View File

@@ -0,0 +1,11 @@
HOSTS:
ubuntu-server-1404-x64:
roles:
- master
platform: ubuntu-14.04-amd64
box : puppetlabs/ubuntu-14.04-64-nocm
box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm
hypervisor : vagrant
CONFIG:
log_level : debug
type: git

View File

@@ -0,0 +1,34 @@
require 'spec_helper_acceptance'
describe 'python class' do
context 'default parameters' do
# Using puppet_apply as a helper
it 'should work with no errors' do
pp = <<-EOS
class { 'python' :
version => 'system',
pip => 'present',
virtualenv => 'present',
}
->
python::virtualenv { 'venv' :
ensure => 'present',
systempkgs => false,
venv_dir => '/opt/venv',
owner => 'root',
group => 'root',
}
->
python::pip { 'rpyc' :
ensure => '3.2.3',
virtualenv => '/opt/venv',
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
end
end