mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-23 04:08:02 +00:00
example code: python2 and python3 install modules, script generators and ctf vulnerability/challenge module wrappers
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user